Created
April 21, 2019 21:23
-
-
Save roma-sck/a9ad01529c42e1a0eb05f3acf1677559 to your computer and use it in GitHub Desktop.
FB signin
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(context: Context) { | |
try { | |
val info = | |
context.packageManager.getPackageInfo(context.packageName, 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("printHashKey()", "Hash Key: $hashKey") | |
} | |
} catch (e: NoSuchAlgorithmException) { | |
e.printStackTrace() | |
} catch (e: Exception) { | |
e.printStackTrace() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment