Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
colinnielsen committed Nov 27, 2024
1 parent d6c3b46 commit 9787de8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@

**Noir Array Helpers** is a Noir function library to manipulate arrays. This library serves a kitchen sink for various array functions the Noir community finds useful.

## WARNING!

| **It is not recommended to use versions of this library < `v0.30.0`**

This library was related to a vulnerability in [ecrecover](https://github.com/colinnielsen/ecrecover-noir) found by @olehmisar.
Vulnerability details can be found [here](https://gist.github.com/olehmisar/4cfe6128eaac2bfbe1fa8eb46f0116d6).

## Installation

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

```toml
[dependencies]
array_helpers = { tag = "v0.19.0", git = "https://github.com/colinnielsen/noir-array-helpers" }
array_helpers = { tag = "v0.30.0", git = "https://github.com/colinnielsen/noir-array-helpers" }
```

then `use` it in your circuits:
Expand Down Expand Up @@ -48,15 +55,12 @@ let eth_addr_u8: [u8;20] = [...];

Here are the methods available in the library:

**NOTE**: this lib ships with constrained and unconstrained versions of each function, and are post-fixed with `_unconstrained`. (unconstrained is not currently implemented as of Noir v0.6.0, but will allow you to optimize your gate count if you do not need to constrain the computation of the function)

### `split_u8_64`

Splits an array of `u8` values, with a length of 64, into two arrays of `u8` values, each with a length of 32.

```rust
fn split_u8_64(arr: [u8; 64]) -> ([u8; 32], [u8; 32])
fn split_u8_64_unconstrained(arr: [u8; 64]) -> ([u8; 32], [u8; 32])
```

### `u8_32_to_u8_64`
Expand All @@ -65,7 +69,6 @@ Combines two arrays of `u8` values, each of length 32, into a single array of `u

```rust
fn u8_32_to_u8_64(arr_a: [u8; 32], arr_b: [u8; 32]) -> [u8; 64]
fn u8_32_to_u8_64_unconstrained(arr_a: [u8; 32], arr_b: [u8; 32]) -> [u8; 64]
```

### `u8_to_u160`
Expand All @@ -76,10 +79,8 @@ Converts an array of `u8` values to a `Field` value, representing a u160 value.

```rust
fn u8_to_u160(array: [u8]) -> Field
fn u8_to_u160_unconstrained(array: [u8]) -> Field

fn u8_to_eth_address(array: [u8]) -> Field
fn u8_to_eth_address_unconstrained(array: [u8]) -> Field
```

### `u8_32s_to_u64_16`
Expand All @@ -88,7 +89,6 @@ Converts two arrays of `u8` values, each of length 32, to a single array of `u64

```rust
fn u8_32s_to_u64_16(arr_a: [u8; 32], arr_b: [u8; 32]) -> [u64; 16]
fn u8_32s_to_u64_16_unconstrained(arr_a: [u8; 32], arr_b: [u8; 32]) -> [u64; 16]
```

### `u64_4_to_u8_32`
Expand All @@ -97,7 +97,6 @@ Converts an array of `u64` values, with a length of 4, to an array of `u8` value

```rust
fn u64_4_to_u8_32(array: [u64; 4]) -> [u8; 32]
fn u64_4_to_u8_32_unconstrained(array: [u64; 4]) -> [u8; 32]
```

## License
Expand Down

0 comments on commit 9787de8

Please sign in to comment.