Created
July 9, 2017 01:40
-
-
Save robin-raymond/4498d593a586c3e6006d35a722bcc934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run here: | |
http://sandbox.onlinephpfunctions.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Enter your code here, enjoy! | |
function getGUID(){ | |
if (function_exists('com_create_guid')){ | |
return com_create_guid(); | |
}else{ | |
mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up. | |
$charid = strtoupper(md5(uniqid(rand(), true))); | |
$hyphen = chr(45);// "-" | |
$uuid = chr(123)// "{" | |
.substr($charid, 0, 8).$hyphen | |
.substr($charid, 8, 4).$hyphen | |
.substr($charid,12, 4).$hyphen | |
.substr($charid,16, 4).$hyphen | |
.substr($charid,20,12) | |
.chr(125);// "}" | |
return $uuid; | |
} | |
} | |
function stripGUID() | |
{ | |
$temp = getGUID(); | |
$temp = str_replace("{","", "$temp"); | |
$temp = str_replace("}","", "$temp"); | |
$temp = str_replace("-","", "$temp"); | |
$temp = strtolower($temp); | |
return $temp; | |
} | |
function myhash($input) | |
{ | |
$input = $input . ":magic-string"; | |
$result = sha1($input); | |
return $result; | |
} | |
for ($x = 0; $x <= 200000; $x++) { | |
$value = stripGUID(); | |
$hashed = substr(myhash($value), 0, 5); | |
if (0 == strcmp($hashed, "8102d")) { | |
echo "$value $hashed\n"; | |
echo "FOUND!\n"; | |
} | |
} | |
echo "DONE!\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment