Swiftpack.co - Package - tris-foundation/crypto

Crypto

Cryptography in Swift

Package.swift

.package(url: "https://github.com/tris-foundation/crypto.git", from: "master")

SHA1

var sha1 = SHA1()
sha1.update(bytes)
let hash = sha1.final()

Convert to Array or String

_ = [UInt8](hash)
_ = String(hash)

Convenience extensions

let hash = bytes.sha1()

UUID

_ = UUID().uuidStirng
_ = UUID(uuidStirng: "96888CEE-9705-490D-E38A-B407C8A9DA65")

Acknowledgments

The current implementation of SHA1 was ported from OpenSSL