Overview
Comment: | OFCryptoHash: Add property for digest / block size |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
320d638a212b11a3caa4e492e6932f47 |
User & Date: | js on 2019-03-12 22:10:21 |
Other Links: | manifest | tags |
Context
2019-03-12
| ||
23:20 | utils: Use dot syntax check-in: 53e3ae1e45 user: js tags: trunk | |
22:10 | OFCryptoHash: Add property for digest / block size check-in: 320d638a21 user: js tags: trunk | |
21:50 | OFHTTPRequest: Note that remoteAddress is copied check-in: 3b09055db5 user: js tags: trunk | |
Changes
Modified src/OFCryptoHash.h from [63898f6fd8] to [b402221532].
︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | + + + + + + + + + + | */ @protocol OFCryptoHash <OFObject, OFCopying> #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) size_t digestSize; @property (class, readonly, nonatomic) size_t blockSize; #endif /*! * @brief The digest size of the cryptographic hash, in bytes. */ @property (readonly, nonatomic) size_t digestSize; /*! * @brief The block size of the cryptographic hash, in bytes. */ @property (readonly, nonatomic) size_t blockSize; /*! * @brief A boolean whether the hash has already been calculated. */ @property (readonly, nonatomic, getter=isCalculated) bool calculated; /*! * @brief A buffer containing the cryptographic hash. |
︙ |
Modified src/OFHMAC.m from [61a4776d3d] to [c9ae48fd28].
︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - + | @try { if (length > blockSize) { id <OFCryptoHash> hash = [_hashClass cryptoHash]; [hash updateWithBuffer: key length: length]; |
︙ | |||
138 139 140 141 142 143 144 | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - + | if (_outerHash == nil || _innerHash == nil) @throw [OFInvalidArgumentException exception]; if (_calculated) return _outerHash.digest; [_outerHash updateWithBuffer: _innerHash.digest |
︙ |
Modified src/OFMD5Hash.m from [d8543cb4a1] to [fabee7cd05].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + | #include <string.h> #import "OFMD5Hash.h" #import "OFSecureData.h" #import "OFHashAlreadyCalculatedException.h" #import "OFOutOfRangeException.h" #define DIGEST_SIZE 16 #define BLOCK_SIZE 64 @interface OFMD5Hash () - (void)of_resetState; @end #define F(a, b, c) (((a) & (b)) | (~(a) & (c))) #define G(a, b, c) (((a) & (c)) | ((b) & ~(c))) |
︙ | |||
120 121 122 123 124 125 126 | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | - + - + | } @implementation OFMD5Hash @synthesize calculated = _calculated; + (size_t)digestSize { |
︙ | |||
162 163 164 165 166 167 168 169 170 171 172 173 174 175 | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | + + + + + + + + + + | - (void)dealloc { [_iVarsData release]; [super dealloc]; } - (size_t)digestSize { return DIGEST_SIZE; } - (size_t)blockSize { return BLOCK_SIZE; } - (id)copy { OFMD5Hash *copy = [[OFMD5Hash alloc] of_init]; copy->_iVarsData = [_iVarsData copy]; copy->_iVars = copy->_iVarsData.mutableItems; |
︙ |
Modified src/OFRIPEMD160Hash.m from [3842b26a7e] to [03939c1eca].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + | #include <string.h> #import "OFRIPEMD160Hash.h" #import "OFSecureData.h" #import "OFHashAlreadyCalculatedException.h" #import "OFOutOfRangeException.h" #define DIGEST_SIZE 20 #define BLOCK_SIZE 64 @interface OFRIPEMD160Hash () - (void)of_resetState; @end #define F(a, b, c) ((a) ^ (b) ^ (c)) #define G(a, b, c) (((a) & (b)) | (~(a) & (c))) |
︙ | |||
134 135 136 137 138 139 140 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | - + - + | } @implementation OFRIPEMD160Hash @synthesize calculated = _calculated; + (size_t)digestSize { |
︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | + + + + + + + + + + | - (void)dealloc { [_iVarsData release]; [super dealloc]; } - (size_t)digestSize { return DIGEST_SIZE; } - (size_t)blockSize { return BLOCK_SIZE; } - (id)copy { OFRIPEMD160Hash *copy = [[OFRIPEMD160Hash alloc] of_init]; copy->_iVarsData = [_iVarsData copy]; copy->_iVars = copy->_iVarsData.mutableItems; |
︙ |
Modified src/OFSHA1Hash.m from [15c7c9a7a5] to [0aa83b56cc].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + | #include <string.h> #import "OFSHA1Hash.h" #import "OFSecureData.h" #import "OFHashAlreadyCalculatedException.h" #import "OFOutOfRangeException.h" #define DIGEST_SIZE 20 #define BLOCK_SIZE 64 @interface OFSHA1Hash () - (void)of_resetState; @end #define F(a, b, c, d) ((d) ^ ((b) & ((c) ^ (d)))) #define G(a, b, c, d) ((b) ^ (c) ^ (d)) |
︙ | |||
94 95 96 97 98 99 100 | 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; + (size_t)digestSize { |
︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | + + + + + + + + + + | - (void)dealloc { [_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]; copy->_iVars = copy->_iVarsData.mutableItems; |
︙ |
Modified src/OFSHA224Hash.m from [7c00c06fc5] to [803315dc1d].
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | + + - + + + + + + | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFSHA224Hash.h" #define DIGEST_SIZE 28 @implementation OFSHA224Hash + (size_t)digestSize { |
︙ |
Modified src/OFSHA224Or256Hash.m from [01186e5528] to [01743762af].
︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + | #include <string.h> #import "OFSHA224Or256Hash.h" #import "OFSecureData.h" #import "OFHashAlreadyCalculatedException.h" #import "OFOutOfRangeException.h" #define BLOCK_SIZE 64 @interface OFSHA224Or256Hash () - (void)of_resetState; @end static const uint32_t table[] = { 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, |
︙ | |||
121 122 123 124 125 126 127 | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - + | + (size_t)digestSize { OF_UNRECOGNIZED_SELECTOR } + (size_t)blockSize { |
︙ | |||
163 164 165 166 167 168 169 170 171 172 173 174 175 176 | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | + + + + + + + + + + | - (void)dealloc { [_iVarsData release]; [super dealloc]; } - (size_t)digestSize { OF_UNRECOGNIZED_SELECTOR } - (size_t)blockSize { return BLOCK_SIZE; } - (id)copy { OFSHA224Or256Hash *copy = [[[self class] alloc] of_init]; copy->_iVarsData = [_iVarsData copy]; copy->_iVars = copy->_iVarsData.mutableItems; |
︙ |
Modified src/OFSHA256Hash.m from [ae64791df2] to [b72228f6d2].
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | + + - + + + + + + | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFSHA256Hash.h" #define DIGEST_SIZE 32 @implementation OFSHA256Hash + (size_t)digestSize { |
︙ |
Modified src/OFSHA384Hash.m from [4a3058801e] to [2b824a6ac9].
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | + + - + + + + + + | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFSHA384Hash.h" #define DIGEST_SIZE 48 @implementation OFSHA384Hash + (size_t)digestSize { |
︙ |
Modified src/OFSHA384Or512Hash.m from [af9afb2e15] to [b218fc3078].
︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + | #include <string.h> #import "OFSHA384Or512Hash.h" #import "OFSecureData.h" #import "OFHashAlreadyCalculatedException.h" #import "OFOutOfRangeException.h" #define BLOCK_SIZE 128 @interface OFSHA384Or512Hash () - (void)of_resetState; @end static const uint64_t table[] = { 0x428A2F98D728AE22, 0x7137449123EF65CD, 0xB5C0FBCFEC4D3B2F, |
︙ | |||
132 133 134 135 136 137 138 | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - + | + (size_t)digestSize { OF_UNRECOGNIZED_SELECTOR } + (size_t)blockSize { |
︙ | |||
174 175 176 177 178 179 180 181 182 183 184 185 186 187 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | + + + + + + + + + + | - (void)dealloc { [_iVarsData release]; [super dealloc]; } - (size_t)digestSize { OF_UNRECOGNIZED_SELECTOR } - (size_t)blockSize { return BLOCK_SIZE; } - (id)copy { OFSHA384Or512Hash *copy = [[[self class] alloc] of_init]; copy->_iVarsData = [_iVarsData copy]; copy->_iVars = copy->_iVarsData.mutableItems; |
︙ |
Modified src/OFSHA512Hash.m from [f09a2d28cf] to [a187cfb465].
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | + + - + + + + + + | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFSHA512Hash.h" #define DIGEST_SIZE 64 @implementation OFSHA512Hash + (size_t)digestSize { |
︙ |