summaryrefslogtreecommitdiffstats
path: root/libopkg/sha256.h
diff options
context:
space:
mode:
Diffstat (limited to 'libopkg/sha256.h')
-rw-r--r--libopkg/sha256.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/libopkg/sha256.h b/libopkg/sha256.h
index c53277d..858d319 100644
--- a/libopkg/sha256.h
+++ b/libopkg/sha256.h
@@ -17,7 +17,7 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef SHA256_H
-# define SHA256_H 1
+#define SHA256_H
# include <stdio.h>
# include <stdint.h>
@@ -29,14 +29,12 @@ extern "C" {
/* Structure to save state of computation between the single steps. */
struct sha256_ctx
{
- uint32_t state[8];
-
- uint32_t total[2];
- uint32_t buflen;
- uint32_t buffer[32];
+ uint32_t state[8];
+ uint32_t total[2];
+ uint32_t buflen;
+ uint32_t buffer[32];
};
-
/* Initialize structure containing state of computation. */
extern void sha256_init_ctx (struct sha256_ctx *ctx);
extern void sha224_init_ctx (struct sha256_ctx *ctx);
@@ -56,7 +54,7 @@ extern void sha256_process_bytes (const void *buffer, size_t len,
struct sha256_ctx *ctx);
/* Process the remaining bytes in the buffer and put result from CTX
- in first 32 (28) bytes following RESBUF. The result is always in little
+ in first 32 (28) bytes following RESBUF. The result is always in little
endian byte order, so that a byte-wise output yields to the wanted
ASCII representation of the message digest.
@@ -65,8 +63,7 @@ extern void sha256_process_bytes (const void *buffer, size_t len,
extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
-
-/* Put result from CTX in first 32 (28) bytes following RESBUF. The result is
+/* Put result from CTX in first 32 (28) bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest.
@@ -75,14 +72,13 @@ extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
extern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
-
/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
resulting message digest number will be written into the 32 (28) bytes
beginning at RESBLOCK. */
extern int sha256_stream (FILE *stream, void *resblock);
extern int sha224_stream (FILE *stream, void *resblock);
-/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The
+/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
@@ -93,4 +89,4 @@ extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
}
#endif
-#endif
+#endif /* SHA256_H */