Merge mining donation support

This commit is contained in:
SChernykh
2025-05-08 19:25:48 +02:00
parent 9abe993bb0
commit 70298cd065
30 changed files with 836 additions and 69 deletions

View File

@@ -21,6 +21,14 @@
#include <memory.h>
/****************************** MACROS ******************************/
typedef struct {
uint8_t data[64];
uint32_t datalen;
uint32_t padding;
uint64_t bitlen;
uint32_t state[8];
} SHA256_CTX;
#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b))))
#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b))))
@@ -85,7 +93,7 @@ static void sha256_transform(SHA256_CTX *ctx, const uint8_t* data)
ctx->state[7] += h;
}
void sha256_init(SHA256_CTX *ctx)
static void sha256_init(SHA256_CTX *ctx)
{
ctx->datalen = 0;
ctx->bitlen = 0;
@@ -99,7 +107,7 @@ void sha256_init(SHA256_CTX *ctx)
ctx->state[7] = 0x5be0cd19;
}
void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len)
static void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len)
{
uint32_t i;
@@ -114,7 +122,7 @@ void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len)
}
}
void sha256_final(SHA256_CTX *ctx, uint8_t* hash)
static void sha256_final(SHA256_CTX *ctx, uint8_t* hash)
{
uint32_t i;

View File

@@ -16,22 +16,6 @@ extern "C" {
/*************************** HEADER FILES ***************************/
#include <stdint.h>
/****************************** MACROS ******************************/
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
typedef struct {
uint8_t data[64];
uint32_t datalen;
uint32_t padding;
uint64_t bitlen;
uint32_t state[8];
} SHA256_CTX;
/*********************** FUNCTION DECLARATIONS **********************/
void sha256_init(SHA256_CTX *ctx);
void sha256_update(SHA256_CTX *ctx, const uint8_t* data, uint32_t len);
void sha256_final(SHA256_CTX *ctx, uint8_t* hash);
void sha256(const void* data, uint32_t len, uint8_t* hash);
#ifdef __cplusplus