digest.base64url_nopad

STRINGdigest.base64url_nopadSTRINGs

Available in all subroutines.

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

The alphabet used is:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789-_

This function does not length-pad the output string.

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_nopad_encoded STRING;
set var.base64url_nopad_encoded = digest.base64url_nopad("Καλώς ορίσατε");
# var.base64url_nopad_encoded is now "zprOsc67z47PgiDOv8-Bzq_Pg86xz4TOtQ"

Try it out

digest.base64url_nopad is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Base64 URL path segments

Unknown data in URL paths can result in invalid URLs, but base64url is designed to be URL-safe.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.