This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
forked from paulmillr/noble-curves
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BrainpoolP256r1, 384r1 and 512r1
Needed for OpenPGP
- Loading branch information
Showing
18 changed files
with
69,994 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { createCurve } from './_shortw_utils.js'; | ||
import { sha256 } from '@openpgp/noble-hashes/sha256'; | ||
import { Field } from './abstract/modular.js'; | ||
import { BigInteger } from '@openpgp/noble-hashes/biginteger'; | ||
|
||
// brainpoolP256r1: https://datatracker.ietf.org/doc/html/rfc5639#section-3.4 | ||
|
||
const Fp = Field(BigInteger.new('0xa9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377')); | ||
const CURVE_A = Fp.create(BigInteger.new('0x7d5a0975fc2c3057eef67530417affe7fb8055c126dc5c6ce94a4b44f330b5d9')); | ||
const CURVE_B = BigInteger.new('0x26dc5c6ce94a4b44f330b5d9bbd77cbf958416295cf7e1ce6bccdc18ff8c07b6'); | ||
|
||
// prettier-ignore | ||
export const brainpoolP256r1 = createCurve({ | ||
a: CURVE_A, // Equation params: a, b | ||
b: CURVE_B, | ||
Fp, | ||
// Curve order (q), total count of valid points in the field | ||
n: BigInteger.new('0xa9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7'), | ||
// Base (generator) point (x, y) | ||
Gx: BigInteger.new('0x8bd2aeb9cb7e57cb2c4b482ffc81b7afb9de27e1e3bd23c23a4453bd9ace3262'), | ||
Gy: BigInteger.new('0x547ef835c3dac4fd97f8461a14611dc9c27745132ded8e545c1d54c72f046997'), | ||
h: BigInteger.new(1), | ||
lowS: false, | ||
} as const, sha256); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { createCurve } from './_shortw_utils.js'; | ||
import { sha384 } from '@openpgp/noble-hashes/sha512'; | ||
import { Field } from './abstract/modular.js'; | ||
import { BigInteger } from '@openpgp/noble-hashes/biginteger'; | ||
|
||
// brainpoolP384 r1: https://datatracker.ietf.org/doc/html/rfc5639#section-3.6 | ||
|
||
const Fp = Field(BigInteger.new('0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53')); | ||
const CURVE_A = Fp.create(BigInteger.new('0x7bc382c63d8c150c3c72080ace05afa0c2bea28e4fb22787139165efba91f90f8aa5814a503ad4eb04a8c7dd22ce2826')); | ||
const CURVE_B = BigInteger.new('0x04a8c7dd22ce28268b39b55416f0447c2fb77de107dcd2a62e880ea53eeb62d57cb4390295dbc9943ab78696fa504c11'); | ||
|
||
// prettier-ignore | ||
export const brainpoolP384r1 = createCurve({ | ||
a: CURVE_A, // Equation params: a, b | ||
b: CURVE_B, | ||
Fp, | ||
// Curve order (q), total count of valid points in the field | ||
n: BigInteger.new('0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565'), | ||
// Base (generator) point (x, y) | ||
Gx: BigInteger.new('0x1d1c64f068cf45ffa2a63a81b7c13f6b8847a3e77ef14fe3db7fcafe0cbd10e8e826e03436d646aaef87b2e247d4af1e'), | ||
Gy: BigInteger.new('0x8abe1d7520f9c2a45cb1eb8e95cfd55262b70b29feec5864e19c054ff99129280e4646217791811142820341263c5315'), | ||
h: BigInteger.new(1), | ||
lowS: false, | ||
} as const, sha384); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { createCurve } from './_shortw_utils.js'; | ||
import { sha512 } from '@openpgp/noble-hashes/sha512'; | ||
import { Field } from './abstract/modular.js'; | ||
import { BigInteger } from '@openpgp/noble-hashes/biginteger'; | ||
|
||
// brainpoolP512r1: https://datatracker.ietf.org/doc/html/rfc5639#section-3.7 | ||
|
||
const Fp = Field(BigInteger.new('0xaadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f3')); | ||
const CURVE_A = Fp.create(BigInteger.new('0x7830a3318b603b89e2327145ac234cc594cbdd8d3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94ca')); | ||
const CURVE_B = BigInteger.new('0x3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94cadc083e67984050b75ebae5dd2809bd638016f723'); | ||
|
||
// prettier-ignore | ||
export const brainpoolP512r1 = createCurve({ | ||
a: CURVE_A, // Equation params: a, b | ||
b: CURVE_B, | ||
Fp, | ||
// Curve order (q), total count of valid points in the field | ||
n: BigInteger.new('0xaadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069'), | ||
// Base (generator) point (x, y) | ||
Gx: BigInteger.new('0x81aee4bdd82ed9645a21322e9c4c6a9385ed9f70b5d916c1b43b62eef4d0098eff3b1f78e2d0d48d50d1687b93b97d5f7c6d5047406a5e688b352209bcb9f822'), | ||
Gy: BigInteger.new('0x7dde385d566332ecc0eabfa9cf7822fdf209f70024a57b1aa000c55b881f8111b2dcde494a5f485e5bca4bd88a2763aed1ca2b2fa8f0540678cd1e0f3ad80892'), | ||
h: BigInteger.new(1), | ||
lowS: false, | ||
} as const, sha512); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.