Skip to content

Instantly share code, notes, and snippets.

@roma-sck
Created April 21, 2019 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roma-sck/a9ad01529c42e1a0eb05f3acf1677559 to your computer and use it in GitHub Desktop.
Save roma-sck/a9ad01529c42e1a0eb05f3acf1677559 to your computer and use it in GitHub Desktop.
FB signin
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