BaseDecode
BaseDecode["string"]
decodes the Base64 data contained in a string and returns the result as a byte array.
BaseDecode["string","encoding"]
decodes using the string using the specified encoding.
Details
- The result of BaseDecode["string"] is a ByteArray object.
- Available encodings include:
-
"Base16" hexadecimal representation of byte values "Base64" default Base64 as described in the internet standard recommendation RFC 4648 "Base85ASCII" Ascii85 or a85 encoding, with the "z shortcut"
Examples
open allclose allScope (2)
Encode the bytes 1 through 12:
The bytes can be recovered using BaseDecode:
Properties & Relations (8)
Characters outside the valid alphabet are automatically dropped:
The "Base16" format uses two characters for each byte value:
"Base64" encodes up to three bytes in each block of four characters:
Input must be properly padded to a multiple of four:
"Base85ASCII" can encode four bytes in a block of five characters:
Unlike other formats, padding is not required to yield a complete block:
The character "z" is special and denotes four consecutive zeros:
BaseEncode is the inverse of BaseDecode:
BaseEncode decodes a Base64-encoded string to binary data:
The import format "Base64" decodes a Base64 string and converts the resulting bytes to a string:
Achieve the same result with BaseDecode and ByteArrayToString:
BaseDecode converts the "Base64Encoding" format of Hash to its "ByteArray" format:
Text
Wolfram Research (2018), BaseDecode, Wolfram Language function, https://reference.wolfram.com/language/ref/BaseDecode.html (updated 2020).
CMS
Wolfram Language. 2018. "BaseDecode." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/BaseDecode.html.
APA
Wolfram Language. (2018). BaseDecode. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BaseDecode.html