mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 21:26:22 +00:00
LibJS/LibCrypto: Cleanup JS Math random() RNG
This commit adds a convenience method to secure random for initializing single types. It changes the random number generator in JS math random() to use newer constants by the author as well as initializes it with a higher quality seed.
This commit is contained in:
parent
a01d6ba246
commit
d60543c2cb
Notes:
github-actions[bot]
2025-05-15 13:42:08 +00:00
Author: https://github.com/R-Goc
Commit: d60543c2cb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4281
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/gmta
2 changed files with 19 additions and 6 deletions
|
@ -12,4 +12,12 @@ namespace Crypto {
|
|||
|
||||
void fill_with_secure_random(Bytes);
|
||||
|
||||
template<typename T>
|
||||
inline T get_secure_random()
|
||||
{
|
||||
T t;
|
||||
fill_with_secure_random({ &t, sizeof(T) });
|
||||
return t;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue