How to use the curve function from elliptic

Find comprehensive JavaScript elliptic.curve code examples handpicked from public code repositorys.

20
21
22
23
24
25
26
27
28
29
    c: "1",
    g: ["2ef3f9b423a2c8c74e9803958f6c320e854a1c1c06cd5cc8fd221dc052d76df7",
        "05a01167ea785d3f784224644a68e4067532c815f5f6d57d984b5c0e9c6c94b7"]
}

const altBabyJubjub = new elliptic.curve.edwards(babyJubjubParams);

function sign(message, privateKey, curve) {
    const r = (new BN(elliptic.rand(32), 16, "be")).umod(curve.n);
    // const r = new BN(3);
fork icon14
star icon90
watch icon7

38
39
40
41
42
43
44
45
46
47
48
49


// AltBn128 Object
const bn128 = {}


// ECC Curve
bn128.curve = new EC.curve.short({
  a: '0',
  b: '3',
  p: P,
  n: N,
fork icon0
star icon3
watch icon1

7
8
9
10
11
12
13
14
15
16
17
const GROUP_MODULUS = new BN(
  "30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001",
  16
);


const curve = new EC.curve.short({
  a: "0",
  b: "3",
  p: FIELD_MODULUS,
  n: GROUP_MODULUS,
fork icon0
star icon1
watch icon0

7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660


var assert = elliptic.utils.assert;


function PresetCurve(options) {
  if (options.type === 'short')
    this.curve = new elliptic.curve.short(options);
  else if (options.type === 'edwards')
    this.curve = new elliptic.curve.edwards(options);
  else
    this.curve = new elliptic.curve.mont(options);
fork icon0
star icon0
watch icon1

+ 11 other calls in file