🐛 xxhash added

This commit is contained in:
EntireTwix 2021-04-12 20:12:23 -07:00
parent 8cb4702825
commit 318ebc07bb
2 changed files with 4 additions and 4 deletions

View file

@ -10,8 +10,8 @@ set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_CXX_FLAGS_RELEASE "-O3")
find_package( Threads ) find_package(Threads)
add_executable(${PROJECT_NAME} main.cpp) add_executable(${PROJECT_NAME} main.cpp include/xxhash.c)
target_include_directories(${PROJECT_NAME} PUBLIC include) target_include_directories(${PROJECT_NAME} PUBLIC include)
target_include_directories(${PROJECT_NAME} PUBLIC third_party) target_include_directories(${PROJECT_NAME} PUBLIC third_party)

View file

@ -2,7 +2,7 @@
#include <fstream> #include <fstream>
#include <shared_mutex> #include <shared_mutex>
#include <vector> #include <vector>
#include <xxh3.h> #include "xxhash.h"
#include "parallel-hashmap/parallel_hashmap/phmap.h" #include "parallel-hashmap/parallel_hashmap/phmap.h"
#include "user.hpp" #include "user.hpp"
@ -137,7 +137,7 @@ public:
res = (u.password == XXH64(attempt.data(), attempt.size(), 0)); res = (u.password == XXH64(attempt.data(), attempt.size(), 0));
if (res) if (res)
{ {
u.password = std::hash<std::string>{}(new_pass); u.password = XXH64(new_pass.data(), new_pass.size(), 0);
} }
}); });
return res; return res;