@@ -27,56 +27,56 @@ - (OFString*)MD5Hash { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFMD5Hash *hash = [OFMD5Hash MD5Hash]; uint8_t *digest; - char ret_c[OF_MD5_DIGEST_SIZE * 2]; + char cString[OF_MD5_DIGEST_SIZE * 2]; size_t i; [hash updateWithBuffer: string - ofSize: length]; + length: length]; digest = [hash digest]; for (i = 0; i < OF_MD5_DIGEST_SIZE; i++) { uint8_t high, low; high = digest[i] >> 4; low = digest[i] & 0x0F; - ret_c[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); - ret_c[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); + cString[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); + cString[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); } [pool release]; - return [OFString stringWithCString: ret_c + return [OFString stringWithCString: cString length: 32]; } - (OFString*)SHA1Hash { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFMD5Hash *hash = [OFSHA1Hash SHA1Hash]; uint8_t *digest; - char ret_c[OF_SHA1_DIGEST_SIZE * 2]; + char cString[OF_SHA1_DIGEST_SIZE * 2]; size_t i; [hash updateWithBuffer: string - ofSize: length]; + length: length]; digest = [hash digest]; for (i = 0; i < OF_SHA1_DIGEST_SIZE; i++) { uint8_t high, low; high = digest[i] >> 4; low = digest[i] & 0x0F; - ret_c[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); - ret_c[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); + cString[i * 2] = (high > 9 ? high - 10 + 'a' : high + '0'); + cString[i * 2 + 1] = (low > 9 ? low - 10 + 'a' : low + '0'); } [pool release]; - return [OFString stringWithCString: ret_c + return [OFString stringWithCString: cString length: 40]; } @end