ObjFW  Diff

Differences From Artifact [bdf798905f]:

To Artifact [85d354ed73]:

  • File src/OFSHA1Hash.m — part of check-in [951f530aee] at 2016-07-24 00:06:30 on branch trunk — Rename OFHash to OFCryptoHash

    OFHash is too generic, as this protocol is for cryptographic hashes. It
    also solves the ambiguity of the +[hash] method (which is now
    +[cryptoHash]), which conflicted with -[hash] on the class itself,
    resulting in classes conforming to OFHash not being able to be used as a
    key in an OFDictionary. (user: js, size: 3784) [annotate] [blame] [check-ins using]


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
}

+ (size_t)blockSize
{
	return 64;
}

+ (instancetype)hash
{
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];







|







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
}

+ (size_t)blockSize
{
	return 64;
}

+ (instancetype)cryptoHash
{
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
- (void)updateWithBuffer: (const void*)buffer_
		  length: (size_t)length
{
	const uint8_t *buffer = buffer_;

	if (_calculated)
		@throw [OFHashAlreadyCalculatedException
		    exceptionWithHash: self];

	_bits += (length * 8);

	while (length > 0) {
		size_t min = 64 - _bufferLength;

		if (min > length)







|







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
- (void)updateWithBuffer: (const void*)buffer_
		  length: (size_t)length
{
	const uint8_t *buffer = buffer_;

	if (_calculated)
		@throw [OFHashAlreadyCalculatedException
		    exceptionWithObject: self];

	_bits += (length * 8);

	while (length > 0) {
		size_t min = 64 - _bufferLength;

		if (min > length)