Skip to content

Instantly share code, notes, and snippets.

@cliffom
Last active December 15, 2017 18:59
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 cliffom/72860312af64e92fbed84e3d0755babf to your computer and use it in GitHub Desktop.
Save cliffom/72860312af64e92fbed84e3d0755babf to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
$iterations = $argv[1] ? $argv[1] : 1;
$file = "rand.txt";
$dat = file_get_contents($file);
$dat = getHash($dat, $iterations);
echo $dat . "\n";
function getHash($data, $iterations) {
for ($i=0; $i<$iterations-1; $i++) {
$data = hash("sha256", $data, true);
}
return hash("sha256", $data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment