Skip to content

Instantly share code, notes, and snippets.

@phnessu4
Created June 6, 2013 08:51
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 phnessu4/5720219 to your computer and use it in GitHub Desktop.
Save phnessu4/5720219 to your computer and use it in GitHub Desktop.
Export Caesar Hash
<?php
//Export Caesar Hash
$hash = array_flip(array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'));
$hash_length = count($hash);
$arr = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
foreach ($hash as $key => $value) {
$arr_index = rand(0, count($arr)-1);
$hash[$key] = $arr[$arr_index];
unset($arr[$arr_index]);
sort($arr);
// print_r("hash key: ".$key." ,arr length: ".count($arr)." ,arr index: ".$arr_index." ,arr value : ". $arr[$arr_index]);
// print_r($arr);
}
print_r($hash);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment