Like the simple hashes, these work the same regardless of if the backend is
OpenSSL or mbedTLS.
Also move into ./lib/tls/ and split into two specific to mbedtls or openssl
backends.
The URL encode variant is the same, except + is coded as -, and / is coded as _
to avoid urlencoding when the base64 is used in situations that are urlencoded.