@@ -56,6 +56,7 @@ namespace nil {
56
56
}
57
57
58
58
static inline OutType generate (transcript_type &transcript, std::size_t GrindingBits = 16 ) {
59
+ BOOST_ASSERT_MSG (GrindingBits < 64 , " Grinding parameter should be bits, not mask" );
59
60
output_type mask = GrindingBits > 0 ? ( 1ULL << GrindingBits ) - 1 : 0 ;
60
61
output_type proof_of_work = std::rand ();
61
62
output_type result;
@@ -74,6 +75,7 @@ namespace nil {
74
75
}
75
76
76
77
static inline bool verify (transcript_type &transcript, output_type proof_of_work, std::size_t GrindingBits = 16 ) {
78
+ BOOST_ASSERT_MSG (GrindingBits < 64 , " Grinding parameter should be bits, not mask" );
77
79
transcript (int_be (proof_of_work));
78
80
output_type result = transcript.template int_challenge <output_type>();
79
81
output_type mask = GrindingBits > 0 ? ( 1ULL << GrindingBits ) - 1 : 0 ;
@@ -93,7 +95,7 @@ namespace nil {
93
95
using value_type = typename FieldType::value_type;
94
96
using integral_type = typename FieldType::integral_type;
95
97
96
- static inline value_type generate (transcript_type &transcript, std::size_t GrindingBits= 16 ) {
98
+ static inline value_type generate (transcript_type &transcript, std::size_t GrindingBits = 16 ) {
97
99
static boost::random ::random_device dev;
98
100
static nil::crypto3::random ::algebraic_engine<FieldType> random_engine (dev);
99
101
value_type proof_of_work = random_engine ();
@@ -117,7 +119,7 @@ namespace nil {
117
119
return proof_of_work;
118
120
}
119
121
120
- static inline bool verify (transcript_type &transcript, value_type proof_of_work, std::size_t GrindingBits= 16 ) {
122
+ static inline bool verify (transcript_type &transcript, value_type proof_of_work, std::size_t GrindingBits = 16 ) {
121
123
transcript (proof_of_work);
122
124
integral_type mask =
123
125
(GrindingBits > 0 ?
0 commit comments