Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for alt_bn128 curve. #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Following curve 'presets' are embedded into the library:
* `p521`
* `curve25519`
* `ed25519`
* `alt_bn128`

NOTE: That `curve25519` could not be used for ECDSA, use `ed25519` instead.

Expand Down
15 changes: 15 additions & 0 deletions lib/elliptic/curves.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,18 @@ defineCurve('secp256k1', {
pre,
],
});

defineCurve('alt_bn128', {
type: 'short',
prime: null,
p: '30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47',
a: '0',
b: '3',
n: '30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001',
hash: hash.sha256,
gRed: false,
g: [
'1',
'2',
],
});
1 change: 1 addition & 0 deletions test/ecdh-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('ECDH', function() {
test('curve25519');
test('ed25519');
test('secp256k1');
test('alt_bn128');
});

describe('ECDH twist attack', () => {
Expand Down
1 change: 1 addition & 0 deletions test/ecdsa-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ describe('ECDSA', function() {
test('p256');
test('p384');
test('p521');
test('alt_bn128');

describe('RFC6979 vector', function() {
function test(opt) {
Expand Down