The key hashes is to let Facebook know that your app is not the app that was set up, so you can access the Facebook API.
Here's how to get the key hashes:
1. Download OpenSSL first
2. Place the Openssl.exe under the C:\Program files\java\jre7\bin file
3. Open cmd.exe, go to C:\Program files\java\jre7\bin, make KeyStore file, as follows
Keytool-genkey-v-keystore xxx.keystore-alias yyy-keyalg rsa-keysize 2048-validity 10000
This will give you a screenshot of KeyStore (Eclipse can also make keystore files) as follows:
Here the Xxx.keystore and yyy are defined by their own name, the following to get the hashkey of the time to use
Parameter description:
-keystore: Name
-alias: Name
-KEYALG: Algorithm
-validity: Days of validity
4. After getting KeyStore, you can get key hashes, as follows
Keytool-exportcert-alias Yyy-keystore Xxx.keystore | OpenSSL sha1-binary | OpenSSL base64
The name of the-alias and-keystore here is the name just taken, and then enter the KeyStore password to get key hashes, here is the operation screenshot:
5. Can also be obtained by code: try {
packageinfo info = Getpackagemanager (). Getpackageinfo ( Getpackagename (), packagemanager.get_signatures);
for (Signature signature:info.signatures) {
&NBSP ; MessageDigest MD = messagedigest.getinstance ("SHA");
md.update (Signature.tobytearray ());
string Keyhash = base64.encodetostring (Md.digest (), base64.default);
 LOG.D ("Keyhash:", "Keyhash:" +keyhash);//two times get different here take first value
toast.maketext (this, "FaceBook HashKey:" +keyhash, Toast.length_short). Show ();
}
} catch (Namenotfoundexception e) {
} catch (NoSuchAlgorithmException e) {
& nbsp;}