Differences From Artifact [6ab18f2a4c]:
- File src/OFSHA224Or256Hash.m — part of check-in [e0b9167693] at 2016-02-21 15:37:42 on branch trunk — Make use of C99-style for loops (user: js, size: 4576) [annotate] [blame] [check-ins using]
To Artifact [6b2637992f]:
- File
src/OFSHA224Or256Hash.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: 4775) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #import "OFSHA224Or256Hash.h" #import "OFHashAlreadyCalculatedException.h" static const uint32_t table[] = { | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <stdlib.h> #include <string.h> #import "OFSHA224Or256Hash.h" #import "OFHashAlreadyCalculatedException.h" static const uint32_t table[] = { |
︙ | ︙ | |||
116 117 118 119 120 121 122 | } + (size_t)blockSize { return 64; } | | > > > > > > | > > > > | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | } + (size_t)blockSize { return 64; } + (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } - init { self = [super init]; @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_ 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) |
︙ | ︙ |