# rework std.base64 api · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/a44283b0b2e585d7e15d7c8e6574411b75c12a0a)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: a44283b0b2e585d7e15d7c8e6574411b75c12a0a

Requested commit: a44283b0b2e585d7e15d7c8e6574411b75c12a0a

Commit: a44283b0b2e585d7e15d7c8e6574411b75c12a0a

Tree: eb65022cc018de1061d44e030e4ce1287b991041

Author: Josh Wolfe

Committer: Josh Wolfe

## Message

```
rework std.base64 api

* rename decode to decodeExactUnsafe.
* add decodeExact, which checks for invalid chars and padding.
* add decodeWithIgnore, which also allows ignoring chars.
* alphabets are supplied to the decoders with their
  char-to-index mapping already built, which enables it to be
  done at comptime.
* all decode/encode apis except decodeWithIgnore require dest
  to be the exactly correct length. This is calculated by a
  calc function corresponding to each api. These apis no longer
  return the dest parameter.
* for decodeWithIgnore, an exact size cannot be known a priori.
  Instead, a calc function gives an upperbound, and a runtime
  error is returned in case of overflow. decodeWithIgnore
  returns the number of bytes written to dest.

closes #611

```

## Parents

- [339d48ac1558dcd1977574372becd21f7fc4a075](https://git.cafe/gitcafe/zig/commit/339d48ac1558dcd1977574372becd21f7fc4a075?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/a44283b0b2e585d7e15d7c8e6574411b75c12a0a?format=markdown)
