Skip to content

Commit

Permalink
Remove duplicate hashes and add extra hints
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-ion committed Jan 4, 2025
1 parent 7dbaa49 commit 76198b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions trainingportal/qna.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,15 @@ let base64Enc = (mes) => {
let hashEnc = (mes) => {
let words = mes.split(" ");
let hashedWords = [];
let hashes = [];
for(let word of words){
let hash = crypto.createHash('md5').update(word).digest('hex');
hashedWords.push(hash);
if(hashedWords.indexOf(word) === -1){
hashedWords.push(word);
hashes.push(hash);
}
}
return getRes(mes, hashedWords.join("\n"));
return getRes(hashedWords.join(" "), hashes.join("\n"));
}

let xorEnc = (message) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"name":"One-Way Hash",
"description": "crypto_hash.md",
"type":"quiz",
"mission":"Find the text by cracking the digest of each word.",
"mission":"Find the text by cracking the digest of each word. Make sure the words are entered in the same order, separated by spaces.",
"codeBlockIds":[]
},
{
Expand Down

0 comments on commit 76198b4

Please sign in to comment.