Skip to content

Instantly share code, notes, and snippets.

@rajat1saxena
Created June 24, 2018 06:18
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 rajat1saxena/ddd6301fd6564954e204eed23dcce2f4 to your computer and use it in GitHub Desktop.
Save rajat1saxena/ddd6301fd6564954e204eed23dcce2f4 to your computer and use it in GitHub Desktop.
print_sha512_checksum.kt
fun printableHexString(data: ByteArray): String {
// Create Hex String
val hexString: StringBuilder = StringBuilder()
for (aMessageDigest:Byte in data) {
var h: String = Integer.toHexString(0xFF and aMessageDigest.toInt())
while (h.length < 2)
h = "0$h"
hexString.append(h)
}
return hexString.toString()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment