Contents

lovetodream/swift-blake2

A pure Swift implementation of BLAKE2.

Usage

You can compute digest in a single step using the static hash(data:key:digestLength:salt:) method.

let digest = try BLAKE2b.hash(data: "hello, world!".data(using: .utf8)!)

If you want to compute the digest of a large amount of data, you can initialize an instance of BLAKE2b and call update(data:) as often as you need to. To finalize and return the digest, call finalize().

var hasher = try BLAKE2b()
hasher.update(data: "hello, ".data(using: .utf8)!)
hasher.update(data: "world!".data(using: .utf8)!)
let digest = hasher.finalize()

Package Metadata

Repository: lovetodream/swift-blake2

Default branch: main

README: README.md