mirror of
https://github.com/KyleBanks/XOREncryption.git
synced 2023-08-10 21:13:15 +03:00
Merge pull request #15 from AlbinoDrought/master
Add PHP Implementation
This commit is contained in:
commit
cfcfb0838c
18
PHP/XOREncryption.php
Normal file
18
PHP/XOREncryption.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function encryptDecrypt($input) {
|
||||||
|
$key = ['K', 'C', 'Q']; //Can be any chars, and any size array
|
||||||
|
$output = '';
|
||||||
|
|
||||||
|
for ($i = 0; $i < strlen($input); $i++) {
|
||||||
|
$output .= $input[$i] ^ $key[$i % count($key)];
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
$encrypted = encryptDecrypt('kylewbanks.com');
|
||||||
|
echo "Encrypted:" . $encrypted . "\n";
|
||||||
|
|
||||||
|
$decrypted = encryptDecrypt($encrypted);
|
||||||
|
echo "Decrypted:" . $decrypted . "\n";
|
||||||
|
|
@ -14,6 +14,7 @@ Simple implementation of XOR Encryption/Decrypting in various languages, includi
|
|||||||
- [JavaScript \(Node.js Compatible\)](JavaScript/XOREncryption.js)
|
- [JavaScript \(Node.js Compatible\)](JavaScript/XOREncryption.js)
|
||||||
- [Kotlin](Kotlin/XOREncryption.kt)
|
- [Kotlin](Kotlin/XOREncryption.kt)
|
||||||
- [Objective-C](Objective-C/main.m)
|
- [Objective-C](Objective-C/main.m)
|
||||||
|
- [PHP](PHP/XOREncryption.php)
|
||||||
- [Python](Python/XOREncryption.py)
|
- [Python](Python/XOREncryption.py)
|
||||||
- [Ruby](Ruby/xor.rb)
|
- [Ruby](Ruby/xor.rb)
|
||||||
- [Swift](Swift/XOREncryption.swift)
|
- [Swift](Swift/XOREncryption.swift)
|
||||||
|
Loading…
Reference in New Issue
Block a user