# `nupp.codec.base64` Standard base64, encoded and decoded as `@aot` entries. The alphabet and its inverse are `const` strings, so a compiled entry reads them out of static arrays whose bounds the C compiler holds rather than out of a rooted argument whose length it must load. With `aot = "off"` this is the same source on LuaJIT. Whole words rather than single bytes on both sides: twelve input bytes are three aligned words and four twenty-four bit groups, and four output bytes are one word. `bench/base64` measures what that is worth, and measures this against the vectorized C it could be. ## Functions ### `base64.decode` _function_ ```nupp function base64.decode(text: string): string ``` Decodes standard base64, padded. ```nupp assert(nupp.codec.base64.decode("TnVwcA==") == "Nupp") ``` #### Arguments | Name | Type | Description | | --- | --- | --- | | `text` | `string` | the text to decode | #### Returns | Type | Description | | --- | --- | | `string` | the decoded bytes | #### Raises - when the length is not a multiple of four, or a character is not in the alphabet ### `base64.encode` _function_ ```nupp function base64.encode(value: string): string ``` Encodes bytes as standard base64, padded. ```nupp assert(nupp.codec.base64.encode("Nupp") == "TnVwcA==") ``` #### Arguments | Name | Type | Description | | --- | --- | --- | | `value` | `string` | the bytes to encode | #### Returns | Type | Description | | --- | --- | | `string` | the encoded text |