Skip to content

Commit

Permalink
fix base32 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
atoponce committed Sep 3, 2021
1 parent 214e542 commit 0f23253
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nodepassgen
Original file line number Diff line number Diff line change
Expand Up @@ -1103,14 +1103,14 @@ function generateSet(b, useEntropy) {

if (b === 32) {
// Add Crockford's modulo 37 checksum
let check = 0n
s += '*~$=u'
let res = 0n
const check = s + '*~$=u'

for (let i = 0; i < pass.length; i++) {
check += BigInt(s.indexOf(pass[i]) * 32 ** (pass.length - i - 1))
res += BigInt(s.indexOf(pass[i]) * 32 ** (pass.length - i - 1))
}

pass += s[check % 37n]
pass += check[res % 37n]
}

assocArr.Generator = 'Random'
Expand Down

0 comments on commit 0f23253

Please sign in to comment.