How to generate Key Hash for facebook?

I am trying to generate Key Hash for my Unity game.For that i am using below command but it is showing result as the image shown. Even i enter any password or not, its not working. Now what should i do to get key hash?
The commad is:
keytool -exportcert -alias androiddebugkey -keystore “C:\Users\8000402143.android\debug.keystore” | “C:\OpenSSL\bin\openssl” sha1 -binary | “C:\OpenSSL\bin\openssl” base32

4 Answers

4

Following are 2 solutions which worked for me.You can try any of them.

Solution 1:

In order to generate key hash you need to follow some easy steps.

  1. Download Openssl from:

Google Code Archive - Long-term storage for Google Code Project Hosting.

  1. Make a openssl folder in C drive

  2. Extract Zip files into this openssl folder created in C Drive.

  3. Copy the File debug.keystore from .android folder in my case (C:\Users\SYSTEM.android) and paste into JDK bin Folder in my case (C:\Program Files\Java\jdk1.6.0_05\bin)

  4. Open command prompt and give the path of JDK Bin folder in my case (C:\Program Files\Java\jdk1.6.0_05\bin).

  5. Copy the following code and hit enter

    keytool -exportcert -alias androiddebugkey -keystore debug.keystore > c:\openssl\bin\debug.txt

  6. Now you need to enter password, Password = android.

  7. If you see in openssl Bin folder, you will get a file with the name of debug.txt

  8. Now either you can restart command prompt or work with existing command prompt

  9. get back to C drive and give the path of openssl Bin folder

  10. copy the following code and paste

    openssl sha1 -binary debug.txt > debug_sha.txt

  11. you will get debug_sha.txt in openssl bin folder

  12. Again copy following code and paste

    openssl base64 -in debug_sha.txt > debug_base64.txt

  13. you will get debug_base64.txt in openssl bin folder

  14. open debug_base64.txt file Here is your Key hash.

Solution 2:

  1. Copy all files from openssl/bin folder that is libeay32.dll,openssl.exe,ssleay32.dll to JDK bin folder. In my case it is “c:\program files\java\jdk1.7\bin”

  2. If You’ll already having Facebook SDK installed in Unity.So,restart Unity.

3)Go to Facebook->Edit Settings.And in the Inspector View you can see your Android Hash key for facebook.

Solution 2 is worked for me thanks!

It works for me. Thanks! If I follow facebook's guide as below command line, I got different hash key and doesn't work in game (hash key not matched). That's weired. keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

Solution 2 Work for me....Thanks!.

it works. thx a lot

Verry good

This didn’t work. Is there an updated method to accomplish getting key hash for facebook sdk?

Verry good

From wikipedia: [58713-angle.png|58713]

Is there any solution for this on Mac?