mit-dci / opencbdc-tx

A transaction processor for a hypothetical, general-purpose, central bank digital currency
Other
895 stars 200 forks source link

Generate hashes with random keys to avoid collisions #212

Open maurermi opened 1 year ago

maurermi commented 1 year ago

Address TODO in src/util/common/hashmap.hpp which calls for randomly generated hash keys. Requires use of libsodium for crypto-safe random number generation.

NOTE: This causes certain tests to fail currently because of the added randomness. This will be fixed shortly.

maurermi commented 1 year ago

@HalosGhost some tests currently fail with this update because of the added randomness, but wanted to push it here first to get initial thoughts. My main question is whether libsodium is the most appropriate choice here, so if you have thoughts, I'd appreciate hearing them.

maurermi commented 1 year ago

Pushed an update to use random_source() based on /dev/urandom, but this is still very much a work in progress.

@HalosGhost here's some of my thoughts on what to do here -- it might be simplest to specify the generator file in a config file (not to add more dependence on config files), and we could create a predictable RNG for a more authentic testing environment -- then in an actual system outside of the tests we specify /dev/random as the generator