decode64

Base64-decodes a string.

Merely wraps Base64.decode and std.string.representation into one function that will work with strings.

@safe pure
string
decode64
(
const string encoded
)

Parameters

encoded string

Encoded string to decode.

Return Value

Type: string

A decoded normal string.

Examples

{
    immutable password = "base64:aGFyYmwgc25hcmJsIDEyMzQ1";
    immutable decoded = decode64(password[7..$]);
    assert((decoded == "harbl snarbl 12345"), decoded);
}
{
    immutable password = "base64:";
    immutable decoded = decode64(password[7..$]);
    assert(!decoded.length, decoded);
}

See Also