Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "mcl-wasm", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "mcl ; A generic and fast pairing-based cryptography library for Node.js by WebAssembly", | ||
@@ -5,0 +5,0 @@ "main": "mcl.js", |
25
test.js
@@ -10,2 +10,3 @@ const mcl = require('./mcl.js') | ||
GTTest() | ||
serializeTest() | ||
IDbasedEncryptionTest() | ||
@@ -229,2 +230,26 @@ PairingTest() | ||
function serializeSubTest(Cstr, x, newDeserializeHexStr) { | ||
const y = new Cstr() | ||
y.deserialize(x.serialize()) | ||
assert(y.isEqual(x)) | ||
y.clear() | ||
const s = x.serializeToHexStr() | ||
y.deserializeHexStr(s) | ||
assert(y.isEqual(x)) | ||
const z = newDeserializeHexStr(s) | ||
assert(z.isEqual(x)) | ||
} | ||
function serializeTest() { | ||
const a = new mcl.Fr() | ||
a.setStr('12345678') | ||
serializeSubTest(mcl.Fr, a, mcl.deserializeHexStrToFr) | ||
const P = mcl.hashAndMapToG1('abc') | ||
serializeSubTest(mcl.G1, P, mcl.deserializeHexStrToG1) | ||
const Q = mcl.hashAndMapToG2('abc') | ||
serializeSubTest(mcl.G2, Q, mcl.deserializeHexStrToG2) | ||
const e = mcl.pairing(P, Q) | ||
serializeSubTest(mcl.GT, e, mcl.deserializeHexStrToGT) | ||
} | ||
function bench(label, count, func) { | ||
@@ -231,0 +256,0 @@ const start = Date.now() |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
685766
1488