MCPcopy Create free account
hub / github.com/QuipNetwork/cpp-sdk / randomSeed32

Function randomSeed32

src/cli.cpp:102–116  ·  view source on GitHub ↗

Helper: generate a cryptographically secure random 32-byte array

Source from the content-addressed store, hash-verified

100
101// Helper: generate a cryptographically secure random 32-byte array
102static std::array<uint8_t, 32> randomSeed32() {
103 std::array<uint8_t, 32> seed;
104 std::random_device rd;
105
106 // Use multiple random device calls for better entropy
107 for (size_t i = 0; i < 32; i += 4) {
108 uint32_t random_val = rd();
109 seed[i] = static_cast<uint8_t>(random_val & 0xFF);
110 if (i + 1 < 32) seed[i + 1] = static_cast<uint8_t>((random_val >> 8) & 0xFF);
111 if (i + 2 < 32) seed[i + 2] = static_cast<uint8_t>((random_val >> 16) & 0xFF);
112 if (i + 3 < 32) seed[i + 3] = static_cast<uint8_t>((random_val >> 24) & 0xFF);
113 }
114
115 return seed;
116}
117
118// QuipSigner: Deterministic Winternitz keypair generator using quantum secret
119// and vaultId

Callers 2

generateKeyPairMethod · 0.85
handleDepositMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected