Skip to content

Instantly share code, notes, and snippets.

@davidmtamas
Created April 2, 2020 07:17
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 davidmtamas/1ea9968f002009d377c9e426cfc8f661 to your computer and use it in GitHub Desktop.
Save davidmtamas/1ea9968f002009d377c9e426cfc8f661 to your computer and use it in GitHub Desktop.
var hash = [UInt8](repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH))
_ = keyWithHeader.withUnsafeBytes {
CC_SHA256($0.baseAddress!, CC_LONG(keyWithHeader.count), &hash)
}
return Data(hash).base64EncodedString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment