Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
CryptoRandom.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef _CRYPTORANDOM_H
7#define _CRYPTORANDOM_H
8
9#include "Define.h"
10#include <array>
11
12namespace SkyFire::Crypto
13{
14 void GetRandomBytes(uint8* buf, size_t len);
15
16 template <typename Container>
17 void GetRandomBytes(Container& c)
18 {
19 GetRandomBytes(std::data(c), std::size(c));
20 }
21
22 template <size_t S>
23 std::array<uint8, S> GetRandomBytes()
24 {
25 std::array<uint8, S> arr;
26 GetRandomBytes(arr);
27 return arr;
28 }
29}
30
31#endif
std::uint8_t uint8
Definition Define.h:79
std::array< uint8, S > GetRandomBytes()