bn254.js 916 B

1234567891011121314151617181920212223
  1. /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
  2. import { sha256 } from '@noble/hashes/sha256';
  3. import { getHash } from './_shortw_utils.js';
  4. import { Field } from './abstract/modular.js';
  5. import { weierstrass } from './abstract/weierstrass.js';
  6. /**
  7. * bn254 pairing-friendly curve.
  8. * Previously known as alt_bn_128, when it had 128-bit security.
  9. * Barbulescu-Duquesne 2017 shown it's weaker: just about 100 bits,
  10. * so the naming has been adjusted to its prime bit count
  11. * https://hal.science/hal-01534101/file/main.pdf
  12. */
  13. export const bn254 = weierstrass({
  14. a: BigInt(0),
  15. b: BigInt(3),
  16. Fp: Field(BigInt('0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47')),
  17. n: BigInt('0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001'),
  18. Gx: BigInt(1),
  19. Gy: BigInt(2),
  20. h: BigInt(1),
  21. ...getHash(sha256),
  22. });
  23. //# sourceMappingURL=bn254.js.map