Skip to content

Commit 7d4a684

Browse files
committed
make function public
Signed-off-by: lovesh <[email protected]>
1 parent 05ae532 commit 7d4a684

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "amcl_wrapper"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
authors = ["lovesh harchandani <[email protected]>"]
55
description = "Wapper over Milagro Cryptographic Library (version 3)"
66
repository = "https://github.com/lovesh/amcl_rust_wrapper"

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,28 @@ let poly2 = UnivarPolynomial::random(d);
275275
// Create a polynomial from its roots
276276
let poly3 = UnivarPolynomial::new_with_roots(roots);
277277

278+
// Create a polynomial by passing the coefficients to a macro
279+
let poly4 = univar_polynomial!(
280+
FieldElement::one(),
281+
FieldElement::zero(),
282+
FieldElement::from(87u64),
283+
-FieldElement::one(),
284+
FieldElement::from(300u64)
285+
);
286+
278287
// A polynomial can be evaluated at a field element `v`
279288
let res: FieldElement = poly1.eval(v);
280289

281290
// Polynomials can be added, subtracted, multiplied or divided to give new polynomials
282291
let sum = UnivarPolynomial::sum(&poly1, &poly2);
292+
// Or use operator overloading
293+
let sum = &poly1 + &poly2;
283294
let diff = UnivarPolynomial::difference(&poly1, &poly2);
295+
// Or use operator overloading
296+
let diff = &poly1 - &poly2;
284297
let product = UnivarPolynomial::multiply(&poly1, &poly2);
298+
// Or use operator overloading
299+
let product = &poly1 * &poly2;
285300
let (quotient, rem) = UnivarPolynomial::long_division(&poly1, &poly2);
286301
```
287302

src/group_elem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ macro_rules! impl_group_elem_vec_product_ops {
716716
}
717717

718718
/// Strauss multi-scalar multiplication
719-
fn multi_scalar_mul_var_time_without_precomputation<'g, 'f>(
719+
pub fn multi_scalar_mul_var_time_without_precomputation<'g, 'f>(
720720
group_elems: impl IntoIterator<Item = &'g $group_element>,
721721
field_elems: impl IntoIterator<Item = &'f FieldElement>,
722722
) -> Result<$group_element, ValueError> {

src/univar_poly.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ mod tests {
283283
FieldElement::one(),
284284
FieldElement::zero(),
285285
FieldElement::from(87u64),
286-
FieldElement::minus_one(),
286+
-FieldElement::one(),
287287
FieldElement::from(300u64)
288288
);
289289
assert_eq!(poly.degree(), 4);
@@ -547,7 +547,7 @@ mod tests {
547547
// Test sum and difference of randomly generated polynomials.
548548
let num_test_cases = 100;
549549
let mut rng = rand::thread_rng();
550-
let mut start = Instant::now();
550+
let start = Instant::now();
551551
for _ in 0..num_test_cases {
552552
let left = UnivarPolynomial::random(rng.gen_range(1, 100));
553553
let right = UnivarPolynomial::random(rng.gen_range(1, 100));

0 commit comments

Comments
 (0)