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=="

User contributed notes

BETA

Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)