Skip to content

Commit 598c094

Browse files
authored
feat: increase RandomCache size from 256 to 4096 bytes (#51)
`random::<N>()` refills a thread-local cache via `PK11_GenerateRandom` (SHA-256 DRBG) each time the cache is exhausted. That can still cause measurable overheads if a lot of random bytes are needed.
1 parent 0ea3df7 commit 598c094

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/p11.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ struct RandomCache {
363363
}
364364

365365
impl RandomCache {
366-
const SIZE: usize = 256;
366+
const SIZE: usize = 4096;
367367
const CUTOFF: usize = 32;
368368

369369
// Const constructor for compile-time initialization in thread_local!.

0 commit comments

Comments
 (0)