-
-
Save benlorenz/ad403df4f974eb39ed6fda474b267790 to your computer and use it in GitHub Desktop.
FP3 oem unlock verify code?
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Getopt::Long; | |
use List::Util qw(sum); | |
use Digest::MD5 qw(md5_hex); | |
sub help { | |
return <<"." | |
Usage: perl $0 --imei 123456789012345 --serial A1234567890 | |
. | |
} | |
my ($imei, $serial); | |
GetOptions ("imei=s" => \$imei, | |
"serial=s" => \$serial) | |
or die(help()); | |
if (!defined($imei) || length($imei) != 15 || | |
!defined($serial) || length($serial) < 10) { | |
print help(); | |
exit; | |
} | |
# the key | |
my $key = "$imei$serial"; | |
my $md5 = md5_hex($key); | |
print "md5: $md5\n"; | |
# weird checksum over the first 8 characters in the md5sum... | |
my $chk = 0; | |
for (my $i = 0; $i < 8; $i++) { | |
$chk += ord(substr($md5,$i,1)) * 256**($i%4); | |
} | |
$chk &= 0xFFFFFFFF; | |
printf("code: %08x\n", $chk); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PHP implementation: https://gist.github.com/z3ntu/9c09120bb44c6dd9fe163931a1478ea9