summaryrefslogtreecommitdiff
path: root/src/sha1.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-07-01 17:26:23 +0200
committerVicent Marti <tanoku@gmail.com>2011-07-01 17:26:23 +0200
commit17d523041df6247c21160cb19fa0e783ae40e43c (patch)
tree2ee8bdcd51b1eea9b2e23b7a5d2a289d284b1606 /src/sha1.h
parentb2cef77ccf52b1fb55f8e1ca98ada48bbfe90b92 (diff)
downloadlibgit2-17d523041df6247c21160cb19fa0e783ae40e43c.tar.gz
build: Simplify build structure
This will make libgit2 more suitable for embedding.
Diffstat (limited to 'src/sha1.h')
-rw-r--r--src/sha1.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sha1.h b/src/sha1.h
new file mode 100644
index 000000000..558d6aece
--- /dev/null
+++ b/src/sha1.h
@@ -0,0 +1,22 @@
+/*
+ * SHA1 routine optimized to do word accesses rather than byte accesses,
+ * and to avoid unnecessary copies into the context array.
+ *
+ * This was initially based on the Mozilla SHA1 implementation, although
+ * none of the original Mozilla code remains.
+ */
+
+typedef struct {
+ unsigned long long size;
+ unsigned int H[5];
+ unsigned int W[16];
+} blk_SHA_CTX;
+
+void git__blk_SHA1_Init(blk_SHA_CTX *ctx);
+void git__blk_SHA1_Update(blk_SHA_CTX *ctx, const void *dataIn, unsigned long len);
+void git__blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx);
+
+#define SHA_CTX blk_SHA_CTX
+#define SHA1_Init git__blk_SHA1_Init
+#define SHA1_Update git__blk_SHA1_Update
+#define SHA1_Final git__blk_SHA1_Final