mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-15 20:38:23 +01:00
Add OpenSSL dependency and implement MD5 hash function
This commit is contained in:
parent
6abf18ae73
commit
7828b00268
@ -21,6 +21,7 @@ get_poet_version()
|
||||
find_package(MPI REQUIRED)
|
||||
find_package(OpenMP)
|
||||
find_package(RRuntime REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(bench)
|
||||
|
||||
@ -20,6 +20,7 @@ target_link_libraries(poetlib PUBLIC
|
||||
PhreeqcRM
|
||||
tug
|
||||
DHT_UCX
|
||||
OpenSSL::Crypto
|
||||
)
|
||||
|
||||
target_compile_definitions(poetlib PUBLIC STRICT_R_HEADERS OMPI_SKIP_MPICXX)
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "DHT_Wrapper.hpp"
|
||||
#include "DHT_ucx/UCX_bcast_functions.h"
|
||||
#include "HashFunctions.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@ -62,7 +63,7 @@ DHT_Wrapper::DHT_Wrapper(MPI_Comm dht_comm, std::uint64_t dht_size,
|
||||
.key_size = static_cast<int>(key_size),
|
||||
.data_size = static_cast<int>(data_size),
|
||||
.bucket_count = static_cast<unsigned int>(buckets_per_process),
|
||||
.hash_func = &poet::Murmur2_64A,
|
||||
.hash_func = &poet::md5_sum,
|
||||
.bcast_func = UCX_INIT_BSTRAP_MPI,
|
||||
.bcast_func_args = &ucx_bcast_mpi_args};
|
||||
dht_object = DHT_create(&dht_init);
|
||||
|
||||
@ -25,6 +25,9 @@
|
||||
*/
|
||||
|
||||
#include "HashFunctions.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
@ -93,3 +96,21 @@ uint64_t poet::Murmur2_64A(int len, const void *key) {
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
uint64_t poet::md5_sum(int len, const void *key) {
|
||||
MD5_CTX ctx;
|
||||
unsigned char sum[MD5_DIGEST_LENGTH];
|
||||
uint64_t retval;
|
||||
uint64_t *v1;
|
||||
uint64_t *v2;
|
||||
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, key, len);
|
||||
MD5_Final(sum, &ctx);
|
||||
|
||||
v1 = (uint64_t *)&sum[0];
|
||||
v2 = (uint64_t *)&sum[8];
|
||||
retval = *v1 ^ *v2;
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -31,6 +31,7 @@ namespace poet {
|
||||
constexpr uint32_t HASH_SEED = 80 + 79 + 69 + 84;
|
||||
|
||||
uint64_t Murmur2_64A(int len, const void *key);
|
||||
uint64_t md5_sum(int len, const void *key);
|
||||
|
||||
} // namespace poet
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user