Skip to main content

Module base64

Module base64 

Source
Expand description

Base64 encoding and decoding (RFC 4648 §4 + §5).

Zero-dependency replacement for the base64 crate.

§Supply Chain Sovereignty

This module has zero external dependencies. It replaces the base64 crate for the nexcore ecosystem.

§Alphabets

  • Standard (§4): A-Z a-z 0-9 + / with = padding
  • URL-safe (§5): A-Z a-z 0-9 - _ with optional padding

§Examples

use nexcore_codec::base64;

let encoded = base64::encode(b"Hello, World!");
assert_eq!(encoded, "SGVsbG8sIFdvcmxkIQ==");

let decoded = base64::decode("SGVsbG8sIFdvcmxkIQ==").unwrap();
assert_eq!(decoded, b"Hello, World!");

Enums§

DecodeError
Error returned when decoding an invalid Base64 string.

Functions§

decode
Decode a standard Base64 string (with or without padding).
decode_url_safe_no_pad
Decode a URL-safe Base64 string (without padding).
encode
Encode bytes using standard Base64 with = padding.
encode_url_safe
Encode bytes using URL-safe Base64 with = padding.
encode_url_safe_no_pad
Encode bytes using URL-safe Base64 without padding.