-
-
Save caracal7/362cfc12d159a89366d84c8a0db2475b to your computer and use it in GitHub Desktop.
XOR crypt
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
const encrypt = (str, key) => str | |
.split('') | |
.map(s=>(s.charCodeAt()^key).toString(16)) | |
.join('g') | |
; | |
const decrypt = (str, key) => str | |
.split('g') | |
.filter(Boolean) | |
.map(s=> String.fromCharCode(parseInt(s,16)^key) ) | |
.join('') | |
; | |
let text = 'Текст для шифрования with english symbols', | |
key = 889360895; | |
let hash = encrypt(text, key); | |
//350295ddg350295cag350295c5g350295beg350295bdg350291dfg350295cbg350295c4g350295b0g350291dfg350295b7g350295c7g350295bbg350295bfg350295c1g350295cdg350295cfg350295c2g350295c7g350295b0g350291dfg35029188g35029196g3502918bg35029197g350291dfg3502919ag35029191g35029198g35029193g35029196g3502918cg35029197g350291dfg3502918cg35029186g35029192g3502919dg35029190g35029193g3502918c | |
decrypt(hash, key); | |
// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment