If it is not truly async then sync
This commit is contained in:
parent
3f571c9dd6
commit
e572e9dba8
|
@ -264,7 +264,7 @@ Returns a cryptographically secure random integer between [min,max]
|
||||||
Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||||
|
|
||||||
**Kind**: global function
|
**Kind**: global function
|
||||||
**Returns**: <code>Buffer</code> \| <code>Uint8Array</code> - A Buffer/UInt8Array filled with cryptographically secure random bits
|
**Returns**: <code>Buffer</code> \| <code>Uint8Array</code> - A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bits
|
||||||
|
|
||||||
| Param | Type | Description |
|
| Param | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
@ -277,7 +277,7 @@ Secure random bits for both node and browsers. Node version uses crypto.randomFi
|
||||||
Secure random bytes for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
Secure random bytes for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||||
|
|
||||||
**Kind**: global function
|
**Kind**: global function
|
||||||
**Returns**: <code>Buffer</code> \| <code>Uint8Array</code> - A Buffer/UInt8Array filled with cryptographically secure random bytes
|
**Returns**: <code>Buffer</code> \| <code>Uint8Array</code> - A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bytes
|
||||||
|
|
||||||
| Param | Type | Description |
|
| Param | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
|
|
@ -264,7 +264,7 @@ var bigintCryptoUtils = (function (exports) {
|
||||||
* @param {number} bitLength The desired number of random bits
|
* @param {number} bitLength The desired number of random bits
|
||||||
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bits
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bits
|
||||||
*/
|
*/
|
||||||
function randBits(bitLength, forceLength = false) {
|
function randBits(bitLength, forceLength = false) {
|
||||||
const byteLength = Math.ceil(bitLength / 8);
|
const byteLength = Math.ceil(bitLength / 8);
|
||||||
|
@ -284,7 +284,7 @@ var bigintCryptoUtils = (function (exports) {
|
||||||
* @param {number} byteLength The desired number of random bytes
|
* @param {number} byteLength The desired number of random bytes
|
||||||
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bytes
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bytes
|
||||||
*/
|
*/
|
||||||
function randBytes(byteLength, forceLength = false) {
|
function randBytes(byteLength, forceLength = false) {
|
||||||
let buf;
|
let buf;
|
||||||
|
|
|
@ -261,7 +261,7 @@ function randBetween(max, min = _ONE) {
|
||||||
* @param {number} bitLength The desired number of random bits
|
* @param {number} bitLength The desired number of random bits
|
||||||
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bits
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bits
|
||||||
*/
|
*/
|
||||||
function randBits(bitLength, forceLength = false) {
|
function randBits(bitLength, forceLength = false) {
|
||||||
const byteLength = Math.ceil(bitLength / 8);
|
const byteLength = Math.ceil(bitLength / 8);
|
||||||
|
@ -281,7 +281,7 @@ function randBits(bitLength, forceLength = false) {
|
||||||
* @param {number} byteLength The desired number of random bytes
|
* @param {number} byteLength The desired number of random bytes
|
||||||
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bytes
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bytes
|
||||||
*/
|
*/
|
||||||
function randBytes(byteLength, forceLength = false) {
|
function randBytes(byteLength, forceLength = false) {
|
||||||
let buf;
|
let buf;
|
||||||
|
|
|
@ -279,7 +279,7 @@ function randBetween(max, min = _ONE) {
|
||||||
* @param {number} bitLength The desired number of random bits
|
* @param {number} bitLength The desired number of random bits
|
||||||
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bits
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bits
|
||||||
*/
|
*/
|
||||||
function randBits(bitLength, forceLength = false) {
|
function randBits(bitLength, forceLength = false) {
|
||||||
const byteLength = Math.ceil(bitLength / 8);
|
const byteLength = Math.ceil(bitLength / 8);
|
||||||
|
@ -299,7 +299,7 @@ function randBits(bitLength, forceLength = false) {
|
||||||
* @param {number} byteLength The desired number of random bytes
|
* @param {number} byteLength The desired number of random bytes
|
||||||
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bytes
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bytes
|
||||||
*/
|
*/
|
||||||
function randBytes(byteLength, forceLength = false) {
|
function randBytes(byteLength, forceLength = false) {
|
||||||
let buf;
|
let buf;
|
||||||
|
|
|
@ -303,7 +303,7 @@ export function randBetween(max, min = _ONE) {
|
||||||
* @param {number} bitLength The desired number of random bits
|
* @param {number} bitLength The desired number of random bits
|
||||||
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bits
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bits
|
||||||
*/
|
*/
|
||||||
export function randBits(bitLength, forceLength = false) {
|
export function randBits(bitLength, forceLength = false) {
|
||||||
const byteLength = Math.ceil(bitLength / 8);
|
const byteLength = Math.ceil(bitLength / 8);
|
||||||
|
@ -323,7 +323,7 @@ export function randBits(bitLength, forceLength = false) {
|
||||||
* @param {number} byteLength The desired number of random bytes
|
* @param {number} byteLength The desired number of random bytes
|
||||||
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
* @param {boolean} forceLength If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||||
*
|
*
|
||||||
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array filled with cryptographically secure random bytes
|
* @returns {Buffer|Uint8Array} A Buffer/UInt8Array (Node.js/Browser) filled with cryptographically secure random bytes
|
||||||
*/
|
*/
|
||||||
export function randBytes(byteLength, forceLength = false) {
|
export function randBytes(byteLength, forceLength = false) {
|
||||||
let buf;
|
let buf;
|
||||||
|
|
Loading…
Reference in New Issue