https://github.com/lunastev/essentials
A minimalist utility library for the Noir programming language, focused on providing essential zero-knowledge circuit components with a clean and practical API.
https://github.com/lunastev/essentials
essentials library noir-lang sha256
Last synced: 4 days ago
JSON representation
A minimalist utility library for the Noir programming language, focused on providing essential zero-knowledge circuit components with a clean and practical API.
- Host: GitHub
- URL: https://github.com/lunastev/essentials
- Owner: LunaStev
- License: mpl-2.0
- Created: 2025-06-03T09:40:45.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-06-03T10:01:18.000Z (8 months ago)
- Last Synced: 2025-10-07T14:49:26.323Z (4 months ago)
- Topics: essentials, library, noir-lang, sha256
- Language: Noir
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# essentials
A minimalist utility library for the Noir programming language, focused on providing essential zero-knowledge circuit components with a clean and practical API.
---
## โจ Features
* `hash_sha256`: Compute SHA-256 hash of a byte array (uses official Noir sha256 submodule)
* `verify_equal`: Assert that two Field values are equal
* `is_even`: Check if a Field value is even (casts to u32 internally)
* `check_in_range`: Assert that a Field is within a given inclusive range (uses u32 casting)
---
## ๐ฆ Installation
1. Clone this repo with submodules:
```bash
git clone --recurse-submodules https://github.com/yourname/essentials.git
```
2. Or add it to an existing Noir project:
```bash
git submodule add https://github.com/yourname/essentials.git essentials
```
3. Then in your `Nargo.toml`:
```toml
[dependencies]
essentials = { path = "./essentials" }
sha256 = { path = "./essentials/sha256" }
```
---
## ๐งช Usage
Example in your main Noir file:
```noir
use essentials::hash::hash_sha256;
use essentials::logic::{verify_equal, is_even};
use essentials::range::check_in_range;
fn main() {
let x: Field = 4;
let y: Field = 4;
verify_equal(x, y);
assert(is_even(x));
check_in_range(x, 1, 10);
}
```
---
## ๐ File Structure
```
essentials/
โโโ Nargo.toml
โโโ src/
โ โโโ lib.nr
โ โโโ hash.nr
โ โโโ logic.nr
โ โโโ range.nr
โโโ sha256/ (submodule)
```
---
## ๐ชช License
This project is licensed under the [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/).