The goog.crypt.base64 Namespace

.ENCODED_VALS {string}

Our default alphabet. Value 64 (=) is special; it means "nothing."

.ENCODED_VALS_BASE {string}

Our default alphabet, shared between ENCODED_VALS and ENCODED_VALS_WEBSAFE

.ENCODED_VALS_WEBSAFE {string}

Our websafe alphabet.

.HAS_NATIVE_SUPPORT {boolean}

Whether this browser supports the atob and btoa functions. This extension started at Mozilla but is now implemented by many browsers. We use the ASSUME_* variables to avoid pulling in the full useragent detection library but still allowing the standard per-browser compilations.

.decodeString(input, opt_webSafe)

Base64-decode a string.

input {string}
to decode.
opt_webSafe {boolean=}
True if we should use the alternative alphabet.
returns {string}
string representing the decoded value.

.decodeStringToByteArray(input, opt_webSafe)

Base64-decode a string.

input {string}
to decode (length not required to be a multiple of 4).
opt_webSafe {boolean=}
True if we should use the alternative alphabet.
returns {Array}
bytes representing the decoded value.

.encodeByteArray(input, opt_webSafe)

Base64-encode an array of bytes.

input {Array.<number>|Uint8Array}
An array of bytes (numbers with value in [0, 255]) to encode.
opt_webSafe {boolean=}
Boolean indicating we should use the alternative alphabet.
returns {string}
The base64 encoded string.

.encodeString(input, opt_webSafe)

Base64-encode a string.

input {string}
A string to encode.
opt_webSafe {boolean=}
If true, we should use the alternative alphabet.
returns {string}
The base64 encoded string.