UNPKG

tweetnacl-ts

Version:

Port of TweetNaCl cryptographic library to TypeScript (and ES6)

11 lines (9 loc) 244 B
import { randomBytes } from 'crypto'; import { ByteArray } from '../array'; export function _randomBytes(x: ByteArray, n: number) { const v = randomBytes(n); for (let i = 0; i < n; i++) { x[i] = v[i]; v[i] = 0; } }