data base64
Base64 (RFC 4648): encode with padding, encodeUrl URL-safe without padding; the decoders are strict
(alphabet, padding and trailing bits are checked) and return DecodeError.Malformed.
Example:
use std.crypto { base64 }
use std.ser { bytesOf, textOf }
fn main() io {
let text = base64.encode(bytesOf(&"hello"))
print("{text} {textOf(&base64.decode(text)!)!}")
}Output
aGVsbG8= hello
pub(api) data base64Thread safety. pure functions; safe from any task.
Since. 1.0.0-beta
Methods
encode | (input: bytes) -> strBase64 with padding. |
encodeUrl | (input: bytes) -> strURL-safe Base64 without padding. |
decode | (text: str) -> bytes | DecodeErrorStrict Base64 decoding (alphabet, padding and trailing bits are checked). |
decodeUrl | (text: str) -> bytes | DecodeErrorURL-safe alphabet; padding is optional. |
Defined in: std/crypto/crypto.oxl:336