Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
refactor(RNG): use length rather than byteLength
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Mar 17, 2016
1 parent 83403b8 commit 5f54f55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/rng.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ RNG.prototype.run = function (nBytes) {
var localH = randomBytes(nBytes);

assert(
localH.byteLength > 0 || localH.length > 0,
localH.length > 0,
'Local entropy should not be empty.'
);
assert(
serverH.byteLength > 0 || serverH.length > 0,
serverH.length > 0,
'Server entropy should not be empty.'
);

Expand All @@ -58,7 +58,7 @@ RNG.prototype.run = function (nBytes) {
'The browser entropy should not be the same byte repeated.'
);
assert(
serverH.byteLength === localH.byteLength || serverH.length === localH.length,
serverH.length === localH.length,
'Both entropies should be same of the length.'
);

Expand All @@ -69,7 +69,7 @@ RNG.prototype.run = function (nBytes) {
'The combined entropy should not be the same byte repeated.'
);
assert(
combinedH.byteLength === nBytes || combinedH.length === nBytes,
combinedH.length === nBytes,
'Combined entropy should be of requested length.'
);

Expand Down Expand Up @@ -107,7 +107,7 @@ RNG.prototype.getServerEntropy = function (nBytes) {
var B = new Buffer(request.responseText, this.FORMAT);

assert(
B.byteLength === nBytes || B.length === nBytes,
B.length === nBytes,
'Different entropy length requested.'
);

Expand Down

0 comments on commit 5f54f55

Please sign in to comment.