View source code
Display the source code in std/base64.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.base64.Base64Impl.decodeLength

Given a Base64 encoded string, calculates the length of the decoded string.

size_t decodeLength (
  in size_t sourceLength
) pure nothrow @safe;

Parameters

NameDescription
sourceLength The length of the Base64 encoding.

Returns

The length of the decoded string corresponding to a Base64 encoding of length sourceLength.

Example

auto encoded = "Gis8TV1u";

// Allocate a sufficiently large buffer to hold to decoded result.
auto buffer = new ubyte[Base64.decodeLength(encoded.length)];

Base64.decode(encoded, buffer);
writeln(buffer); // [0x1a, 0x2b, 0x3c, 0x4d, 0x5d, 0x6e]

Authors

Masahiro Nakagawa, Daniel Murphy (Single value Encoder and Decoder)

License

Boost License 1.0.