Introduction
The c++ (cpp) uint160_t example is extracted from the most popular open source projects, you can refer to the following example for usage.
Programming language: C++ (Cpp)
Class/type: uint160_t
Example#1File:
cage.hppProject:
0vermind/libcage
gen_id(uint160_t &id)
{
unsigned char buf[20];
RAND_pseudo_bytes(buf, sizeof(buf));
id.from_binary(buf, sizeof(buf));
seed = *(uint32_t*)buf + time(NULL);
}
Example#2File:
cage.hppProject:
manuels/libcage
gen_id(uint160_t &id)
{
size_t i;
unsigned char buf[20];
RAND_pseudo_bytes(buf, sizeof(buf));
id.from_binary(buf, sizeof(buf));
seed = 0;
for (i = 0; i < sizeof(seed); ++i)
seed += buf[8] << i*8;
seed += time(NULL);
}