19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#import "OFSHA1Hash.h"
#import "OFSecureData.h"
#import "OFHashAlreadyCalculatedException.h"
#import "OFOutOfRangeException.h"
#define DIGEST_SIZE 20
#define BLOCK_SIZE 64
OF_DIRECT_MEMBERS
@interface OFSHA1Hash ()
- (void)of_resetState;
@end
#define F(a, b, c, d) ((d) ^ ((b) & ((c) ^ (d))))
|
|
|
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#import "OFSHA1Hash.h"
#import "OFSecureData.h"
#import "OFHashAlreadyCalculatedException.h"
#import "OFOutOfRangeException.h"
static const size_t digestSize = 20;
static const size_t blockSize = 64;
OF_DIRECT_MEMBERS
@interface OFSHA1Hash ()
- (void)of_resetState;
@end
#define F(a, b, c, d) ((d) ^ ((b) & ((c) ^ (d))))
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
@implementation OFSHA1Hash
@synthesize calculated = _calculated;
@synthesize allowsSwappableMemory = _allowsSwappableMemory;
+ (size_t)digestSize
{
return DIGEST_SIZE;
}
+ (size_t)blockSize
{
return BLOCK_SIZE;
}
+ (instancetype)hashWithAllowsSwappableMemory: (bool)allowsSwappableMemory
{
return [[[self alloc] initWithAllowsSwappableMemory:
allowsSwappableMemory] autorelease];
}
|
|
|
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
@implementation OFSHA1Hash
@synthesize calculated = _calculated;
@synthesize allowsSwappableMemory = _allowsSwappableMemory;
+ (size_t)digestSize
{
return digestSize;
}
+ (size_t)blockSize
{
return blockSize;
}
+ (instancetype)hashWithAllowsSwappableMemory: (bool)allowsSwappableMemory
{
return [[[self alloc] initWithAllowsSwappableMemory:
allowsSwappableMemory] autorelease];
}
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
[_iVarsData release];
[super dealloc];
}
- (size_t)digestSize
{
return DIGEST_SIZE;
}
- (size_t)blockSize
{
return BLOCK_SIZE;
}
- (id)copy
{
OFSHA1Hash *copy = [[OFSHA1Hash alloc] of_init];
copy->_iVarsData = [_iVarsData copy];
|
|
|
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
[_iVarsData release];
[super dealloc];
}
- (size_t)digestSize
{
return digestSize;
}
- (size_t)blockSize
{
return blockSize;
}
- (id)copy
{
OFSHA1Hash *copy = [[OFSHA1Hash alloc] of_init];
copy->_iVarsData = [_iVarsData copy];
|