0
我是hmac-sha1的新手。我有幾個關於樣本的問題。我需要澄清hmac-sha1樣本
/*
inputs:
NSData *keyData;
NSData *clearTextData
*/
uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0};
CCHmacContext hmacContext;
CCHmacInit(&hmacContext, kCCHmacAlgSHA1, keyData.bytes, keyData.length);
CCHmacUpdate(&hmacContext, clearTextData.bytes, clearTextData.length);
CCHmacFinal(&hmacContext, digest);
NSData *out = [NSData dataWithBytes:digest length:CC_SHA1_DIGEST_LENGTH];
- 什麼是
clearTextData
?它是NSData
對象形式的源字符串嗎? - 什麼是
kData
?它是源數據編碼嗎? - 密鑰在哪裏? (是
kData
?)