Security – get SHA1 key on Windows PC

This is step by step instruction to get SHA1 key.

1. Make sure that you installed JDK(Java Development Kit). If you have not installed yet, you can download it here and install it.
2. Open command line: Win+R->type “cmd”->click OK button. Navigate to JDK bin folder. In my case it is on “C:\Program Files\Java\jdk1.8.0_91\bin”. May have installed in another place or have another version. Navigate to bin folder – type on command line:

cd C:\Program Files\Java\jdk1.8.0_91\bin

3. After navigating, type this to create SHA1 key:

keytool -exportcert -alias androiddebugkey -keystore %USERPROFILE%/.android/debug.keystore -list -v

4. Now you can see SHA1 key! Good luck

Facebook CTF solution: capture_Uzbekistan

Пароли с клавиатуры
Нам известно, какие клавиши нажимал пользователь, а также известен md5-хэш от пароля. Пожалуйста, узнайте пароль.
Hash: d377e0079ee9e94fc69336a01630b041


English translation:
Password from keyboard
We know what button was clicked. Also, we know md5 hash for password. Please, find a password.
Hash: d377e0079ee9e94fc69336a01630b041


public class HashTask {

    public static void main(String[] args) {

        String keys = "49uodgm";//this letters are used in password
        String hash = "d377e0079ee9e94fc69336a01630b041";//md5 for that password
        int max_length = 10;//find combination till this length

        // password length minimum - keys length
        for (int l = keys.length(); l < max_length; l++) {
            String number_format = "%0" + l + "d";//we will use numbers to find combination
            boolean doBreak = false;//this is used to break for loop
            // interate all numbers withing length
            for (int i = 0; i < ((int) Math.pow(10, l)); i++) {

                // add leading zeros if needed for example 123->0000123
                String num = String.format(number_format, i);

                boolean doContinue = false;
                // exclude all numbers which contains not appropriate digits
                // for example for length - 7, not appropriate numbers are 8, 9
                for (int j = keys.length(); j < 10; j++) {
                    if (num.contains(String.valueOf(j))) {
                        doContinue = true;
                if (doContinue) continue;//go to next number
                // let's create password combination
                StringBuilder sb = new StringBuilder();
                for(char c: num.toCharArray()){
                    int pos = Integer.parseInt(String.valueOf(c));
                String combination = sb.toString();
                // let's make sure that combination contains all letters user entered
                for(char c: keys.toCharArray()){
                        doContinue = true;
                if(doContinue) continue;//if some of letters miss, exclude this number
                // check for combination md5 equality
                String md5 = MD5.md5(combination);
                    doBreak = true;
            if(doBreak) break;// if found stop for loop




public class MD5 {
    public static void main(String[] args) {

    // method 1
    public static String md5(String password){

        byte[] bytes = getBytes(password);

        // convert the byte to hex format method 1
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < bytes.length; i++) {
            sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
        return sb.toString();

    private static byte[] getBytes(String password) {
        MessageDigest md = null;
        try {
            md = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            // TODO Auto-generated catch block
        byte byteData[] = md.digest();
        return byteData;
    // method 2
        public static String md5b(String password){
            byte[] bytes = getBytes(password);

            StringBuffer hexString = new StringBuffer();
            for (int i = 0; i < bytes.length; i++) {
                String hex = Integer.toHexString(0xff & bytes[i]);
                if (hex.length() == 1)

            return hexString.toString();


Answer: god94mug