Skip to content

Commit 56d554c

Browse files
committed
Assumptions check
1 parent 3c7a251 commit 56d554c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/suites/bandersnatch.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ pub mod edwards {
214214
AffinePoint::new_unchecked(X, Y)
215215
};
216216
}
217+
218+
#[test]
219+
fn check_assumptions() {
220+
use crate::ring::RingSuite;
221+
check_point(BandersnatchSha512Ell2::BLINDING_BASE);
222+
check_point(BandersnatchSha512Ell2::ACCUMULATOR_BASE);
223+
check_point(BandersnatchSha512Ell2::PADDING);
224+
}
217225
}
218226
#[cfg(feature = "ring")]
219227
pub use ring_defs::*;
@@ -224,11 +232,15 @@ pub mod edwards {
224232
#[cfg(test)]
225233
suite_tests!(BandersnatchSha512Ell2);
226234

235+
fn check_point(p: AffinePoint) {
236+
assert!(p.is_on_curve());
237+
assert!(p.is_in_correct_subgroup_assuming_on_curve());
238+
}
239+
227240
#[test]
228241
fn elligator2_hash_to_curve() {
229-
let point = BandersnatchSha512Ell2::data_to_point(b"foo").unwrap();
230-
assert!(point.is_on_curve());
231-
assert!(point.is_in_correct_subgroup_assuming_on_curve());
242+
let p = BandersnatchSha512Ell2::data_to_point(b"foo").unwrap();
243+
check_point(p);
232244
}
233245
}
234246

0 commit comments

Comments
 (0)