tesseract-one/blake2.swift
Swift wrapper for [reference C implementation](https://github.com/BLAKE2/BLAKE2) of [BLAKE2](https://en.wikipedia.org/wiki/BLAKE_(hash_function)#BLAKE2) hash functions.
Installation
Blake2 deploys to macOS, iOS, tvOS, watchOS and Linux. It has been tested on the latest OS releases only however, as the module uses very few platform-provided APIs, there should be very few issues with earlier versions.
Setup instructions:
- Swift Package Manager:
Add this to the dependency section of your Package.swift manifest:
``Swift .package(url: "https://github.com/tesseract-one/Blake2.swift.git", from: "0.2.0") ``
- CocoaPods: Put this in your
Podfile:
``Ruby pod 'Blake2', '~> 0.2' ``
Usage Examples
import Blake2
let data = Data("some data for hashing".utf8)
// Simple hash api. 64 byte Blake2b hash.
let hash = try! Blake2b.hash(size: 64, data: data)
print("Hash", hash)
// Streaming hash api. 64 byte Blake2b hash.
// Create hasher object
var hasher = try! Blake2b(size: 64)
// insert data by chunks
hasher.update(data)
// and then finalize hasher
let hash2 = try! hasher.finalize()
print("Hash", hash2)License
Blake2.swift can be used, distributed and modified under the Apache 2.0 license.
Package Metadata
Repository: tesseract-one/blake2.swift
Default branch: main
README: README.md