Last active
September 11, 2015 16:02
-
-
Save andersevenrud/c14961df1c5a63b952e6 to your computer and use it in GitHub Desktop.
win7 product key decoder
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 | |
$str = <<<EOTXT | |
SUPER SECRET STUFF HERE | |
EOTXT; | |
$bin = Array(); | |
$hex = Array(); | |
$tmp = explode("\n", $str); | |
foreach ( $tmp as $s ) { | |
if ( $s = trim($s) ) { | |
$foo = explode(" ", $s); | |
for ( $i = 3; $i < 20; $i++ ) { | |
if ( $foo[$i] != "-" ) { | |
$hex[] = $foo[$i]; | |
$bin[] = (int) hexdec($foo[$i]); | |
} | |
} | |
} | |
} | |
var_dump(implode("", $hex)); | |
$keyOffset = 52; | |
$i = 28; | |
$chars = "BCDFGHJKMPQRTVWXY2346789"; | |
$kout = ""; | |
do { | |
$cur = 0; | |
$x = 14; | |
do { | |
$tmp = $x + $keyOffset; | |
$cur = $cur * 256; | |
$cur = $bin[$tmp] + $cur; | |
$bin[$tmp] = ($cur / 24) & 255; | |
$cur = $cur % 24; | |
$x--; | |
} while ( $x >= 0 ); | |
$i--; | |
$tmp = substr($chars, $cur, 1); | |
$kout = "{$tmp}{$kout}"; | |
if ( ((29 - $i) % 6 == 0) && ($i != -1) ) { | |
$i--; | |
$kout = "-{$kout}"; | |
} | |
} while ( $i >= 0 ); | |
var_dump($kout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment