UNPKG

@stellot/crypto

Version:

Crypto libraries for front and backend

20 lines (19 loc) 541 B
import { BigInteger as BigInt } from 'jsbn'; export default class DecryptedValue { constructor(m) { switch (typeof m) { case 'number': this.bi = new BigInt(`${m}`); break; case 'bigint': this.bi = new BigInt(m.toString()); break; case 'object': default: this.bi = new BigInt(m.toString('hex'), 16); } } toString() { return new Buffer(this.bi.toByteArray()).toString(); } }