UUID

Universal identifier is something I think I will need for my next step.

Boost supplies a couple of useful libraries​ for UUID.

So to get this done one needs to include the libraries (you will need to put brackets around the names):

#include boost/uuid/uuid.hpp
#include boost/uuid/uuid_generators.hpp // generators
#include boost/uuid/uuid_io.hpp // streaming operators etc.​

Then I had to head to stack overflow to find a simple enough example.

boost::uuids::random_generator generator;

boost::uuids::uuid uuid1 = generator();
std::cout << "First UUID: " << uuid1 << std::endl;

boost::uuids::uuid uuid2 = generator();
std::cout << "Second UUID: " << uuid2 << std::endl;

std::cout << "DNS UUID: " << boost::uuids::ns::dns() << std::endl;

This uses a randomly generated seed from the entropy routines from the underlying LINUX. These routines are not necessary cryptological​ secure. But for my purposes, I think I am ok.

The output of this code is this:

​First UUID: 20684e89-013a-49af-a733-c0e3bc9ef199
Second UUID: a43c20ac-4aa0-456e-b810-7cc9b19779f3

So, we can use this to create random created keys that are also unique as they are associated to some degree to the computer and should not repeat. I am still doing some homework in this area, but I thought a short post of UUIDs would be welcomed. I expect to use these as key for each block chain.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s