Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active October 20, 2020 14:49
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 lbvf50mobile/e3276105653d673ae75cdd9ffedfa530 to your computer and use it in GitHub Desktop.
Save lbvf50mobile/e3276105653d673ae75cdd9ffedfa530 to your computer and use it in GitHub Desktop.
Just PHP FUN 133.
<?php
# https://www.codewars.com/kata/5efae11e2d12df00331f91a6 Crack the PIN.
//Don't echo anything, will take to much time
function crack($hash){
for($i = 0; $i <= 99999; $i += 1){
$x = md5(str_pad($i, 5, "0", STR_PAD_LEFT));
if($x == $hash) return str_pad($i, 5, "0", STR_PAD_LEFT);
}
throw new Exception('Full iteration and no result.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment