Index: src/OFHash.h ================================================================== --- src/OFHash.h +++ src/OFHash.h @@ -26,10 +26,20 @@ #ifdef OF_HAVE_PROPERTIES @property (readonly) BOOL isCalculated; #endif +/** + * \return The digest size of the hash, in byte. + */ ++ (size_t)digestSize; + +/** + * \return The block size of the hash, in byte. + */ ++ (size_t)blockSize; + /** * Adds a buffer to the hash to be calculated. * * \param buf The buffer which should be included into the calculation. * \param size The size of the buffer Index: src/OFHash.m ================================================================== --- src/OFHash.m +++ src/OFHash.m @@ -18,10 +18,22 @@ #import "OFHash.h" #import "OFExceptions.h" @implementation OFHash ++ (size_t)digestSize +{ + @throw [OFNotImplementedException newWithClass: self + selector: _cmd]; +} + ++ (size_t)blockSize +{ + @throw [OFNotImplementedException newWithClass: self + selector: _cmd]; +} + - (void)updateWithBuffer: (const char*)buffer ofSize: (size_t)size { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; Index: src/OFMD5Hash.m ================================================================== --- src/OFMD5Hash.m +++ src/OFMD5Hash.m @@ -119,10 +119,20 @@ @implementation OFMD5Hash + MD5Hash { return [[[self alloc] init] autorelease]; } + ++ (size_t)digestSize +{ + return 16; +} + ++ (size_t)blockSize +{ + return 64; +} - init { self = [super init]; Index: src/OFSHA1Hash.m ================================================================== --- src/OFSHA1Hash.m +++ src/OFSHA1Hash.m @@ -131,10 +131,20 @@ @implementation OFSHA1Hash + SHA1Hash { return [[[self alloc] init] autorelease]; } + ++ (size_t)digestSize +{ + return 20; +} + ++ (size_t)blockSize +{ + return 64; +} - init { self = [super init];