Skip to content

Commit

Permalink
Provide more progress indicators during decrypting
Browse files Browse the repository at this point in the history
  • Loading branch information
rualark authored Sep 21, 2024
1 parent 26521d0 commit 985d214
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/recaller.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ async function checkPermutation (permutation, answers, packed, finished) {
updateGroups(groups, answers, permutation)
const groups_str = groupsToString(groups)
const encrypted = packed.split(':')[2]
document.getElementById('secret').value = 'Decrypting...'
try {
const decrypted = await decrypt(groups_str, encrypted)
document.getElementById('scan-progress').textContent = 'Found correct combination'
const hash = await hashSHA256(decrypted)
if (hash === packed.split(':')[3]) {
finished = true
if (decrypted.startsWith('RECALL:')) {
document.getElementById('secret').value = 'Decrypted next RECALL message successfully'
document.getElementById('packed').value = decrypted
unpack()
} else {
Expand All @@ -90,7 +92,7 @@ async function checkPermutation (permutation, answers, packed, finished) {
}
}
} catch (error) {
// continue regardless of error
document.getElementById('secret').value = 'Wrong key, could not decrypt. Try to change your answers.'
}
return finished
}
Expand Down

0 comments on commit 985d214

Please sign in to comment.