@stellot/crypto
Version:
Crypto libraries for front and backend
32 lines (31 loc) • 936 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const jsbn_1 = require("jsbn");
class EncryptedValue {
constructor(a, b) {
switch (typeof a) {
case 'string':
this.a = new jsbn_1.BigInteger(a, 16);
break;
case 'number':
this.a = new jsbn_1.BigInteger(`${a}`);
break;
default:
this.a = a;
}
switch (typeof b) {
case 'string':
this.b = new jsbn_1.BigInteger(b, 16);
break;
case 'number':
this.b = new jsbn_1.BigInteger(`${b}`);
break;
default:
this.b = b;
}
}
multiply(encryptedValue) {
return new EncryptedValue(this.a.multiply(encryptedValue.a), this.b.multiply(encryptedValue.b));
}
}
exports.default = EncryptedValue;