Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TaceoLabs/noir-aes
https://github.com/TaceoLabs/noir-aes
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/TaceoLabs/noir-aes
- Owner: TaceoLabs
- License: mit
- Created: 2023-10-06T08:36:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-19T09:56:56.000Z (11 months ago)
- Last Synced: 2024-02-13T00:52:12.092Z (9 months ago)
- Language: Roff
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
- awesome-noir - AES - a (naive) implementation of AES encryption and decryption (Get Coding / Libraries)
README
# A (naive) implementation of AES en/decryption for Noir
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
This repository contains a Noir crate implementing the AES-128 encryption function.
It should be noted that this implementation only uses basic optimizations and mostly serves as a comparison point for more Zk-friendly encryption functions such as
[GMiMC](https://github.com/TaceoLabs/noir-gmimc) or [Hydra](https://github.com/TaceoLabs/noir-hydra).## Performance
A single call of the AES-128 encryption function requires about 380k constraints in the backend, compared to 4-6k for GMiMC and Hydra (which also encrypt 4 full field elements instead of 16 `u8`s).
## Installation
In your `Nargo.toml` file, add the following dependency:
```toml
[dependencies]
aes = { tag = "v0.4.0", git = "https://github.com/TaceoLabs/noir-aes" }
```## Examples
To encrypt a single block of 16 bytes, we write:
```Rust
use dep::aes;let pt = [0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff];
let key = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f];
let ct = [0x69,0xc4,0xe0,0xd8,0x6a,0x7b,0x04,0x30,0xd8,0xcd,0xb7,0x80,0x70,0xb4,0xc5,0x5a];
assert(aes::aes_128_enc(pt, key) == ct);
```## Disclaimer
This is **experimental software** and is provided on an "as is" and "as available" basis. We do **not give any warranties** and will **not be liable for any losses** incurred through any use of this code base.