//+------------------------------------------------------------------+ //| XXHash.mqh | //| Copyright 2026, Niquel Mendoza. | //| https://www.mql5.com/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Niquel Mendoza." #property link "https://www.mql5.com/" #property strict #ifndef SIMPHASH_SRC_HASH_STR_XXHASH_MQH #define SIMPHASH_SRC_HASH_STR_XXHASH_MQH //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ #include "..\\Def.mqh" //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ namespace TSN { //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class CHashXXHash : public IHashGenerator { private: ulong m_seed; public: CHashXXHash(void) {} ~CHashXXHash(void) {} //--- bool Init(CYmlNode& node) override final { m_seed = ulong(node["seed"].ToInt(123123ULL)); return true; } //--- ulong Hash(const string& key) override final { return TSN::XSTR::XXH64(key, StringLen(key), m_seed); } //--- void AddIncludes(string& data) override final { data += "#include \r\n"; } //--- void BuildString(string& data) override final { data += "//---\r\n"; data += " const int len = StringLen(key);\r\n"; data += " ulong key_hash = TSN::XSTR::XXH64(key, len, " + string(m_seed) + "ULL);\r\n"; data += "\r\n"; } }; //+------------------------------------------------------------------+ } //+------------------------------------------------------------------+ #endif // SIMPHASH_SRC_HASH_STR_XXHASH_MQH