Last active
March 8, 2019 05:37
-
-
Save EmmanuelGuther/73a13a0d7a1da2931832ea75c5c3d9aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private fun printKeyHash() { | |
try { | |
val info = activity?.packageManager?.getPackageInfo("com.s", PackageManager.GET_SIGNATURES) | |
for (signature in info!!.signatures!!) { | |
val md = MessageDigest.getInstance("SHA") | |
md.update(signature.toByteArray()) | |
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)) | |
} | |
} catch (e: PackageManager.NameNotFoundException) { | |
Log.e("KeyHash:", e.toString()) | |
} catch (e: NoSuchAlgorithmException) { | |
Log.e("KeyHash:", e.toString()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment