What if we want juste the Sha1 string
franckobe opened this issue · comments
franckobe commented
The function returns Optional(XXXXXXXXXX), but how to get just the sha1 string ?
Thanks
Iggy Drougge commented
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")!
.