Skip to content

lovetodream/swift-blake2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Pure Swift implementation of the BLAKE2 hash function based on RFC7693 without sacrificing performance

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages