Created
September 20, 2023 07:56
-
-
Save sme-shyl001/f5fd40f0d1f4ff81cd128ab7492eb9cb to your computer and use it in GitHub Desktop.
Signature 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
private fun printHashKey() { | |
try { | |
val info: PackageInfo = | |
requireActivity().packageManager.getPackageInfo( | |
requireActivity().packageName, | |
// "com.sme.ap.prod", | |
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)) | |
toast(hashKey) | |
e { "wtf -> Hash Key: $hashKey" } | |
} | |
} catch (e: NoSuchAlgorithmException) { | |
e { "wtf -> printHashKey() $e" } | |
} catch (e: Exception) { | |
e { "wtf -> printHashKey() $e" } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment