File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-1240 Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -113,3 +113,26 @@ void broadcastNodes(int *v) {
113
113
// This function has "cast" and "des" in the name.
114
114
COMPUTE (v)
115
115
}
116
+
117
+ #define ROTATE (val, amount ) ( (val << amount) | (val >> (32 - amount)) )
118
+
119
+ static inline void hashMix (const int *data, int &state) {
120
+ // This function looks like part of a hashing function. It's not necessarily intended to
121
+ // be a cryptographic hash, so should not be flagged.
122
+ state ^= data[0 ];
123
+ ROTATE (state, 1 );
124
+ state ^= data[1 ];
125
+ ROTATE (state, 7 );
126
+ state ^= data[2 ];
127
+ ROTATE (state, 11 );
128
+ state ^= data[3 ];
129
+ ROTATE (state, 3 );
130
+ state ^= data[4 ];
131
+ ROTATE (state, 13 );
132
+ state ^= data[5 ];
133
+ ROTATE (state, 5 );
134
+ state ^= data[6 ];
135
+ ROTATE (state, 2 );
136
+ state ^= data[7 ];
137
+ ROTATE (state, 17 );
138
+ }
You can’t perform that action at this time.
0 commit comments