@@ -136,10 +136,11 @@ state[0] = new2[3]; } @implementation OFRIPEMD160Hash @synthesize calculated = _calculated; +@synthesize allowsSwappableMemory = _allowsSwappableMemory; + (size_t)digestSize { return DIGEST_SIZE; } @@ -147,32 +148,40 @@ + (size_t)blockSize { return BLOCK_SIZE; } -+ (instancetype)cryptoHash ++ (instancetype)cryptoHashWithAllowsSwappableMemory: (bool)allowsSwappableMemory { - return [[[self alloc] init] autorelease]; + return [[[self alloc] initWithAllowsSwappableMemory: + allowsSwappableMemory] autorelease]; } -- (instancetype)init +- (instancetype)initWithAllowsSwappableMemory: (bool)allowsSwappableMemory { self = [super init]; @try { _iVarsData = [[OFSecureData alloc] - initWithCount: sizeof(*_iVars)]; + initWithCount: sizeof(*_iVars) + allowsSwappableMemory: allowsSwappableMemory]; _iVars = _iVarsData.mutableItems; + _allowsSwappableMemory = allowsSwappableMemory; [self of_resetState]; } @catch (id e) { [self release]; @throw e; } return self; } + +- (instancetype)init +{ + OF_INVALID_INIT_METHOD +} - (instancetype)of_init { return [super init]; } @@ -198,10 +207,11 @@ { OFRIPEMD160Hash *copy = [[OFRIPEMD160Hash alloc] of_init]; copy->_iVarsData = [_iVarsData copy]; copy->_iVars = copy->_iVarsData.mutableItems; + copy->_allowsSwappableMemory = _allowsSwappableMemory; copy->_calculated = _calculated; return copy; }