swift-blake2

0.1.0

Pure Swift implementation of the BLAKE2 hash function based on RFC7693 without sacrificing performance
lovetodream/swift-blake2

What's New

swift-blake2

A pure Swift implementation of BLAKE2.

RFC 7693: The BLAKE2 Cryptographic Hash and Message Authentication Code (MAC)

If you don't want to add yet another dependency to your project, you can copy the file BLAKE2b.swift (Do not remove the license header!).

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()

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 18 2024 13:14:31 GMT-0900 (Hawaii-Aleutian Daylight Time)