Created
November 26, 2014 05:23
-
-
Save januprasad/89d20f05fd54814258ab to your computer and use it in GitHub Desktop.
printHashKey print hash key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void printHashKey(Context context) { | |
try { | |
String TAG = "com.ephron.socialnetgate"; | |
PackageInfo info = context.getPackageManager().getPackageInfo(TAG, PackageManager.GET_SIGNATURES); | |
for (Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
String keyHash = Base64.encodeToString(md.digest(), Base64.DEFAULT); | |
Log.i(TAG, "keyHash: " + keyHash); | |
} | |
} catch (NameNotFoundException e) { | |
} catch (NoSuchAlgorithmException e) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment