Skip to content

Instantly share code, notes, and snippets.

@benlorenz
Last active October 2, 2021 19:18
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save benlorenz/ad403df4f974eb39ed6fda474b267790 to your computer and use it in GitHub Desktop.
Save benlorenz/ad403df4f974eb39ed6fda474b267790 to your computer and use it in GitHub Desktop.
FP3 oem unlock verify code?
#!/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);
@rugk
Copy link

rugk commented Feb 10, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment