-
-
Save z3ntu/9c09120bb44c6dd9fe163931a1478ea9 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>FP3 'verify code' generator</title> | |
</head> | |
<body> | |
<h2>FP3 'verify code' generator</h2> | |
<p>A big thanks to <a href="https://forum.fairphone.com/t/oem-unlock-input-verify-code/56231/11?u=z3ntu" target="_blank">_tmp in the Fairphone Forum</a> for the code behind this site!</p> | |
<p>Enter the IMEI (slot 1) and serial number values from your phone and press submit.</p> | |
<p>You can find those numbers under "About phone" - "Model & hardware" in the Settings app.</p> | |
<form method="post"> | |
IMEI1:<br> | |
<input type="text" name="imei"><br> | |
Serial:<br> | |
<input type="text" name="serial"><br> | |
<input type="submit" value="Submit"> | |
</form> | |
<?php | |
if (isset($_POST["imei"]) && isset($_POST["serial"])) { | |
$imei = $_POST["imei"]; | |
$serial = $_POST["serial"]; | |
if(strlen($imei) != 15 || strlen($serial) < 10) { | |
print("<h3>IMEI must be 15 characters and serial must be longer than 10 characters.</h3>"); | |
return; | |
} | |
$key = $imei . $serial; | |
$md5 = md5($key); | |
$chk = 0; | |
for ($i = 0; $i < 8; $i++) { | |
$chk += ord(substr($md5,$i,1)) * 256**($i%4); | |
} | |
$chk &= 0xFFFFFFFF; | |
print("<h3>Code: " . dechex($chk) . "</h3>"); | |
} | |
?> | |
</body> | |
</html> |
I wrote that in the forum comment as well
And now thinking about this, it would have probably been nicer to implement it as client-side JavaScript. Oh well.
If you translate this "algorithm" into JavaScript, I can definitely put it up on my website but honestly I have better things to do 😉
I don't, so… 😜
Here we go:
https://gist.github.com/rugk/0ab18cc0f43d823c6464b790d8c77d3d
Actually, as all that code in a gist is bad, here we have some repos:
- GitHub (live version)
- GitLab (live version)
- or the live version on Neocities (updated manually)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe this can be re-implemented in JS instead of PHP, so one does not need to send that data over the wire and everything happens locally?