create Scramble Password
Hi guys this tutorial for how to create Scramble Password using substitution method in php.
Limits
I am showing encrypt only 10 digit alpha or numeric string.
Code(in PHP)
$start_time = microtime(true);
function ScramblePassword($ps){
$val = '';
$code1 = '1234567890aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ';
$code2 = 'r^7eYB0wa(Ac$GCnMqI6ZDS@zEt8OpFg%hHWRi5j3VX1J#kbvKxdyl*L9muNo!4P&sTU2fQ)';
//echo $code2; die;
for ($i = 0; $i < 10; $i++)
{
$i = strlen($ps);
$ps .= " ";
}
//die;
$val = substr($code2,strpos($code1,substr($ps,1,1),0) + 7,1).
substr($code2,strpos($code1,substr($ps,5,1),0) + 10,1).
substr($code2,strpos($code1,substr($ps,2,1),0) + 5,1).
substr($code2,strpos($code1,substr($ps,3,1),0) + 1,1).
substr($code2,strpos($code1,substr($ps,8,1),0) + 8,1).
substr($code2,strpos($code1,substr($ps,7,1),0) + 9,1).
substr($code2,strpos($code1,substr($ps,0,1),0) + 4,1).
substr($code2,strpos($code1,substr($ps,4,1),0) + 3,1).
substr($code2,strpos($code1,substr($ps,9,1),0) + 6,1).
substr($code2,strpos($code1,substr($ps,6,1),0) + 2,1);
return $val;
}
$end_time = microtime(true);
$execution_time = ($end_time - $start_time);
echo " Execution time of script = ".$execution_time." Sec";
echo '
';
echo ScramblePassword($ps = 'testing');
I hope you like it. Video tutorial is a
0 comments