Example #1
0
	void ShaHmac::Create(const void* key,uint klen){
		if(_bits==sha_160){
			sha1_hmac_starts(tvcast<sha1_context>(_sha_ctx),(byte*)key,klen);
		}else if(_bits==sha_224){
			sha2_hmac_starts(tvcast<sha2_context>(_sha_ctx),(byte*)key,klen,1);
		}else if(_bits==sha_256){
			sha2_hmac_starts(tvcast<sha2_context>(_sha_ctx),(byte*)key,klen,0);
		}else if(_bits==sha_384){
			sha4_hmac_starts(tvcast<sha4_context>(_sha_ctx),(byte*)key,klen,1);
		}else if(_bits==sha_512){
			sha4_hmac_starts(tvcast<sha4_context>(_sha_ctx),(byte*)key,klen,0);
		}else{
			_ASSERT(0);
		} 
	}
Example #2
0
static void sha1_hmac_starts_wrap( void *ctx, const unsigned char *key,
                                   size_t keylen )
{
    sha1_hmac_starts( (sha1_context *) ctx, key, keylen );
}