From ecf8281dc819d7efb242c560c061a789caa3d069 Mon Sep 17 00:00:00 2001 From: chainsafe Date: Thu, 27 Dec 2018 15:23:40 -0500 Subject: [PATCH] adding license headers --- src/bls.js | 22 +++++++++++++++++++--- src/sign.ts | 18 +++++++++++++++++- test/test_bls.js | 16 ++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/bls.js b/src/bls.js index 9430dbd3dd1c..88ca294d3d7b 100644 --- a/src/bls.js +++ b/src/bls.js @@ -1,3 +1,19 @@ + //BLS JS + //Copyright (C) 2018 ChainSafe Systems + + // This program is free software: you can redistribute it and/or modify + // it under the terms of the GNU General Public License as published by + // the Free Software Foundation, either version 3 of the License, or + // (at your option) any later version. + // + // This program is distributed in the hope that it will be useful, + // but WITHOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + // + // You should have received a copy of the GNU General Public License + // along with this program. If not, see . + const CTX = require("../milagro-crypto-js") const ctx = new CTX("BLS381") const rand = require("csprng") @@ -50,7 +66,7 @@ const hash_string = (m) => { return hash.digest() } -// perform H(m) = sha3(m)*G +// perform H(m) = sha3(m)*G // not sure if this is the correct method to hash to curve // returns a point on the curve const hash_to_curve = (m) => { @@ -64,7 +80,7 @@ const bls_sign = (k, m) => { return scalar_mult(hash_to_curve(m), k) } -// perform e(P, H(m)) == e(G, S) where P is our public key, m is our message, S is +// perform e(P, H(m)) == e(G, S) where P is our public key, m is our message, S is // our signature, and G is the generator point const bls_verify = (S, P, m) => { @@ -77,4 +93,4 @@ const bls_aggregate = (S_arr, P_arr, m_arr) => { } -module.exports = {get_rand, gen_key_pair, scalar_mult, scalar_base_mult, add, hash_string, hash_to_curve} \ No newline at end of file +module.exports = {get_rand, gen_key_pair, scalar_mult, scalar_base_mult, add, hash_string, hash_to_curve} diff --git a/src/sign.ts b/src/sign.ts index e47e092cef73..37a30949fa1e 100644 --- a/src/sign.ts +++ b/src/sign.ts @@ -1,3 +1,19 @@ +//BLS JS +//Copyright (C) 2018 ChainSafe Systems + + // This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + class public_key { constructor(k: number) { }; x: number; @@ -20,7 +36,7 @@ class field_element { } class Signature { - keygen():public_key { + keygen():public_key { return new public_key(0); } } diff --git a/test/test_bls.js b/test/test_bls.js index 74ce89a542cf..cdb71022e209 100644 --- a/test/test_bls.js +++ b/test/test_bls.js @@ -1,3 +1,19 @@ +//BLS JS +//Copyright (C) 2018 ChainSafe Systems + + // This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + const bls = require("../src/bls.js") const CTX = require("../milagro-crypto-js") const ctx = new CTX("BLS381")