2

I am trying to get hash key for facebook (Native Android App) login using following command

C:\Program Files\Java\jre6\bin>keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Combitech\.android\debug.keystore"

I have entered password "android" but instead of hash key i got some output like follow

☺☺♂♣ 071♂0      ♠♥U♦♠‼☻US1►0♫♠♥U♦
431004061248Z071♂0      ♠♥U♦♠‼☻US1►0♫♠♥U♦
☺☺☺♣ ♥é☺☼ 0é☺0é☺"0
☺☺♂♣ ♥é☺☺ I$F╠≥C½?k½~U▬éïP▄ûπ^?╢Äïï▲D╓♣╥h☺⌡═Æ╠■≥        ,♦Wm#≥W▓♦↓┴1¡┼╩ú♀⌠,-62º ═V¶■‼   ûªE¢⌂φg╢çpSúuαΩ√:ôp∩<û╕úxj↓╠G♠=↔x ╥s0²↓¬}é←êR╜s╜↓■6║/6HεC≥Éq1J═α┐3í2PU╓i-←ë¿Φαπ°Åφε÷àX░R‼   ☺Lje      -w╘²L▲♣╧♦'7←âDτ╜
╤Ω▲£6uü░K■o↕ö§q┼6▌⌂(≡}º3EC┴bo>√ßS─▌a«¼╡τ▐ïñºñ¢._w]¥±▒0'σ√»?oÄ╙⌠X»C█2â1)√7zod

Any one have any idea how to solve this issue.

InnocentKiller
  • 5,234
  • 7
  • 36
  • 84

5 Answers5

1

To show the SHA1 hash (you need for Google APIs) and all other hashes use this command instead:

keytool -list -v -keystore "C:\Users\Combitech\.android\debug.keystore"
Simulant
  • 19,190
  • 8
  • 63
  • 98
  • for anyone on a Mac the path to the Android debug keystore is ~/.android/debug.keystore – Steji Mar 06 '17 at 10:55
1

The command you are looking for may be:

"C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe" -exportcert -alias androiddebugkey -keystore "C:\Users\Combitech\.android\debug.keystore" | C:\OpenSSL-Win32\bin\openssl sha1 -binary | C:\OpenSSL-Win32\bin\openssl base64

Tips:

  • Better use full path of keytool.exe location and also full path of openssl.
  • Do not forget to change the keystore path with your path "C:\Users\Combitech\.android\debug.keystore"

More info here

Community
  • 1
  • 1
madlymad
  • 6,367
  • 6
  • 37
  • 68
0

You can get both MD5 fingerprint and SHA1 fingerprint from your eclipse itself. Try this :

Windows > Preferences > Android > Build

Note that there will be two different keys one will be default and another for your custom keystore used for app development.

Shashank
  • 90
  • 1
  • 10
0

Try out as below. And also make sure you debug keystore file is correct.

You should add '-v' to your keytool command. A -v to your command will get fingerprints in MD5, SHA1 and SHA256.

 keytool -list -v -keystore C:\Users\Combitech\.android\debug.keystore

You don't need to add the double quotes on the debug.keystore file path.

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
0

try this code.It will return hash key in your log cat. and dont forget to change the package name

try {
            PackageInfo info = context.getPackageManager().getPackageInfo(
                    "com.example.package", PackageManager.GET_SIGNATURES); //Your package name here
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.v("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
                }
        } catch (NameNotFoundException e) {
        } catch (NoSuchAlgorithmException e) {
        }
Suhail Mehta
  • 5,514
  • 2
  • 23
  • 37