utils.nonce.
This commit is contained in:
parent
56445cf562
commit
e74b163b9e
@ -1285,14 +1285,15 @@ utils.U32 = new bn(0xffffffff);
|
||||
utils.U64 = new bn('ffffffffffffffff', 'hex');
|
||||
|
||||
/**
|
||||
* Create a 64 bit nonce.
|
||||
* Create an 8 byte nonce.
|
||||
* @returns {BN}
|
||||
*/
|
||||
|
||||
utils.nonce = function nonce() {
|
||||
var nonce = utils.U64.clone();
|
||||
nonce.imuln(Math.random());
|
||||
return nonce;
|
||||
utils.nonce = function _nonce() {
|
||||
var nonce = new Buffer(8);
|
||||
utils.writeU32(nonce, Math.random() * 0x100000000 | 0, 0);
|
||||
utils.writeU32(nonce, Math.random() * 0x100000000 | 0, 4);
|
||||
return new bn(nonce);
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
Loading…
Reference in New Issue
Block a user