Encoding

Index

All Encoding functions

Name Function header Example Result Description Errorhandling
b64dec / base64decode func(v string) []byte [[ $result := toString (b64dec "VGhpcyBpcyBhIHRlc3Qgc3RyaW5nCg==") ]] $result = “This is a test string\n” The b64dec / base64decode function returns the decode value of the inputstring, which is formated in base64
b64enc / base64encode func(v []byte) string [[ $result := b64enc (toByte "-----BEGIN CERTIFICATE----- < Certificate >-----END CERTIFICATE-----\n") ]] $result = “LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tIDwgQ2VydGlmaWNhdGUgPi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K” The b64enc / base64encode function converts a string into a base64 string.

b64dec / base64decode

func(v string) []byte

The b64dec / base64decode function returns the decode value of the inputstring, which is formated in base64.

Application notes / Limits:

If the input value is not in base64 format, the application return an error: base64Encode: Unsupported Type

Examples


[[ $result := toString (b64dec "VGhpcyBpcyBhIHRlc3Qgc3RyaW5nCg==") ]]
$result = "This is a test string\n"

[[ $result := toString (b64dec "VEhJUyBJUyBBIFRFU1QgU1RSSU5HIFVQUEVSQ0FTRQo=") ]]
$result = "THIS IS A TEST STRING UPPERCASE\n"

b64enc / base64encode

func(v []byte) string

The b64enc / base64encode function converts a string into a base64 string.

Examples


[[ $result := b64enc (toByte "-----BEGIN CERTIFICATE----- < Certificate >-----END CERTIFICATE-----\n") ]]
$result = "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tIDwgQ2VydGlmaWNhdGUgPi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"

[[ $result := b64enc (toByte "GaGaGuGuGcGcGbGbGhGH==Blubber==") ]]
$result = "R2FHYUd1R3VHY0djR2JHYkdoR0g9PUJsdWJiZXI9PQ=="