idrougge / sha1-swift

SHA-1 implementation in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What if we want juste the Sha1 string

franckobe opened this issue · comments

The function returns Optional(XXXXXXXXXX), but how to get just the sha1 string ?

Thanks

It's a normal Swift Optional value, I suggest you read about optionals as it is one of the fundamentals of the Swift language.
To answer your question: You can either use an if let hash = hash { do something } or, if you're feeling adventurous, just force unwrap the return value using an exclamation mark as in let hash = SHA1.hexString(from: "abc")!.