-/*
+/**
+\file
SHA-1 in C
By Steve Reid <sreid@sea-to-sky.net>
100% Public Domain
#include <glib.h>
#include "mono-digest.h"
+#if HAVE_COMMONCRYPTO_COMMONDIGEST_H
+
+/**
+ * mono_sha1_init:
+ */
+void
+mono_sha1_init (MonoSHA1Context* context)
+{
+ CC_SHA1_Init (context);
+}
+
+/**
+ * mono_sha1_update:
+ */
+void
+mono_sha1_update (MonoSHA1Context* context, const guchar* data, guint32 len)
+{
+ CC_SHA1_Update (context, data, len);
+}
+
+/**
+ * mono_sha1_final:
+ */
+void
+mono_sha1_final (MonoSHA1Context* context, unsigned char digest[20])
+{
+ CC_SHA1_Final (digest, context);
+}
+
+#else
/* #include <process.h> */ /* prototype for exit() - JHB */
/* Using return() instead of exit() - SWR */
} CHAR64LONG16;
CHAR64LONG16* block;
#ifdef SHA1HANDSOFF
-static unsigned char workspace[64];
+ unsigned char workspace[64];
block = (CHAR64LONG16*)workspace;
memcpy(block, buffer, 64);
#else
SHA1Transform(context->state, context->buffer);
#endif
}
-
+
+#endif
+
+/**
+ * mono_sha1_get_digest:
+ */
void
mono_sha1_get_digest (const guchar *buffer, gint buffer_size, guchar digest [20])
{
}
+/**
+ * mono_sha1_get_digest_from_file:
+ * \param filename file name
+ * \param digest 20-byte buffer receiving the hash code.
+ *
+ * Get the SHA-1 hash of a file. The result is put in
+ * the 20-byte buffer \p digest.
+ *
+ * If an IO error happens the value in \p digest is not updated.
+ */
void
mono_sha1_get_digest_from_file (const gchar *filename, guchar digest [20])
{
mono_sha1_final (&ctx, digest);
}
-/*
+/**
* mono_digest_get_public_token:
*
* Get the public token from public key data.
- * @token must point to at least 8 bytes of storage.
+ * \p token must point to at least 8 bytes of storage.
*/
void
mono_digest_get_public_token (guchar* token, const guchar *pubkey, guint32 len)