@@ -14,10 +14,11 @@ * file. */ #include "config.h" +#include #include #import "OFSHA224Or256Hash.h" #import "OFHashAlreadyCalculatedException.h" @@ -118,20 +119,30 @@ + (size_t)blockSize { return 64; } -+ (instancetype)hash ++ (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } - init { self = [super init]; - [self OF_resetState]; + @try { + if ([self class] == [OFSHA224Or256Hash class]) { + [self doesNotRecognizeSelector: _cmd]; + abort(); + } + + [self OF_resetState]; + } @catch (id e) { + [self release]; + @throw e; + } return self; } - (void)updateWithBuffer: (const void*)buffer_ @@ -139,11 +150,11 @@ { const uint8_t *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException - exceptionWithHash: self]; + exceptionWithObject: self]; _bits += (length * 8); while (length > 0) { size_t min = 64 - _bufferLength;