How to do HMAC-SHA1 in swift -
i trying take string , in php:
$signature= base64_encode(hash_hmac('sha1', $data, $secretkey, true));
however, in swift... see lot of posts other people trying things commoncrypto, module doesn't seem install.
so 3 questions really:
- is commoncrypto correct way this?
- if so, how add framework?
- if commoncrypto isn't best way this, is?
my current code looks this:
var authstring:string = "put\ntest=blah\ntest2=blahblahblah" let hmacresult:string = authstring.sha1() ... extension string { func sha1() -> string { //do something... } }
Comments
Post a Comment