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
function xorWithKey(input, key) { | |
let output = ""; | |
for (let i = 0; i < input.length; i++) { | |
let keyChar = String(key[i % key.length]); | |
output += String.fromCharCode(input.charCodeAt(i) ^ keyChar.charCodeAt(0)); | |
} | |
return output; | |
} | |
function customSubstitution(input, substitutionTable) { |
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
function generateRandomSecret(length = 32): string { | |
const haystacks = [ | |
"abcdefghijklmnopqrstuvwxyz", | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", | |
"0123456789", | |
"~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/" | |
]; | |
const randomPart = (haystack: string, length: number)=>{ | |
let retVal = ""; | |
for (let i = 0, n = haystack.length; i < length; ++i) { |