How to generate key hash for android?

To get ssh follow below steps:

  1. Paste below sample Code in Your OnCreate method of Application class ( only for getting ssh key )
  2. import android.util.Base64;
    import android.util.Log;import;
    MessageDigest md = null;
    try {
      PackageInfo info = context.getPackageManager().getPackageInfo(
      for (Signature signature : info.signatures) {
        md = MessageDigest.getInstance("SHA");
    } catch (PackageManager.NameNotFoundException e) {
    } catch (NoSuchAlgorithmException e) {
    Log.i("SecretKey = ",Base64.encodeToString(md.digest(), Base64.DEFAULT));
  3. Above code will print SecretKey in your Logs.
  4. Copy and paste secret key in sendOTP panel.
  5. You can remove/comment above code now 


In order to generate key hash you need to follow these steps:
1) Download Openssl from  here.
2) Make a  openssl folder in C drive
3) Extract Zip files into this  openssl folder created in C drive
4) Copy the File  debug.keystore from .android folder, in our case (C:\Users\ and paste into JDK bin folder, in our case (C:\Program Files\Java\jdk1.6.0_05\bin)5)  Open command prompt and give the path of JDK bin folder, in our case (C:\Program Files\Java\jdk1.6.0_05\bin) 

6) Copy the following code and hit enter

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

7) Now you need to enter password, password = android

8) Again in  openssl bin folder, you will get a file with the name of debug.txt

9) Now either you can restart command prompt or work with existing command prompt

10) Get back to C drive and  give the path of openssl bin folder

11) Copy the following code and paste

openssl sha1 -binary debug.txt > debug_sha.txt

12) You will get  debug_sha.txt in openssl bin folder

13) Again copy following code and paste

openssl base64 -in debug_sha.txt > debug_base64.txt

14) You will get  debug_base64.txt in openssl bin folder

15) Open  debug_base64.txt file and you get your key hash

Still need help? Contact Us Contact Us