Helper: generate a cryptographically secure random 32-byte array
| 100 | |
| 101 | // Helper: generate a cryptographically secure random 32-byte array |
| 102 | static 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 |
no outgoing calls
no test coverage detected