Because of the platform access, the platform provides a string key as the user ID, and distributed is required, so the user ID cannot be incremental with the previous database, therefore, crc64 is used to generate uint64_t as the user ID, which is also relatively simple. Casino:
STD: Map <size_t, size_t> xlongmap; char sztemp [128] = {0}; Boost: crc_optimal <64, 0x04c11db7, 0, 0, false, false> CRC; for (uint32_t I = 0; I <1000000000; ++ I) {memset (sztemp, 0, sizeof (sztemp); sprintf_s (sztemp, "% d % S % s", I, "1a2b3c", "4d5e6f", "7g8h9i"); CRC. process_bytes (sztemp, strlen (sztemp); size_t NPOs = CRC. checksum (); CRC. reset (); If (! Xlongmap. insert (STD: Map <size_t, size_t>: value_type (NPOs, 0 )). second) {STD: cout <"repeated, current quantity:" <I <", string:" <sztemp <", hash pos: "<NPOs <STD: Endl; System (" pause "); break ;}}
Must contain boost/CRC. HPP
In the test, there were no duplicates in 0.13 billion, which was quite powerful.
Unfortunately, this algorithm is not used later, because the key contains URL escape, resulting in % such characters, and other methods are used later.
Use boost for crc64 computing