Copied TCP impl from other project, basic Block implementation, randomx pow, signing via secp256k1

This commit is contained in:
2026-03-29 17:18:23 +02:00
commit 57bfe61c13
26 changed files with 1775 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
#include <numgen.h>
unsigned char random_byte(void) {
return (unsigned char)(rand() % 256);
}
uint16_t random_two_byte(void) {
uint16_t x;
unsigned char bytes[2];
for (unsigned char i = 0; i < 2; i++) {
bytes[i] = random_byte();
}
memcpy(&x, bytes, sizeof(x));
return x;
}
uint32_t random_four_byte(void) {
uint32_t x;
unsigned char bytes[4];
for (unsigned char i = 0; i < 4; i++) {
bytes[i] = random_byte();
}
memcpy(&x, bytes, sizeof(x));
return x;
}
uint64_t random_eight_byte(void) {
uint64_t x;
unsigned char bytes[8];
for (unsigned char i = 0; i < 8; i++) {
bytes[i] = random_byte();
}
memcpy(&x, bytes, sizeof(x));
return x;
}