summaryrefslogtreecommitdiffstats
path: root/sha256.h
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2010-07-09 12:32:17 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2010-07-09 12:32:17 +0200
commit6c027b4de25a529908be895e7ff19236f4002a57 (patch)
treef70d3a400bbb9ba8a83e9d4ffcaa4b6e367fc8bb /sha256.h
downloadcrypto-6c027b4de25a529908be895e7ff19236f4002a57.zip
crypto-6c027b4de25a529908be895e7ff19236f4002a57.tar.gz
initial commit, resurrect one of my realy old projects
Diffstat (limited to 'sha256.h')
-rw-r--r--sha256.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/sha256.h b/sha256.h
new file mode 100644
index 0000000..fa98d42
--- /dev/null
+++ b/sha256.h
@@ -0,0 +1,28 @@
+/*
+ * An implementation of the SHA-256 hash function, this is endian neutral
+ * so should work just about anywhere.
+ *
+ * Revised Code: Complies to SHA-256 standard now.
+ *
+ * Tom St Denis -- http://tomstdenis.home.dhs.org
+ */
+
+#ifndef _SHA256_
+#define _SHA256_
+
+#include "uint.h"
+
+#define SHA256_DIGEST_SIZE 32
+
+struct sha256_ctx{
+ unsigned long state[8], length, curlen;
+ unsigned char buf[64];
+};
+
+void sha256_init(void *ctx);
+
+void sha256_update(void *ctx, const u8 *data, unsigned int len);
+
+void sha256_final(void *ctx, u8 *out);
+
+#endif