Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created June 9, 2019 08:43
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 laevandus/a198f16c215f2ba5736fd0416e8f6a27 to your computer and use it in GitHub Desktop.
Save laevandus/a198f16c215f2ba5736fd0416e8f6a27 to your computer and use it in GitHub Desktop.
let dataPieces = ["The ", "quick ", "brown ", "fox ", "jumps ", "over ", "the ", "lazy ", "dog"].map({ $0.data(using: .utf8)! })
var hasher = SHA512()
dataPieces.forEach { (data) in
hasher.update(data: data)
}
print(hasher.finalize()) // 07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment