How to Get the Md5 Fingerprint from Java's Keytool, Not Only Sha-1

Keytool generates SHA1 fingerprint instead of MD5?

If you add the -v (verbose) option to your command line, like

keytool -v -list -alias alias_name -keystore my-release-key.keystore

it should show you the MD5 fingerprint

Using keytool to get the MD5 signature of a certificate

Solved by going back to java 1.6.

SHA-1 fingerprint of keystore certificate

Follow this tutorial for creating SHA1 fingerprint for Google Map v2

For Debug mode:

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android 

for Release mode:

keytool -list -v -keystore {keystore_name} -alias {alias_name}

example:

keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test

On windows, when keytool command is not found, Go to your installed JDK Directory e.g. <YourJDKPath>\Java\jdk1.8.0_231\bin\, open command line and try the above commands for debug/release mode.

Another way of getting your SHA1 OR SHA-256 use ./gradlew signingReport

For more detailed info visit
Using Gradle's Signing Report

How do I generate my MD5 and SHA1 thumbprints using eclipse for debug keystore (Android)

get your sha1 and md5 thumbprint for debug keystore (also works for your other keystores).
Go to you package exporler in eclipse (defaults to the left side) right click it>android tools>export signed application package
Sample Image

Then navigate to your debug keystore normally in your .android folder and select it

Sample Image

Then enter the password which is "android" with no quotes

Sample Image

Next it will ask for an alias click the drop down list and select androiddebugkey and again, enter android as the password.

Sample Image

Next if you scroll down it will show the MD5 and SHA1 thumb print if you scroll down

Sample Image

then just cancel and use it how you want if you want your hash key just paste this under your onCreate

REPLACE "com.you.name" to your application package name.

PackageInfo info;
try {

info = getPackageManager().getPackageInfo( "com.you.name",PackageManager.GET_SIGNATURES);

for (Signature signature : info.signatures)
{
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
//String something = new String(Base64.encodeBytes(md.digest()));
Log.e("Hash key", something);
}

} catch (NameNotFoundException e1) {
Log.e("name not found", e1.toString());
} catch (NoSuchAlgorithmException e) {
Log.e("no such an algorithm", e.toString());
} catch (Exception e) {
Log.e("exception", e.toString());
}

How I get My MD5 and SHA-256?

Based on this answer for SHA-1

You should:

  1. On Android Studio got Terminal window (View > Tool Windows > Terminal);
  2. Paste this code keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

And should have something like this
Sample Image

How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?

Easiest ways ever:

Update added for Android Studio V 2.2 in last step

There are two ways to do this.

1. Faster way:

  1. Open Android Studio
  2. Open your Project
  3. Click on Gradle (From Right Side Panel, you will see Gradle Bar)
  4. Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)
  5. Click on Your Project (Your Project Name form List (root))
  6. Click on Tasks
  7. Click on Android
  8. Double Click on signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console))
  9. Select app module from module selection dropdown to run or debug your application

Check the screenshot below:

Sample Image

2. Work with Google Maps Activity:

  1. Open Android Studio
  2. Open Your Project
  3. Click on File menu -> Select New -> Click on Google -> Select Google Maps Activity
  4. A dialog would appear -> Click on Finish
  5. Android Studio would automatically generate an XML file named with google_maps_api.xml
  6. You would get debug SHA1 key here (at line number 10 of the XML file)

Check Screenshot below:

Sample Image

Android Studio V 2.2 Update

There is an issue with Execution.

Solution:

  • Click on Toggle tasks execution/text mode from Run bar

Check Screenshot below:

Sample Image

Done.



Related Topics



Leave a reply



Submit