chore: initial commit (extracted from Launchers monorepo)

Plugin: ns7zip v2.0.0
Architectures: x86-ansi, x86-unicode, amd64-unicode
License: LGPL-2.1-or-later
This commit is contained in:
Simone
2026-04-29 14:07:51 +02:00
commit d074cc7c07
3848 changed files with 1076682 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
// RandGen.h
#ifndef ZIP7_INC_CRYPTO_RAND_GEN_H
#define ZIP7_INC_CRYPTO_RAND_GEN_H
#include "../../../C/Sha256.h"
#ifdef _WIN64
// #define USE_STATIC_SYSTEM_RAND
#endif
#ifdef USE_STATIC_SYSTEM_RAND
#ifdef _WIN32
#include <ntsecapi.h>
#define MY_RAND_GEN(data, size) RtlGenRandom(data, size)
#else
#define MY_RAND_GEN(data, size) getrandom(data, size, 0)
#endif
#else
class CRandomGenerator
{
Byte _buff[SHA256_DIGEST_SIZE];
bool _needInit;
void Init();
public:
CRandomGenerator(): _needInit(true) {}
void Generate(Byte *data, unsigned size);
};
MY_ALIGN (16)
extern CRandomGenerator g_RandomGenerator;
#define MY_RAND_GEN(data, size) g_RandomGenerator.Generate(data, size)
#endif
#endif