Bitcoin Core  21.99.0
P2P Digital Currency
getuniquepath.cpp
Go to the documentation of this file.
1 #include <random.h>
2 #include <fs.h>
3 #include <util/strencodings.h>
4 
5 fs::path GetUniquePath(const fs::path& base)
6 {
8  fs::path tmpFile = base / HexStr(rnd.randbytes(8));
9  return tmpFile;
10 }
fs.h
FastRandomContext::randbytes
std::vector< unsigned char > randbytes(size_t len)
Generate random bytes.
Definition: random.cpp:626
strencodings.h
random.h
HexStr
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
Definition: strencodings.cpp:594
GetUniquePath
fs::path GetUniquePath(const fs::path &base)
Helper function for getting a unique path.
Definition: getuniquepath.cpp:5
FastRandomContext
Fast randomness source.
Definition: random.h:119