Contains the public API and documentation for the SCB pseudo-random bytes generator.
More...
|
#define | QSC_SCB_256_SEED_SIZE 32ULL |
| The SCB-256 seed size.
|
|
#define | QSC_SCB_512_SEED_SIZE 64ULL |
| The SCB-512 seed size.
|
|
#define | QSC_SCB_L2CACHE_DEFAULT_SIZE (1024ULL * 256ULL) |
| The default L2 cache size (256 KiB).
|
|
#define | QSC_SCB_MEMORY_COST_SIZE (1024ULL * 1024ULL) |
| The base memory cost of 1 MiB.
|
|
#define | QSC_SCB_MEMORY_MAXIMUM 128ULL |
| The maximum memory cost.
|
|
#define | QSC_SCB_MEMORY_MINIMUM 1ULL |
| The minimum memory cost.
|
|
#define | QSC_SCB_CPU_MINIMUM 1ULL |
| The minimum CPU cost multiplier.
|
|
#define | QSC_SCB_CPU_MAXIMUM 1000ULL |
| The maximum CPU cost multiplier.
|
|
|
QSC_EXPORT_API void | qsc_scb_dispose (qsc_scb_state *ctx) |
| [void] Dispose of the DRBG state.
|
|
QSC_EXPORT_API void | qsc_scb_initialize (qsc_scb_state *ctx, const uint8_t *seed, size_t seedlen, const uint8_t *info, size_t infolen, size_t cpucost, size_t memcost) |
| [void] Initialize the pseudo-random provider state with a seed and optional personalization string.
|
|
QSC_EXPORT_API void | qsc_scb_generate (qsc_scb_state *ctx, uint8_t *output, size_t otplen) |
| [void] Generate pseudo-random bytes using the random provider.
|
|
QSC_EXPORT_API void | qsc_scb_update (qsc_scb_state *ctx, const uint8_t *seed, size_t seedlen) |
| [void] Update the random provider with new keying material.
|
|
Contains the public API and documentation for the SCB pseudo-random bytes generator.
SCB (SHAKE Cost Based Key Derivation Function) is a cost-based KDF that employs the Keccak cSHAKE XOF to generate pseudo-random bytes from a seeded custom SHAKE generator. Depending on the key length, it uses either cSHAKE-256 (for 32-byte keys) or cSHAKE-512 (for 64-byte keys). Additionally, SCB incorporates a cost mechanism with configurable CPU and memory costs to resist brute-force attacks.
- Example Usage:
uint8_t seed[32] = { ... };
uint8_t info[32] = { ... };
uint8_t rnd[200] = { 0 };
qsc_scb_initialize(ctx, seed, sizeof(seed), info, sizeof(info), 2, 1);
qsc_scb_generate(ctx, rnd, sizeof(rnd));
Reference Links: