According to Facebook mobile development document (Android), you need to generate a key hash for your application in order to apply Facebook SSO(Single Sign on).
Here is the formal way to do this:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
But sometimes you won’t have a tradtional key store especially when building with Android open sources. Keys in Android open sources are in pk8 format. In order to generate key hashes with these keys, you need to tranfer them into a pk12 key store.
I created another way to generate keyhash without keytool and openssl. Here is the source codes: FacebookKeyHashGen
This program get package sigature directly from package itself.