In this repository we only implemented Blake2b hasher.

It sits under Hashing extension to String and to Data.

let data: Data
let hex: String = data.hex.encode()

let hash128FromData: Data = try data.hashing.blake2b_128()
let hash128FromHex: Data = try hex.hashing.blake2b_128()
//  hash128FromData == hash128FromHex

let hash160FromData: Data = try data.hashing.blake2b_160()
let hash160FromHex: Data = try hex.hashing.blake2b_160()
// hash160FromData == hash160FromHex

let hash256FromData: Data = try data.hashing.blake2b_256()
let hash256FromHex: Data = try hex.hashing.blake2b_256()
// hash256FromData == hash256FromHex

let hash384FromData: Data = try data.hashing.blake2b_384()
let hash384FromHex: Data = try hex.hashing.blake2b_384()
// hash384FromData == hash384FromHex

let hash512FromData: Data = try data.hashing.blake2b_512()
let hash512FromHex: Data = try hex.hashing.blake2b_512()
// hash512FromData == hash512FromHex

Last updated