From d6e580d43fd6ba511db3c47eed53c64c07d3c734 Mon Sep 17 00:00:00 2001 From: pooler Date: Fri, 24 May 2013 11:19:56 +0200 Subject: [PATCH] Litecoin: Adapt scrypt code to C++ --- src/scrypt.cpp | 4 ++-- src/scrypt.h | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/scrypt.cpp b/src/scrypt.cpp index a7db3e702..da3d0e21b 100644 --- a/src/scrypt.cpp +++ b/src/scrypt.cpp @@ -73,11 +73,11 @@ typedef struct HMAC_SHA256Context { /* Initialize an HMAC-SHA256 operation with the given key. */ static void -HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, const unsigned char *_K, size_t Klen) +HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, const void *_K, size_t Klen) { unsigned char pad[64]; unsigned char khash[32]; - const unsigned char *K = _K; + const unsigned char *K = (const unsigned char *)_K; size_t i; /* If Klen > 64, the key is really SHA256(K). */ diff --git a/src/scrypt.h b/src/scrypt.h index 4f9c2e337..da53b2e7c 100644 --- a/src/scrypt.h +++ b/src/scrypt.h @@ -1,17 +1,9 @@ #ifndef SCRYPT_H #define SCRYPT_H -#ifdef __cplusplus -extern "C" { -#endif - -#define SCRYPT_SCRATCHPAD_SIZE (131072 + 63) +static const int SCRYPT_SCRATCHPAD_SIZE = 131072 + 63; void scrypt_1024_1_1_256_sp(const char *input, char *output, char *scratchpad); void scrypt_1024_1_1_256(const char *input, char *output); -#ifdef __cplusplus -} -#endif - #endif