diff options
author | George Hazan <george.hazan@gmail.com> | 2015-09-01 18:06:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-09-01 18:06:33 +0000 |
commit | 981c8fa2b7348484507ff13488ace6db2c79b611 (patch) | |
tree | dd4c3ea94c51befc63b3524ab8715361890ce72c /include/m_core.h | |
parent | c16bd3d58396036f078282ad0b7032562c0c0533 (diff) |
sha256 functions moved to the core
git-svn-id: http://svn.miranda-ng.org/main/trunk@15137 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_core.h')
-rw-r--r-- | include/m_core.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/m_core.h b/include/m_core.h index 02acf94b85..0634c63d7a 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -342,12 +342,13 @@ MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const TCHAR *ptszFileName); #define MIR_SHA1_HASH_SIZE 20
-typedef struct {
+struct mir_sha1_ctx
+{
ULONG H[5];
ULONG W[80];
int lenW;
ULONG sizeHi, sizeLo;
-} mir_sha1_ctx;
+};
MIR_CORE_DLL(void) mir_sha1_init(mir_sha1_ctx *ctx);
MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, const BYTE *dataIn, int len);
@@ -357,6 +358,24 @@ MIR_CORE_DLL(void) mir_sha1_hash(BYTE *dataIn, int len, BYTE hashout[MIR_SHA1_HA MIR_CORE_DLL(void) mir_hmac_sha1(BYTE hashout[MIR_SHA1_HASH_SIZE], const BYTE *key, size_t keylen, const BYTE *text, size_t textlen);
///////////////////////////////////////////////////////////////////////////////
+// sha256 functions
+
+#define MIR_SHA256_HASH_SIZE 32
+
+struct SHA256_CONTEXT
+{
+ UINT32 h0, h1, h2, h3, h4, h5, h6, h7;
+ UINT32 nblocks;
+ BYTE buf[64];
+ int count;
+};
+
+MIR_CORE_DLL(void) mir_sha256_init(SHA256_CONTEXT *ctx);
+MIR_CORE_DLL(void) mir_sha256_write(SHA256_CONTEXT *ctx, const void *dataIn, size_t len);
+MIR_CORE_DLL(void) mir_sha256_final(SHA256_CONTEXT *ctx, BYTE hashout[MIR_SHA256_HASH_SIZE]);
+MIR_CORE_DLL(void) mir_sha256_hash(const void *dataIn, size_t len, BYTE hashout[MIR_SHA256_HASH_SIZE]);
+
+///////////////////////////////////////////////////////////////////////////////
// strings
MIR_CORE_DLL(void*) mir_base64_decode(const char *input, unsigned *outputLen);
|