summaryrefslogtreecommitdiff
path: root/ext/digest/sha1
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-07-30 17:03:13 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-07-30 17:03:13 +0900
commit39dc9f9093901d40d2998653948d5da38b18ee2c (patch)
tree5d2d205803a8d0c3fddb824889f5c03b14feaaa9 /ext/digest/sha1
parent8a65cf3b61c60e4cb886f59a73ff6db44364bfa9 (diff)
Revert "* expand tabs. [ci skip]"
This reverts commit 8a65cf3b61c60e4cb886f59a73ff6db44364bfa9.
Diffstat (limited to 'ext/digest/sha1')
-rw-r--r--ext/digest/sha1/sha1.c26
-rw-r--r--ext/digest/sha1/sha1.h6
2 files changed, 16 insertions, 16 deletions
diff --git a/ext/digest/sha1/sha1.c b/ext/digest/sha1/sha1.c
index afe952f8ba..5311227549 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;
}
diff --git a/ext/digest/sha1/sha1.h b/ext/digest/sha1/sha1.h
index e1d01b76ab..2accc46d46 100644
--- a/ext/digest/sha1/sha1.h
+++ b/ext/digest/sha1/sha1.h
@@ -14,9 +14,9 @@
#include "../defs.h"
typedef struct {
- uint32_t state[5];
- uint32_t count[2];
- uint8_t buffer[64];
+ uint32_t state[5];
+ uint32_t count[2];
+ uint8_t buffer[64];
} SHA1_CTX;
#ifdef RUBY