These functions all return bytes, so make them work with bytes directly rather than converting integers to strings then converting them to bytes.
It improves code readability and performance.
Also remove unused `GetSecret()` function.
Depends on D14462