UNPKG

tweetnacl-ts

Version:

Port of TweetNaCl cryptographic library to TypeScript (and ES6)

12 lines 425 B
"use strict"; // Initialize PRNG if environment provides CSPRNG. // If not, methods calling randombytes will throw. Object.defineProperty(exports, "__esModule", { value: true }); var QUOTE = 1 << 16; function _randomBytes(x, n) { for (var i = 0; i < n; i += QUOTE) { crypto.getRandomValues(x.subarray(i, i + Math.min(n - i, QUOTE))); } } exports._randomBytes = _randomBytes; //# sourceMappingURL=random.js.map