* input * * Description: * This function accepts an array of octets as the next portion of * the message. * * Parameters: * message_array: [in] * An array of characters representing the next portion of the * message. * * Returns: * Nothing. * * Comments: * */
| 196 | * |
| 197 | */ |
| 198 | void sha1::input(const unsigned char *message_array, unsigned length) |
| 199 | { |
| 200 | if (!length) { |
| 201 | return; |
| 202 | } |
| 203 | |
| 204 | if (computed_ || corrupted_) { |
| 205 | corrupted_ = true; |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | while (length-- && !corrupted_) { |
| 210 | message_block_[message_block_index_++] = (*message_array & 0xFF); |
| 211 | |
| 212 | length_low_ += 8; |
| 213 | length_low_ &= 0xFFFFFFFF; // Force it to 32 bits |
| 214 | if (length_low_ == 0) { |
| 215 | length_high_++; |
| 216 | length_high_ &= 0xFFFFFFFF; // Force it to 32 bits |
| 217 | if (length_high_ == 0) { |
| 218 | corrupted_ = true; // Message is too long |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | if (message_block_index_ == 64) { |
| 223 | process_message_block(); |
| 224 | } |
| 225 | |
| 226 | message_array++; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | /* |
| 231 | * input |