@@ -49,12 +49,11 @@ @implementation TestsAppDelegate (OFHMACTests) - (void)HMACTests { void *pool = objc_autoreleasePoolPush(); - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; OFHMAC *HMAC_MD5, *HMAC_SHA1, *HMAC_RMD160; OFHMAC *HMAC_SHA256, *HMAC_SHA384, *HMAC_SHA512; TEST(@"+[HMACWithHashClass:] with MD5", (HMAC_MD5 = [OFHMAC HMACWithHashClass: [OFMD5Hash class] @@ -78,44 +77,31 @@ EXPECT_EXCEPTION(@"Detection of missing key", OFInvalidArgumentException, [HMAC_MD5 updateWithBuffer: "" length: 0]) TEST(@"-[setKey:length:] with MD5", - R([HMAC_MD5 setKey: key - length: key_length])) + R([HMAC_MD5 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-1", - R([HMAC_SHA1 setKey: key - length: key_length])) + R([HMAC_SHA1 setKey: key length: key_length])) TEST(@"-[setKey:length:] with RIPEMD-160", - R([HMAC_RMD160 setKey: key - length: key_length])) + R([HMAC_RMD160 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-256", - R([HMAC_SHA256 setKey: key - length: key_length])) + R([HMAC_SHA256 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-384", - R([HMAC_SHA384 setKey: key - length: key_length])) + R([HMAC_SHA384 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-512", - R([HMAC_SHA512 setKey: key - length: key_length])) + R([HMAC_SHA512 setKey: key length: key_length])) while (!f.atEndOfStream) { char buf[64]; - size_t len = [f readIntoBuffer: buf - length: 64]; - [HMAC_MD5 updateWithBuffer: buf - length: len]; - [HMAC_SHA1 updateWithBuffer: buf - length: len]; - [HMAC_RMD160 updateWithBuffer: buf - length: len]; - [HMAC_SHA256 updateWithBuffer: buf - length: len]; - [HMAC_SHA384 updateWithBuffer: buf - length: len]; - [HMAC_SHA512 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 64]; + [HMAC_MD5 updateWithBuffer: buf length: len]; + [HMAC_SHA1 updateWithBuffer: buf length: len]; + [HMAC_RMD160 updateWithBuffer: buf length: len]; + [HMAC_SHA256 updateWithBuffer: buf length: len]; + [HMAC_SHA384 updateWithBuffer: buf length: len]; + [HMAC_SHA512 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[digest] with MD5", memcmp(HMAC_MD5.digest, digest_md5, HMAC_MD5.digestSize) == 0)