summaryrefslogtreecommitdiff
path: root/ext/digest/sha1/sha1.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-07-21 09:23:58 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2022-07-21 09:42:04 -0700
commit5b21e94bebed90180d8ff63dad03b8b948361089 (patch)
treef9f7196d84b51b7a3a8001658e4391a63b71c396 /ext/digest/sha1/sha1.c
parent3ff53c8e04ecc91e0190de6d5950ecce2a2ea188 (diff)
downloadruby-5b21e94bebed90180d8ff63dad03b8b948361089.tar.gz
Expand tabs [ci skip]
[Misc #18891]
Diffstat (limited to 'ext/digest/sha1/sha1.c')
-rw-r--r--ext/digest/sha1/sha1.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/ext/digest/sha1/sha1.c b/ext/digest/sha1/sha1.c
index 5311227549..afe952f8ba 100644
--- a/ext/digest/sha1/sha1.c
+++ b/ext/digest/sha1/sha1.c
@@ -227,16 +227,16 @@ void SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
j = context->count[0];
if ((context->count[0] += len << 3) < j)
- context->count[1] += (len>>29)+1;
+ context->count[1] += (len>>29)+1;
j = (j >> 3) & 63;
if ((j + len) > 63) {
- (void)memcpy(&context->buffer[j], data, (i = 64-j));
- SHA1_Transform(context->state, context->buffer);
- for ( ; i + 63 < len; i += 64)
- SHA1_Transform(context->state, &data[i]);
- j = 0;
+ (void)memcpy(&context->buffer[j], data, (i = 64-j));
+ SHA1_Transform(context->state, context->buffer);
+ for ( ; i + 63 < len; i += 64)
+ SHA1_Transform(context->state, &data[i]);
+ j = 0;
} else {
- i = 0;
+ i = 0;
}
(void)memcpy(&context->buffer[j], &data[i], len - i);
}
@@ -254,18 +254,18 @@ int SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
_DIAGASSERT(context != 0);
for (i = 0; i < 8; i++) {
- finalcount[i] = (uint8_t)((context->count[(i >= 4 ? 0 : 1)]
- >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
+ finalcount[i] = (uint8_t)((context->count[(i >= 4 ? 0 : 1)]
+ >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
}
SHA1_Update(context, (const uint8_t *)"\200", 1);
while ((context->count[0] & 504) != 448)
- SHA1_Update(context, (const uint8_t *)"\0", 1);
+ SHA1_Update(context, (const uint8_t *)"\0", 1);
SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */
if (digest) {
- for (i = 0; i < 20; i++)
- digest[i] = (uint8_t)
- ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
+ for (i = 0; i < 20; i++)
+ digest[i] = (uint8_t)
+ ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
}
return 1;
}