|
|
@ -308,6 +308,11 @@ |
|
|
|
she.SecretKey.prototype.dump = function(msg = 'sec ') { |
|
|
|
she.SecretKey.prototype.dump = function(msg = 'sec ') { |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
she.getSecretKeyFromHexStr = function(s) { |
|
|
|
|
|
|
|
r = new she.SecretKey() |
|
|
|
|
|
|
|
r.fromHexStr(s) |
|
|
|
|
|
|
|
return r |
|
|
|
|
|
|
|
} |
|
|
|
she.PublicKey = function() { |
|
|
|
she.PublicKey = function() { |
|
|
|
this.a_ = new Uint32Array(SHE_PUBLICKEY_SIZE / 4) |
|
|
|
this.a_ = new Uint32Array(SHE_PUBLICKEY_SIZE / 4) |
|
|
|
} |
|
|
|
} |
|
|
@ -326,6 +331,11 @@ |
|
|
|
she.PublicKey.prototype.dump = function(msg = 'pub ') { |
|
|
|
she.PublicKey.prototype.dump = function(msg = 'pub ') { |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
she.getPublicKeyFromHexStr = function(s) { |
|
|
|
|
|
|
|
r = new she.PublicKey() |
|
|
|
|
|
|
|
r.fromHexStr(s) |
|
|
|
|
|
|
|
return r |
|
|
|
|
|
|
|
} |
|
|
|
she.CipherTextG1 = function() { |
|
|
|
she.CipherTextG1 = function() { |
|
|
|
this.a_ = new Uint32Array(SHE_CIPHERTEXT_G1_SIZE / 4) |
|
|
|
this.a_ = new Uint32Array(SHE_CIPHERTEXT_G1_SIZE / 4) |
|
|
|
} |
|
|
|
} |
|
|
@ -344,6 +354,11 @@ |
|
|
|
she.CipherTextG1.prototype.dump = function(msg = 'ct1 ') { |
|
|
|
she.CipherTextG1.prototype.dump = function(msg = 'ct1 ') { |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
she.getCipherTextG1FromHexStr = function(s) { |
|
|
|
|
|
|
|
r = new she.CipherTextG1() |
|
|
|
|
|
|
|
r.fromHexStr(s) |
|
|
|
|
|
|
|
return r |
|
|
|
|
|
|
|
} |
|
|
|
she.CipherTextG2 = function() { |
|
|
|
she.CipherTextG2 = function() { |
|
|
|
this.a_ = new Uint32Array(SHE_CIPHERTEXT_G2_SIZE / 4) |
|
|
|
this.a_ = new Uint32Array(SHE_CIPHERTEXT_G2_SIZE / 4) |
|
|
|
} |
|
|
|
} |
|
|
@ -362,6 +377,11 @@ |
|
|
|
she.CipherTextG2.prototype.dump = function(msg = 'ct2 ') { |
|
|
|
she.CipherTextG2.prototype.dump = function(msg = 'ct2 ') { |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
she.getCipherTextG2FromHexStr = function(s) { |
|
|
|
|
|
|
|
r = new she.CipherTextG2() |
|
|
|
|
|
|
|
r.fromHexStr(s) |
|
|
|
|
|
|
|
return r |
|
|
|
|
|
|
|
} |
|
|
|
she.CipherTextGT = function() { |
|
|
|
she.CipherTextGT = function() { |
|
|
|
this.a_ = new Uint32Array(SHE_CIPHERTEXT_GT_SIZE / 4) |
|
|
|
this.a_ = new Uint32Array(SHE_CIPHERTEXT_GT_SIZE / 4) |
|
|
|
} |
|
|
|
} |
|
|
@ -380,6 +400,11 @@ |
|
|
|
she.CipherTextGT.prototype.dump = function(msg = 'ctt ') { |
|
|
|
she.CipherTextGT.prototype.dump = function(msg = 'ctt ') { |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
console.log(msg + this.toHexStr()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
she.getCipherTextGTFromHexStr = function(s) { |
|
|
|
|
|
|
|
r = new she.CipherTextGT() |
|
|
|
|
|
|
|
r.fromHexStr(s) |
|
|
|
|
|
|
|
return r |
|
|
|
|
|
|
|
} |
|
|
|
she.SecretKey.prototype.setByCSPRNG = function() { |
|
|
|
she.SecretKey.prototype.setByCSPRNG = function() { |
|
|
|
let stack = mod.Runtime.stackSave() |
|
|
|
let stack = mod.Runtime.stackSave() |
|
|
|
let secPos = mod.Runtime.stackAlloc(this.a_.length * 4) |
|
|
|
let secPos = mod.Runtime.stackAlloc(this.a_.length * 4) |
|
|
|