SweetHMAC 介绍
SweetHMAC 是个极小,简单易用的 Swift 类,使用 HMAC 算法加密字符串。
字符串扩展:
// Will output this string: e470f785afb708cd8c2a31860642fd11 "I'm going to make him an offer he can't refuse".HMAC(.MD5, secret:"Vito Corleone")
HMAC:
let quote = "I'm going to make him an offer he can't refuse" let author = "Vito Corleone" // Create a SweetHMAC instance with your message and secret strings let hmacEncrypt:SweetHMAC = SweetHMAC(source: quote, secret: author) // Pick some computed HMAC output based on some algorithm using "HMAC" method... let md5 = hmacEncrypt.HMAC(.MD5) // ...or do it more "Sweet" like this let md5 = SweetHMAC(source: quote, secret: author).HMAC(.MD5)
SweetHMAC 官网
https://github.com/jancassio/SweetHMAC
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。