Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Substitution-cipher/PHP/substitution-cipher.php
Normal file
19
Task/Substitution-cipher/PHP/substitution-cipher.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$key = 'cPYJpjsBlaOEwRbVZIhQnHDWxMXiCtUToLkFrzdAGymKvgNufeSq';
|
||||
|
||||
// Encode input.txt, and save result in output.txt
|
||||
file_put_contents('output.txt', strtr(file_get_contents('input.txt'), $alphabet, $key));
|
||||
|
||||
$source = file_get_contents('input.txt');
|
||||
$encoded = file_get_contents('output.txt');
|
||||
$decoded = strtr($encoded, $key, $alphabet);
|
||||
|
||||
echo
|
||||
'== SOURCE ==', PHP_EOL,
|
||||
$source, PHP_EOL, PHP_EOL,
|
||||
'== ENCODED ==', PHP_EOL,
|
||||
$encoded, PHP_EOL, PHP_EOL,
|
||||
'== DECODED ==', PHP_EOL,
|
||||
$decoded, PHP_EOL, PHP_EOL;
|
||||
Loading…
Add table
Add a link
Reference in a new issue