MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / transformUUID

Function transformUUID

programs/obfuscator/Obfuscator.cpp:399–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399static void transformUUID(const UUID & src_uuid, UUID & dst_uuid, UInt64 seed)
400{
401 auto src_copy = src_uuid;
402 transformEndianness<std::endian::little, std::endian::native>(src_copy);
403
404 const UInt128 & src = src_copy.toUnderType();
405 UInt128 & dst = dst_uuid.toUnderType();
406
407 SipHash hash;
408 hash.update(seed);
409 hash.update(reinterpret_cast<const char *>(&src), sizeof(UUID));
410
411 /// Saving version and variant from an old UUID
412 dst = hash.get128();
413
414 const UInt64 trace[2] = {0x000000000000f000ull, 0xe000000000000000ull};
415 UUIDHelpers::getLowBytes(dst_uuid) = (UUIDHelpers::getLowBytes(dst_uuid) & (0xffffffffffffffffull - trace[1])) | (UUIDHelpers::getLowBytes(src_uuid) & trace[1]);
416 UUIDHelpers::getHighBytes(dst_uuid) = (UUIDHelpers::getHighBytes(dst_uuid) & (0xffffffffffffffffull - trace[0])) | (UUIDHelpers::getHighBytes(src_uuid) & trace[0]);
417}
418
419class FixedStringModel : public IModel
420{

Callers 1

generateMethod · 0.85

Calls 4

getLowBytesFunction · 0.85
getHighBytesFunction · 0.85
updateMethod · 0.45
get128Method · 0.45

Tested by

no test coverage detected