Skip to content

Commit

Permalink
crypto: use primordial in favor of prototype chain
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 committed Feb 6, 2021
1 parent 1bf86c2 commit a466943
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/internal/crypto/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const {
MathMin,
NumberIsNaN,
NumberIsSafeInteger,
NumberPrototypeToString,
StringPrototypePadStart,
} = primordials;

const {
Expand Down Expand Up @@ -305,7 +307,8 @@ function getHexBytes() {
if (hexBytesCache === undefined) {
hexBytesCache = new Array(256);
for (let i = 0; i < hexBytesCache.length; i++) {
hexBytesCache[i] = i.toString(16).padStart(2, '0');
const hex = NumberPrototypeToString(i, 16);
hexBytesCache[i] = StringPrototypePadStart(hex, 2, '0');
}
}
return hexBytesCache;
Expand Down

0 comments on commit a466943

Please sign in to comment.