From ffe3a365098bc7577aa66c2ade7413fad532c79d Mon Sep 17 00:00:00 2001 From: Floyd Date: Tue, 20 Aug 2024 16:50:31 +0200 Subject: [PATCH] updated to new cryptanalysislib version --- deps/cryptanalysislib | 2 +- src/bjmm.h | 6 +++--- src/fq/prange.h | 6 +++--- src/fq/sieving.h | 2 +- src/fq/stern.h | 10 +++++----- src/fq/stern_v2.h | 4 +--- src/mitm.h | 2 +- src/prange.h | 2 +- src/stern.h | 10 ++++++---- src/stern_im.h | 1 - tests/mitm.cpp | 20 ++++++++++---------- 11 files changed, 32 insertions(+), 33 deletions(-) diff --git a/deps/cryptanalysislib b/deps/cryptanalysislib index 664e831..d023b29 160000 --- a/deps/cryptanalysislib +++ b/deps/cryptanalysislib @@ -1 +1 @@ -Subproject commit 664e8316f00800a6d76736071ea7ca668ca3a81e +Subproject commit d023b293cb3817425263c254a91135ad801f2218 diff --git a/src/bjmm.h b/src/bjmm.h index d114536..3eac0d7 100644 --- a/src/bjmm.h +++ b/src/bjmm.h @@ -1,7 +1,7 @@ #ifndef DECODING_BJMM_H #define DECODING_BJMM_H -#include "matrix/binary_matrix.h" +#include "matrix/matrix.h" #include "container/hashmap.h" #include "popcount/popcount.h" #include "math/bc.h" @@ -120,8 +120,8 @@ class BJMM : public ISDInstance { constexpr static SimpleHashMapConfig simpleHashMapConfigD2 { HM2_bucketsize, HM2_nrbuckets, config.threads }; - using HM1 = SimpleHashMap>; - using HM2 = SimpleHashMap>; + using HM1 = SimpleHashMap>; + using HM2 = SimpleHashMap>; HM1 *hm1; HM2 *hm2; constexpr static ConfigEnumHashMap configEnum{config}; diff --git a/src/fq/prange.h b/src/fq/prange.h index 8929b62..6526611 100644 --- a/src/fq/prange.h +++ b/src/fq/prange.h @@ -4,7 +4,7 @@ #include "combination/chase.h" #include "helper.h" #include "container/fq_vector.h" -#include "matrix/fq_matrix.h" +#include "matrix/matrix.h" #include "list/list.h" #include "list/enumeration/fq.h" #include "thread/thread.h" @@ -116,8 +116,8 @@ class FqPrange : public ISDInstance { /// start the iterations bool found = G.template run - - (nullptr, nullptr, 0, tid, nullptr, nullptr, &predicate); + + (nullptr, nullptr, 0, 0, tid, nullptr, nullptr, &predicate); if (unlikely(found)) { not_found = false; diff --git a/src/fq/sieving.h b/src/fq/sieving.h index fcf7f88..680dffe 100644 --- a/src/fq/sieving.h +++ b/src/fq/sieving.h @@ -3,7 +3,7 @@ #include "helper.h" #include "container/fq_vector.h" -#include "matrix/fq_matrix.h" +#include "matrix/matrix.h" #include "list/list.h" #include "list/enumeration/fq.h" #include "sort.h" diff --git a/src/fq/stern.h b/src/fq/stern.h index 630755a..fe29519 100644 --- a/src/fq/stern.h +++ b/src/fq/stern.h @@ -3,9 +3,8 @@ #include "helper.h" #include "container/fq_vector.h" -#include "matrix/fq_matrix.h" +#include "matrix/matrix.h" #include "list/list.h" -#include "list/enumeration/fq.h" #include "sort.h" #include "popcount/popcount.h" #include "mitm.h" @@ -51,7 +50,8 @@ class FqStern : public ISDInstance { constexpr static uint32_t enum_length = (k + l) >> 1u; constexpr static uint32_t enum_offset = k + l - enum_length; constexpr static size_t list_size = compute_combinations_fq_chase_list_size(); - using List = Parallel_List_FullElement_T; + // using List = Parallel_List_FullElement_T; + using List = List_T; using Generator = ListEnumerateMultiFullLength; Generator G; List *L1, *L2; @@ -130,12 +130,12 @@ class FqStern : public ISDInstance { } /// - inline void init_list(const uint32_t tid) { + inline void init_list(const uint32_t tid) noexcept { hm->clear(); /// this call simply inits the the list G.template run - (L1, L2, enum_offset, tid, hm, &Compress); + (L1, L2, enum_offset, 0, tid, hm, &Compress); } void find_collisions(const uint32_t tid) { diff --git a/src/fq/stern_v2.h b/src/fq/stern_v2.h index ab7fe7e..5a2131d 100644 --- a/src/fq/stern_v2.h +++ b/src/fq/stern_v2.h @@ -3,10 +3,8 @@ #include "helper.h" #include "container/fq_vector.h" -#include "matrix/fq_matrix.h" +#include "matrix/matrix.h" #include "list/list.h" -#include "list/enumeration/fq.h" -#include "sort.h" #include "popcount/popcount.h" #include "mitm.h" #include "isd.h" diff --git a/src/mitm.h b/src/mitm.h index 568a4e4..2e14b7e 100644 --- a/src/mitm.h +++ b/src/mitm.h @@ -3,7 +3,7 @@ #include #include "combination/chase.h" -#include "matrix/binary_matrix.h" +#include "matrix/matrix.h" #include "container/hashmap.h" #include "popcount/popcount.h" #include "math/bc.h" diff --git a/src/prange.h b/src/prange.h index 11e6295..4f092dd 100644 --- a/src/prange.h +++ b/src/prange.h @@ -3,7 +3,7 @@ #include -#include "matrix/binary_matrix.h" +#include "matrix/matrix.h" #include "container/hashmap.h" #include "popcount/popcount.h" #include "math/bc.h" diff --git a/src/stern.h b/src/stern.h index a1965d6..2240605 100644 --- a/src/stern.h +++ b/src/stern.h @@ -3,7 +3,7 @@ #include -#include "matrix/binary_matrix.h" +#include "matrix/matrix.h" #include "container/hashmap.h" #include "popcount/popcount.h" #include "math/bc.h" @@ -11,6 +11,7 @@ #include "hash/simple.h" #include "mitm.h" #include "isd.h" +#include "random.h" using namespace cryptanalysislib; @@ -104,7 +105,7 @@ class Stern : public ISDInstance { bucketsize, nrbuckets, config.threads }; - using HM = SimpleHashMap>; + using HM = SimpleHashMap>; HM *hm; constexpr static ConfigEnumHashMap configEnum{config}; @@ -219,8 +220,8 @@ class Stern : public ISDInstance { for (size_t cindex = 0; cindex < final_list_current_size/8; cindex++) { ASSERT(cindex < final_list_left.size()); - const uint32x8_t left = uint32x8_t::load(final_list_left256 + cindex); - const uint32x8_t right = uint32x8_t::load(final_list_right256 + cindex); + const uint32x8_t left = uint32x8_t::load((uint32_t *)(final_list_left256 + cindex)); + const uint32x8_t right = uint32x8_t::load((uint32_t *)(final_list_right256 + cindex)); biject_simd(left, rows1); biject_simd(right, rows2); @@ -375,4 +376,5 @@ class Stern : public ISDInstance { << " }" << std::endl; } }; + #endif//DECODING_STERN_H diff --git a/src/stern_im.h b/src/stern_im.h index aa065c5..54d9d6d 100644 --- a/src/stern_im.h +++ b/src/stern_im.h @@ -1,6 +1,5 @@ #ifndef DECODING_STERN_IM_H #define DECODING_STERN_IM_H - #include #include "mitm.h" diff --git a/tests/mitm.cpp b/tests/mitm.cpp index b62de70..c8723f2 100644 --- a/tests/mitm.cpp +++ b/tests/mitm.cpp @@ -20,7 +20,7 @@ TEST(EnumHashMap, alloc) { using V = CollisionType; constexpr static SimpleHashMapConfig s{.bucketsize=10u, .nrbuckets=1u<>; + using HM = SimpleHashMap>; HM *hm = new HM{}; static constexpr ConfigEnumHashMap config{k+l, p, l, 1}; @@ -38,7 +38,7 @@ TEST(EnumHashMap, enumeration_changelist) { using V = CollisionType; constexpr static SimpleHashMapConfig s{.bucketsize=4u, .nrbuckets=1u<>; + using HM = SimpleHashMap>; HM *hm = new HM{}; static constexpr ConfigEnumHashMap config{k+l, p, l, 1, epsilon, false, true}; @@ -83,7 +83,7 @@ TEST(EnumHashMap, enumeration) { using V = CollisionType; constexpr static SimpleHashMapConfig s{.bucketsize=10u, .nrbuckets=1u<>; + using HM = SimpleHashMap>; HM *hm = new HM{}; static constexpr ConfigEnumHashMap config{k+l, p, l, 1, epsilon}; @@ -117,7 +117,7 @@ TEST(EnumHashMap, enumeration_index) { using V = CollisionType; constexpr static SimpleHashMapConfig s{.bucketsize=10u, .nrbuckets=1u<>; + using HM = SimpleHashMap>; HM *hm = new HM{}; static constexpr ConfigEnumHashMap config{k+l, p, l, 1, true}; @@ -149,7 +149,7 @@ TEST(EnumHashMap, multithreaded_enumeration) { using V = CollisionType; constexpr static SimpleHashMapConfig s{.bucketsize=10u, .nrbuckets=1u<>; + using HM = SimpleHashMap>; HM *hm = new HM{}; hm->print(); @@ -190,7 +190,7 @@ TEST(CollisionHashMap, enumeration) { using V = CollisionType; constexpr static SimpleHashMapConfig s{.bucketsize=10u, .nrbuckets=1u<>; + using HM = SimpleHashMap>; using HM_DataType = HM::data_type; using HM_DataType_IndexType = HM_DataType::index_type; HM *hm = new HM{}; @@ -249,7 +249,7 @@ TEST(CollisionHashMap, enumerationSIMD) { using V = CollisionType; constexpr static SimpleHashMapConfig s{.bucketsize=2u, .nrbuckets=1u<>; + using HM = SimpleHashMap>; using HM_DataType = HM::data_type; using HM_DataType_IndexType = HM_DataType::index_type; HM *hm = new HM{}; @@ -348,9 +348,9 @@ TEST(CollisionHashMapD3, enumeration) { constexpr static SimpleHashMapConfig s1{.bucketsize=16u, .nrbuckets=1u<>; - using HM2 = SimpleHashMap>; - using HM3 = SimpleHashMap>; + using HM1 = SimpleHashMap>; + using HM2 = SimpleHashMap>; + using HM3 = SimpleHashMap>; HM1 *hm1 = new HM1{}; HM2 *hm2 = new HM2{}; HM3 *hm3 = new HM3{};