digest.base64url

STRINGdigest.base64urlSTRINGs

Available inall subroutines.

Returns a Base64-encoded representation of the string s that is suitable for use in URLs and is suitable for decoding by digest.base64url_decode. For URL-safety, instances of + are replaced with - and instances of / are replaced with _.

The alphabet used is:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789-_

The output string is padded to a multiple of four characters in length using the = character.

See digest.base64_decode for details on the structure of Base64 encoding. In particular, note that it is possible for two input strings to encode to the same Base64 string.

Example

declare local var.base64url_encoded STRING;
set var.base64url_encoded = digest.base64url("Καλώς ορίσατε");
# var.base64url_encoded is now "zprOsc67z47PgiDOv8-Bzq_Pg86xz4TOtQ=="