Available in all subroutines.

This function interprets a string resulting from the concatenation of the parameters to the function as a hexadecimal string and it converts it to a Base64-encoded sequence of the same bytes.

For example, "009FC233" on input will produce "AJ/CMw==" on output.

In particular this allows hexadecimal sequences with representations of the octet 00 to be converted to the Base64 format without incurring the truncation that would occur if this conversion was performed in two steps: first by decoding the hexadecimal sequence to a VCL string and then by encoding the VCL string to Base64.

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.


sub vcl_miss {
set bereq.http.ShaBase64 = bin.hex_to_base64(digest.hash_sha256(bereq.http.Token ":salt"));
sub vcl_error {
synthetic.base64 bin.hex_to_base64("00" req.http.Message "1a");