@@ -10,10 +10,13 @@ */ #import #import "OFObject.h" + +#define MD5_DIGEST_SIZE 16 +#define SHA1_DIGEST_SIZE 20 @interface OFMD5Hash: OFObject { uint32_t buf[4]; uint32_t bits[2]; @@ -21,9 +24,25 @@ BOOL calculated; } - init; -- (void)updateWithBuffer: (const uint8_t*)buf - ofSize: (size_t)size; +- updateWithBuffer: (const uint8_t*)buf + ofSize: (size_t)size; +- (uint8_t*)digest; +@end + +@interface OFSHA1Hash: OFObject +{ + uint32_t state[5]; + uint64_t count; + uint8_t buffer[64]; + uint8_t digest[SHA1_DIGEST_SIZE]; + + BOOL calculated; +} + +- init; +- updateWithBuffer: (const uint8_t*)buf + ofSize: (size_t)size; - (uint8_t*)digest; @end