Yarilo v0.9.9
WPA2 Decrypter & Packet Analyzer
Loading...
Searching...
No Matches
uuid.h
Go to the documentation of this file.
1#ifndef SNIFF_UUID
2#define SNIFF_UUID
3
4#include <random>
5#include <sstream>
6
7namespace yarilo {
8
9namespace uuid {
10
11typedef std::string UUIDv4;
12
13static std::random_device rd;
14static std::mt19937 gen(rd());
15static std::uniform_int_distribution<> dis(0, 15);
16static std::uniform_int_distribution<> dis2(8, 11);
17
18inline std::string generate_v4() {
19 std::stringstream ss;
20 int i;
21 ss << std::hex;
22 for (i = 0; i < 8; i++) {
23 ss << dis(gen);
24 }
25 ss << "-";
26 for (i = 0; i < 4; i++) {
27 ss << dis(gen);
28 }
29 ss << "-4";
30 for (i = 0; i < 3; i++) {
31 ss << dis(gen);
32 }
33 ss << "-";
34 ss << dis2(gen);
35 for (i = 0; i < 3; i++) {
36 ss << dis(gen);
37 }
38 ss << "-";
39 for (i = 0; i < 12; i++) {
40 ss << dis(gen);
41 };
42 return ss.str();
43}
44
45} // namespace uuid
46
47} // namespace yarilo
48
49#endif SNIFF_UUID
std::string UUIDv4
Definition uuid.h:11
std::string generate_v4()
Definition uuid.h:18
Definition access_point.cpp:22