mirror of
https://github.com/KyleBanks/XOREncryption.git
synced 2023-08-10 21:13:15 +03:00
commit
7ce088b67f
16
CoffeeScript/XOREncryption.coffee
Normal file
16
CoffeeScript/XOREncryption.coffee
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
encryptDecrypt = (input) ->
|
||||||
|
key = ['K', 'C', 'Q'] #Can be any chars, and any size array
|
||||||
|
output = ""
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
while i < input.length
|
||||||
|
charCode = input.charCodeAt(i) ^ key[i % key.length].charCodeAt(0)
|
||||||
|
output += String.fromCharCode charCode
|
||||||
|
i++
|
||||||
|
return output
|
||||||
|
|
||||||
|
encrypted = encryptDecrypt "kylewbanks.com"
|
||||||
|
console.log("Encrypted:" + encrypted)
|
||||||
|
|
||||||
|
decrypted = encryptDecrypt encrypted
|
||||||
|
console.log("Decrypted:" + decrypted)
|
@ -12,6 +12,7 @@ Simple implementation of XOR Encryption/Decrypting in various languages, includi
|
|||||||
- [Groovy](Groovy/XOREncryption.groovy)
|
- [Groovy](Groovy/XOREncryption.groovy)
|
||||||
- [Java \(Android Compatible\)](Java%20\(Android%20compatible\)/XOREncryption.java)
|
- [Java \(Android Compatible\)](Java%20\(Android%20compatible\)/XOREncryption.java)
|
||||||
- [JavaScript \(Node.js Compatible\)](JavaScript/XOREncryption.js)
|
- [JavaScript \(Node.js Compatible\)](JavaScript/XOREncryption.js)
|
||||||
|
- [CoffeeScript](CoffeeScript/XOREncryption.coffee)
|
||||||
- [Kotlin](Kotlin/XOREncryption.kt)
|
- [Kotlin](Kotlin/XOREncryption.kt)
|
||||||
- [Objective-C](Objective-C/main.m)
|
- [Objective-C](Objective-C/main.m)
|
||||||
- [PHP](PHP/XOREncryption.php)
|
- [PHP](PHP/XOREncryption.php)
|
||||||
|
Loading…
Reference in New Issue
Block a user