Created
September 7, 2018 08:24
-
-
Save 100rabhkr/bf652014ddeef93b733a9d94c65db995 to your computer and use it in GitHub Desktop.
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 pContext) { | |
try { | |
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES); | |
for (Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
String hashKey = new String(Base64.encode(md.digest(), 0)); | |
Log.i(TAG, "printHashKey() Hash Key: " + hashKey); | |
} | |
} catch (NoSuchAlgorithmException e) { | |
Log.e(TAG, "printHashKey()", e); | |
} catch (Exception e) { | |
Log.e(TAG, "printHashKey()", e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment