I need to generate Data from an user password in Swift. I'm currently using:
let password = "replace_it_for_smt_related_to_the_user"
var securityKey:Data! = Data()
securityKey = self.password.data(using: .utf16, allowLossyConversion: true)?.subdata(in: 0...32)
But then, using it with a library, I get the error: "securityKey must be 256 bits". I don't really care about the encoding type, but I need to create Data from a string that is 256 bits. Any help?
Thanks