sm9_core
This is a pairing cryptography library written in pure Rust. It makes use of the Barreto-Naehrig (BN) curve construction from "SM9 identity-based cryptographic algorithms" to provide two cyclic groups G 1 and G 2 , with an R-ate pairing:
e: G 1 × G 2 → G T
Security warnings
This library, like other pairing cryptography libraries implementing this construction, is not resistant to side-channel attacks.
API
Fris an element of F rG1is a point on the BN curve E/Fq : y 2 = x 3 + bG2is a point on the twisted BN curve E'/Fq2 : y 2 = x 3 + b/xiGtis a group element (written multiplicatively) obtained with thepairingfunction overG1andG2.
Examples
(See integration_test.rs for the full example.)
use hex;
use *;
let ks = from_slice.unwrap;
let r = from_slice.unwrap;
let pub_s = G2one * ks;
let g = pairing.pow;
println!;
let r1 = g.to_slice;
let r0 = hex!;
assert_eq!
License
Licensed under either of
- MIT license, (http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
at your option.
Copyright 2023 John-Yu.
Thanks
The fields and groups algorithms come from zcash - bn, and pairing algorithms come from GmSSL.
Thanks for them.
Authors
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.