Skip to content

Instantly share code, notes, and snippets.

@JasonRaveling
Last active January 19, 2016 02:13
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 JasonRaveling/db473693fd6fee2f65d0 to your computer and use it in GitHub Desktop.
Save JasonRaveling/db473693fd6fee2f65d0 to your computer and use it in GitHub Desktop.
Decrypt TWRP Recovery on Encrypted Android
// past this into a file name Pattern.java
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
public class Pattern {
public static void main(String... args) {
int[] pattern = {DOT_NUMBERS_HERE};
byte[] res = new byte[pattern.length];
for( int i = 0; i < pattern.length; i++ ) {
res[i] = (byte) (pattern[i]);
}
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < res.length; i++) {
if ((0xff & res[i]) < 0x10) {
hexString.append("0" + Integer.toHexString((0xFF & res[i])));
} else {
hexString.append(Integer.toHexString(0xFF & res[i]));
}
}
System.out.print("unlock code: ");
System.out.println(hexString);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment