Last active
August 12, 2018 18:23
-
-
Save nishabe/fbcdfeda7f3b4aed6585710602e730df to your computer and use it in GitHub Desktop.
OBJC: HMAC creation - Pass Key and Data as NSData
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSData *)generateHMACwith:(NSData *)key key:(NSData *)data { | |
NSMutableData *macOut = [NSMutableData dataWithLength:CC_SHA256_DIGEST_LENGTH]; | |
CCHmac( kCCHmacAlgSHA256, | |
key.bytes, | |
key.length, | |
data.bytes, | |
data.length, | |
macOut.mutableBytes); | |
return macOut; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment