Skip to content

Instantly share code, notes, and snippets.

@sme-shyl001
Created September 20, 2023 07:56
Show Gist options
  • Save sme-shyl001/f5fd40f0d1f4ff81cd128ab7492eb9cb to your computer and use it in GitHub Desktop.
Save sme-shyl001/f5fd40f0d1f4ff81cd128ab7492eb9cb to your computer and use it in GitHub Desktop.
Signature hash key
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