BinaryEncode
Encodes binary data to a string with the specified algorithm
Method Signature
BinaryEncode(binary=[any], encoding=[string])
Arguments
Argument
Type
Required
Description
Default
binary
any
true
The binary data to encode
encoding
string
true
The encoding to use
Examples
Encode a binary string back to a string using hex
use binaryEncode to Encode with hex
s = binaryDecode( "737472696E67", "hex" );
binaryEncode( s, "hex" );
Result: 737472696e67
Encode a binary using UNIX UUencode (UU) back into string
use binaryEncode to Encode with UNIX UUencode (UU)
s = binaryDecode( "&<W1R:6YG", "UU" );
binaryEncode( s, "UU" );
Result: W1R6YA==
Encode a binary using base64 back into a string
use binaryEncode to Encode with base64
s = binaryDecode( "&<W1R:6YG", "base64" );
binaryEncode( s, "base64" );
Result: W1R6YA==
Additional Examples
base_64 = ToBase64( "I am a string." );
binary_data = ToBinary( base_64 );
dump( BinaryEncode( binary_data, "hex" ) );
// 4920616D206120737472696E672E
Related
Last updated
Was this helpful?