2024-12-20 13:32:11 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2024, the Ladybird developers.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Span.h>
|
|
|
|
|
|
|
|
|
|
namespace Crypto {
|
|
|
|
|
|
|
|
|
|
void fill_with_secure_random(Bytes);
|
|
|
|
|
|
2025-04-11 17:12:04 -03:00
|
|
|
template<typename T>
|
|
|
|
|
inline T get_secure_random()
|
|
|
|
|
{
|
|
|
|
|
T t;
|
|
|
|
|
fill_with_secure_random({ &t, sizeof(T) });
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 13:32:11 -03:00
|
|
|
}
|