Home

Awesome

Noir base64

License: MIT Nargo Test 🌌

Noir base64 contains functions for base64 string and u8 array encoding for Aztec's Noir language

Installation

In your Nargo.toml file, add the following dependency:

[dependencies]
base64 = { tag = "v0.1.2", git = "https://github.com/zkworks-xyz/noir-base64" }

Usage

use dep::base64;

fn main() {
    let result: [u8; 8] = base64::encode_str("foobar", [0; 8]);
}

API

Library exposes two functions:

pub fn encode_str<N, M>(input: str<N>, mut result: [u8; M]) -> [u8; M]
pub fn encode<N, M>(input: [u8; N], mut result: [u8; M], url_safe: bool) -> [u8; M]

Base64 decoding is not supported yet. Will be implemented in future releases.

Example project

Directory examples/base64_example/ contains example Noir project with base64 library as dependency.

License

This project is licensed under the MIT License. See the LICENSE file for details.