#pragma once #include #include #include namespace llarp::win32 { /// @brief given a container of data hash it and make it into a GUID so we have a way to /// deterministically generate GUIDs template inline GUID MakeDeterministicGUID(Data data) { ShortHash h{}; auto hash = [&h](auto data) { CryptoManager::instance()->shorthash(h, data); }; if constexpr (std::is_same_v) hash(llarp_buffer_t{reinterpret_cast(data.data()), data.size()}); else hash(llarp_buffer_t{data}); GUID guid{}; std::copy_n( h.begin(), std::min(sizeof(GUID), sizeof(ShortHash)), reinterpret_cast(&guid)); return guid; } } // namespace llarp::win32