Created
April 30, 2018 06:25
-
-
Save jd-alexander/0e45a25c4ddc194a3700f0af78254348 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
val TAG = "hash" | |
try { | |
val info = context.packageManager.getPackageInfo("", PackageManager.GET_SIGNATURES) | |
for (signature in info.signatures) { | |
val md = MessageDigest.getInstance("SHA") | |
md.update(signature.toByteArray()) | |
val hashKey = String(Base64.encode(md.digest(), 0)) | |
Log.i(TAG, "printHashKey() Hash Key: $hashKey") | |
} | |
} catch (e: NoSuchAlgorithmException) { | |
Log.e(TAG, "printHashKey()", e) | |
} catch (e: Exception) { | |
Log.e(TAG, "printHashKey()", e) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment