Comment: | -[OFCryptoHash digest]: uint8_t -> unsigned char
While in practice they are usually the same, the C standard says that |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
19f7dc67af46fd3bafe9da07e75248bc |
User & Date: | js on 2016-07-24 12:14:41 |
Other Links: | manifest | tags |
2016-07-24
| ||
18:54 | OFCryptoHash: Conform to OFCopying check-in: b1cd76a8cd user: js tags: trunk | |
12:14 | -[OFCryptoHash digest]: uint8_t -> unsigned char check-in: 19f7dc67af user: js tags: trunk | |
02:51 | Add tests for OFHMAC check-in: db71988bf2 user: js tags: trunk | |
Modified src/OFCryptoHash.h from [86d6230316] to [91b722cbde].
︙ | ︙ | |||
63 64 65 66 67 68 69 | * @brief Returns a buffer containing the cryptographic hash. * * The size of the buffer depends on the hash used. The buffer is part of the * receiver's memory pool. * * @return A buffer containing the hash */ | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | * @brief Returns a buffer containing the cryptographic hash. * * The size of the buffer depends on the hash used. The buffer is part of the * receiver's memory pool. * * @return A buffer containing the hash */ - (const unsigned char*)digest OF_RETURNS_INNER_POINTER; /*! * @brief Resets all state so that a new hash can be calculated. * * @warning This invalidates any pointer previously returned by @ref digest. If * you are still interested in the previous digest, you need to memcpy * it yourself before calling @ref reset! */ - (void)reset; @end OF_ASSUME_NONNULL_END |
Modified src/OFDataArray+CryptoHashing.m from [c62437f34e] to [29df650203].
︙ | ︙ | |||
31 32 33 34 35 36 37 | @implementation OFDataArray (Hashing) - (OFString*)OF_cryptoHashWithClass: (Class <OFCryptoHash>)class { void *pool = objc_autoreleasePoolPush(); id <OFCryptoHash> hash = [class cryptoHash]; size_t digestSize = [class digestSize]; | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | @implementation OFDataArray (Hashing) - (OFString*)OF_cryptoHashWithClass: (Class <OFCryptoHash>)class { void *pool = objc_autoreleasePoolPush(); id <OFCryptoHash> hash = [class cryptoHash]; size_t digestSize = [class digestSize]; const unsigned char *digest; char cString[digestSize * 2]; [hash updateWithBuffer: _items length: _count * _itemSize]; digest = [hash digest]; for (size_t i = 0; i < digestSize; i++) { |
︙ | ︙ |
Modified src/OFHMAC.h from [42233d8968] to [682e9b5139].
︙ | ︙ | |||
69 70 71 72 73 74 75 | * @brief Returns a buffer containing the HMAC. * * The size of the buffer depends on the hash used. The buffer is part of the * receiver's memory pool. * * @return A buffer containing the hash */ | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | * @brief Returns a buffer containing the HMAC. * * The size of the buffer depends on the hash used. The buffer is part of the * receiver's memory pool. * * @return A buffer containing the hash */ - (const unsigned char*)digest OF_RETURNS_INNER_POINTER; /*! * @brief Returns the size of the digest. * * @return The size of the digest. */ - (size_t)digestSize; |
︙ | ︙ |
Modified src/OFHMAC.m from [1ea07b34f0] to [9c331f3be4].
︙ | ︙ | |||
104 105 106 107 108 109 110 | @throw [OFHashAlreadyCalculatedException exceptionWithObject: self]; [_innerHash updateWithBuffer: buffer length: length]; } | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | @throw [OFHashAlreadyCalculatedException exceptionWithObject: self]; [_innerHash updateWithBuffer: buffer length: length]; } - (const unsigned char*)digest { if (_calculated) return [_outerHash digest]; [_outerHash updateWithBuffer: [_innerHash digest] length: [[_innerHash class] digestSize]]; _calculated = true; |
︙ | ︙ |
Modified src/OFMD5Hash.m from [c7952ff29f] to [8b5373705c].
︙ | ︙ | |||
173 174 175 176 177 178 179 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } - (const unsigned char*)digest { if (_calculated) return (const uint8_t*)_state; _buffer.bytes[_bufferLength] = 0x80; memset(_buffer.bytes + _bufferLength + 1, 0, 64 - _bufferLength - 1); |
︙ | ︙ |
Modified src/OFRIPEMD160Hash.m from [93d7f36836] to [6115116dd0].
︙ | ︙ | |||
188 189 190 191 192 193 194 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } - (const unsigned char*)digest { if (_calculated) return (const uint8_t*)_state; _buffer.bytes[_bufferLength] = 0x80; memset(_buffer.bytes + _bufferLength + 1, 0, 64 - _bufferLength - 1); |
︙ | ︙ |
Modified src/OFSHA1Hash.m from [85d354ed73] to [e1d7855925].
︙ | ︙ | |||
148 149 150 151 152 153 154 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } - (const unsigned char*)digest { if (_calculated) return (const uint8_t*)_state; _buffer.bytes[_bufferLength] = 0x80; memset(_buffer.bytes + _bufferLength + 1, 0, 64 - _bufferLength - 1); |
︙ | ︙ |
Modified src/OFSHA224Or256Hash.m from [6b2637992f] to [2324ca56a2].
︙ | ︙ | |||
171 172 173 174 175 176 177 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | if (_bufferLength == 64) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } - (const unsigned char*)digest { if (_calculated) return (const uint8_t*)_state; _buffer.bytes[_bufferLength] = 0x80; memset(_buffer.bytes + _bufferLength + 1, 0, 64 - _bufferLength - 1); |
︙ | ︙ |
Modified src/OFSHA384Or512Hash.m from [43577ec262] to [5c6c4dfe45].
︙ | ︙ | |||
184 185 186 187 188 189 190 | if (_bufferLength == 128) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | if (_bufferLength == 128) { processBlock(_state, _buffer.words); _bufferLength = 0; } } } - (const unsigned char*)digest { if (_calculated) return (const uint8_t*)_state; _buffer.bytes[_bufferLength] = 0x80; memset(_buffer.bytes + _bufferLength + 1, 0, 128 - _bufferLength - 1); |
︙ | ︙ |
Modified src/OFString+CryptoHashing.m from [73f20bd87d] to [fc8a2533b9].
︙ | ︙ | |||
30 31 32 33 34 35 36 | @implementation OFString (CryptoHashing) - (OFString*)OF_cryptoHashWithClass: (Class <OFCryptoHash>)class { void *pool = objc_autoreleasePoolPush(); id <OFCryptoHash> hash = [class cryptoHash]; size_t digestSize = [class digestSize]; | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | @implementation OFString (CryptoHashing) - (OFString*)OF_cryptoHashWithClass: (Class <OFCryptoHash>)class { void *pool = objc_autoreleasePoolPush(); id <OFCryptoHash> hash = [class cryptoHash]; size_t digestSize = [class digestSize]; const unsigned char *digest; char cString[digestSize * 2]; [hash updateWithBuffer: [self UTF8String] length: [self UTF8StringLength]]; digest = [hash digest]; for (size_t i = 0; i < digestSize; i++) { |
︙ | ︙ |