Skip to content

Commit 0a58c29

Browse files
committed
Shuffle signature hashing via random seed
1 parent e7f8ae3 commit 0a58c29

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/data/htn_instance.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ HtnInstance::HtnInstance(Parameters& params) :
1515
_params(params), _p(*parse(params.getDomainFilename(), params.getProblemFilename())),
1616
_share_q_constants(_params.isNonzero("sqq")) {
1717

18+
// Transfer random seed to the hash function for any kind of signature
19+
USignatureHasher::seed = _params.getIntParam("s");
20+
1821
Log::i("Parser finished.\n");
1922

2023
Names::init(_name_back_table);

src/data/signature.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,5 @@ Signature& Signature::operator=(Signature&& sig) {
8585
_negated = sig._negated;
8686
return *this;
8787
}
88+
89+
int USignatureHasher::seed = 1;

src/data/signature.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ struct PositionedUSig {
9797
};
9898

9999
struct USignatureHasher {
100+
static int seed;
100101
inline std::size_t operator()(const USignature& s) const {
101-
size_t hash = s._args.size();
102+
size_t hash = seed + s._args.size();
102103
for (const int& arg : s._args) {
103104
hash_combine(hash, arg);
104105
}

0 commit comments

Comments
 (0)