BinaryDecode

Encodes binary data to a string with the specified algorithm

Method Signature

BinaryDecode(string=[string], encoding=[string])

Arguments

Argument
Type
Required
Description
Default

string

string

true

The string to decode that has binary encoded data

encoding

string

true

The encoding type to use for decoding the binary data. Valid values are: Hex, UU, Base64, Base64Url

Examples

Decode a string using hex back into binary encoding of the string

use binaryDecode to decode with hex

Run Example

binaryDecode( "F62B", "hex" );

Result: [B@1a0d6c79

Decode a string using UNIX UUencode (UU) back into binary encoding of the string

use binaryDecode to decode with UNIX UUencode (UU)

Run Example

binaryDecode( "&<W1R:6YG", "UU" );

Result: [B@20fe6ce1

Decode a string using base64 back into binary encoding of the string

use binaryDecode to decode with base64

Run Example

binaryDecode( "U3RyaW5n", "base64" );

Result: [B@2a0e22fa

Create a byte array with 16 bytes

Each byte in the array is set to 0

Run Example

arrayLen( binaryDecode( "00000000000000000000000000000000", "hex" ) );

Result: 16

Additional Examples

Run Example

base_64 = ToBase64( "I am a string." );
binary_data = ToBinary( base_64 );
encoded_binary = BinaryEncode( binary_data, "hex" );
dump( BinaryDecode( encoded_binary, "hex" ) );

Last updated

Was this helpful?