I'm trying to get just a hash from SHA256.hash(data:) but in order to do this I need to grab the description and then use .replacingOccurrences(of: "SHA256 digest: ", with: ""). Is there a way that I can just get the full SHA256 hash as a string?
func getId<T>(input: T) -> String {
let input = "\(input)".utf8
let data = Data(input)
let hash = SHA256.hash(data: data).description.replacingOccurrences(of: "SHA256 digest: ", with: "")
return hash
}