Created
March 17, 2018 20:45
-
-
Save FrankHassanabad/9819b783516e4da2514c506e3ae951d9 to your computer and use it in GitHub Desktop.
Crib phone example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let i = 0; i < encryptedPhoneNumbers.length - 1; ++i) { | |
const encryptedPhoneNum1 = encryptedPhoneNumbers[i]; | |
const encryptedPhoneNum2 = encryptedPhoneNumbers[i + 1]; | |
const xor = xorStrings(encryptedPhoneNum1, encryptedPhoneNum2); | |
const output = xorPlainTextWithCrib(xor, inputPhoneNum); | |
if (asciiMatch(output, '^[0-9]+\-[0-9]+\-[0-9]+$')) { | |
matches = matches.concat([[encryptedPhoneNum1, encryptedPhoneNum2]]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From: https://github.com/FrankHassanabad/nodejs-cribdrag/blob/master/src/examples/phone.ts#L29
For medium article