bn254
bn254 is an open-source Rust implementation of aggregate signatures over the pairing-friendly elliptic curve BN254 (Barreto-Naehrig (BN)).
This curve is also known as bn256 or bn128 (alt-bn128) referred to the bits of security. The bits of security of bn254 dropped from 128 to around 100 after the new algorithms of Kim-Barbulescu.
DISCLAIMER: This is experimental software. Be careful!
Usage
This module uses the substrate-bn library to perform elliptic curve operations over the appropriate fields. It provides the following functionalities:
sign: Sign a message given a secret key.verify: Given a public key, a signature, and a message it verifies whether the signature is valid.
Signature and public aggregation can be done directly with the + or - operators.
Hashing to G1
The algorithm used for hashing a given message into a point in G1 follows the "try-and-increment" method. We discourage its usage in the cases of hashing secret messages since its running time leaks information about the input.
In other cases, where the message to be hashed is public, "try-and-increment" should be safe. The hashing algorithm utilized is sha256.
Example
Sign, aggregate and verify by using the bn254 curve:
use ;
License
bn254 is published under the MIT license