Skip to content

Instantly share code, notes, and snippets.

@avraampiperidis
Created June 18, 2013 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avraampiperidis/5808773 to your computer and use it in GitHub Desktop.
Save avraampiperidis/5808773 to your computer and use it in GitHub Desktop.
php encrypt script based on string time character replace .runs on cli
<?php
/*
this is a simple encrypt script based on string character replace,
it also replace some characters based on seconds from time date('U') command,
so the output will be almost different every time the program runs
And its working only from command line interface
*/
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); //disabled error reporting
echo ' |--------welcome to Protectsoft---------|-->'.exec('whoami')."\n";
fwrite(STDOUT, "enter your keyword: ");
$passwd = trim(fgets(STDIN));
$unix = date('U');
if ($unix[9] == 0) {
$unix[9] = 2;
}
$replace = array( //basic replace array table
'b' => '|.',
'c' => 'v',
'f' => 'g',
'g' => 'h',
'j' => 'k',
'k' => '|<',
'l' => 'a',
'm' => 'z',
'p' => 'q',
'q' => 'w',
'r' => 't',
's' => 'd',
'v' => 'b',
'w' => '|v|',
'x' => 'c',
'y' => 'u',
'z' => 'x',
'1' => 'l',
'2' => 'z',
'3' => '3',
'4' => '@',
'5' => '$',
'6' => 'G',
'7' => 't',
'8' => 'b',
'9' => 'g',
'/' => '|',
);
$letters = array( //replace array table based on seconds 1 to 9
'1' => 'a',
'2' => 'D',
'3' => 'e',
'4' => 'h',
'5' => 'i',
'6' => 'n',
'7' => 'o',
'8' => 't',
'9' => 'u',
);
$passwd = str_replace(array_keys($replace),array_values($replace),$passwd);
$out = $passwd[0].($unix[9] * 2).$passwd[1].$unix[1].$passwd[2].($unix[9] * 3).$passwd[3].$unix[3].$passwd[4].($unix[9] * 2).$passwd[5].$unix[5].$passwd[6].($unix[9] * 2).$passwd[7].$passwd[8]; //the output. Maybe it will be better without the unix[9] * number.just did this for the output to have some random numbers in
for ($num = 1, $max = 9; $num < $max; $num++)
if ($unix[9] == $num) {
$out[$num] = $letters[$num + 1];
}
fwrite(STDOUT, "this is your encrypted keyword: $out \n");
echo ' |------------Protectsoft-Protectron------------|', "\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment