11enum ModeFunction {
2- Benchmark , Matching , Leading , Range , Mirror , Doubles , LeadingRange
2+ Benchmark , ZeroBytes , Matching , Leading , Range , Mirror , Doubles , LeadingRange
33};
44
55typedef struct {
@@ -18,6 +18,7 @@ __kernel void eradicate2_iterate(__global result * const pResult, __global const
1818void eradicate2_result_update (const uchar * const hash , __global result * const pResult , const uchar score , const uchar scoreMax , const uint deviceIndex , const uint round );
1919void eradicate2_score_leading (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2020void eradicate2_score_benchmark (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
21+ void eradicate2_score_zerobytes (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2122void eradicate2_score_matching (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2223void eradicate2_score_range (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
2324void eradicate2_score_leadingrange (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round );
@@ -40,14 +41,18 @@ __kernel void eradicate2_iterate(__global result * const pResult, __global const
4041 sha3_keccakf (& h );
4142
4243 /* enum class ModeFunction {
43- * Benchmark, Matching, Leading, Range, Mirror, Doubles, LeadingRange
44+ * Benchmark, ZeroBytes, Matching, Leading, Range, Mirror, Doubles, LeadingRange
4445 * };
4546 */
4647 switch (pMode -> function ) {
4748 case Benchmark :
4849 eradicate2_score_benchmark (h .b + 12 , pResult , pMode , scoreMax , deviceIndex , round );
4950 break ;
5051
52+ case ZeroBytes :
53+ eradicate2_score_zerobytes (h .b + 12 , pResult , pMode , scoreMax , deviceIndex , round );
54+ break ;
55+
5156 case Matching :
5257 eradicate2_score_matching (h .b + 12 , pResult , pMode , scoreMax , deviceIndex , round );
5358 break ;
@@ -126,6 +131,17 @@ void eradicate2_score_benchmark(const uchar * const hash, __global result * cons
126131 eradicate2_result_update (hash , pResult , score , scoreMax , deviceIndex , round );
127132}
128133
134+ void eradicate2_score_zerobytes (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round ) {
135+ const size_t id = get_global_id (0 );
136+ int score = 0 ;
137+
138+ for (int i = 0 ; i < 20 ; ++ i ) {
139+ score += !hash [i ];
140+ }
141+
142+ eradicate2_result_update (hash , pResult , score , scoreMax , deviceIndex , round );
143+ }
144+
129145void eradicate2_score_matching (const uchar * const hash , __global result * const pResult , __global const mode * const pMode , const uchar scoreMax , const uint deviceIndex , const uint round ) {
130146 const size_t id = get_global_id (0 );
131147 int score = 0 ;
0 commit comments