0

I use Java 1.8 version and OpenSSL 1.0.2f.

But when I generate a hash key it will not match with Facebook hash key.

I regenerate an Android debug key manually and through Eclipse but no effect. My Google+ API is also not working.

I am using a MAC system.

theringostarrs
  • 11,940
  • 14
  • 50
  • 63
ABIRAMAN
  • 929
  • 8
  • 12
  • try using my tool here : http://stackoverflow.com/questions/4388992/key-hash-for-android-facebook-app/17732453#17732453 – Shahar Feb 13 '16 at 05:58
  • I already tried Your tool but no effect. Your tool and command promte generate same key but my android debug.apk is some thing deferent . Your tool grenerates (C4Xr**********Oy9nYMef9IpPg= ) debug.apk (PjSK/**********6jGZ8ijlAH+4=) – ABIRAMAN Feb 15 '16 at 05:03

1 Answers1

0

Try running the following code in your Activity's onCreate()

try {
    PackageInfo info = getPackageManager().getPackageInfo(
                           getPackageName(),
                           PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
    }
}
catch (NameNotFoundException e) {

}
catch (NoSuchAlgorithmException e) {

}

see if that gives you anything like my tool gives.

note that you should run the tool on the debug.keystore file, the same one that Android studio uses.

if it does, than it's the right one.

Shahar
  • 3,692
  • 4
  • 25
  • 47