# Tom-256
This library implements the tom256 curve and is a copy of the secp256k1 implementation.
Parameters source: <https://neuromancer.sk/std/other/Tom-256#>
Paper: <https://eprint.iacr.org/2021/1183>
Curve information - in parentheses names from neuromancer.sk:
* Base field: q (p) =
secp: 115792089237316195423570985008687907852837564279074904382605163141518161494337
115792089210356248762697446949407573530594504085698471288169790229257723883799
* Scalar field: r (n) =
secp: 115792089237316195423570985008687907853269984665640564039457584007908834671663
115792089210356248762697446949407573530086143415290314195533631308867097853951
* Curve equation a (a) =
secp: 0
115792089210356248762697446949407573530594504085698471288169790229257723883796
* Curve equation b (b) =
secp: 7
81531206846337786915455327229510804132577517753388365729879493166393691077718
* Base point G =
secp: (55066263022277343669578718895168534326250603453777594175500187360389116729240,
32670510020758816978083085130507043184471273380659243275938904335757337482424)
(3, 40902200210088653215032584946694356296222563095503428277299570638400093548589)
* Curve equation: y^2 = x^3 + ax + b
# Development
## Setup
Run once after cloning to activate the git hooks (requires [devbox](https://www.jetify.com/devbox)):
```
devbox run setup
```
## Testing
The R1CS constraint tests require the `r1cs` feature:
```
cargo test --features r1cs,zero-flag
```
## Using this library in another project
The `zero-flag` feature (enabled by default) uses `type ZeroFlag = ()` in the `SWCurveConfig` impl, which requires a patched version of `ark-ec` not yet released on crates.io.
### With the patched `ark-ec` (recommended)
Add the same patch to your root `Cargo.toml`:
```toml
[patch.crates-io]
ark-ec = { git = "https://github.com/arkworks-rs/algebra" }
```
Then depend on this library normally:
```toml
[dependencies]
ark-tom256 = "..."
```
### Without the patched `ark-ec`
Disable the default features to exclude `zero-flag`:
```toml
[dependencies]
ark-tom256 = { version = "...", default-features = false }
```
Re-enable any other default features you need (e.g. `std`):
```toml
ark-tom256 = { version = "...", default-features = false, features = ["std"] }
```
The `curve-constraint-tests/` directory contains a vendored copy of
[`ark-curve-constraint-tests`](https://github.com/arkworks-rs/algebra/tree/master/curves/curve-constraint-tests)
from the arkworks algebra repository. It is not published on crates.io, so it
is kept here to make the repository self-contained.
# Thanks
Thanks to @lovesh (Lovesh Harchandani) for helping us with this.