This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Implement and benchmark windowing point multiplication ops #94
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This operation is needed in order to implement high-speed Point multiplication algorithms. - Refactored `two_pow_k` impl for `Scalar` which wasn't working propperly.
It gives the bit-representation of the given `Scalar` as an array of 256 bits represented as u8's. This method is useful in order to implement other algorithms that require binary decomposition of a given `Scalar`.
This is required by `BenchmarkId::new()` in order to print the blackboxed inputs. Also added `Panic` docs of the `inverse` function.
This algorithm performs point multiplication in with an estimated cost of: `(t*A/2)+tD. This may improve the status of #93
Implemented benchmarks for `FieldElement` ops and blackboxed the inputs.
Also compared lrbs method against the double_and_add. It performs slightly better so it's good news for #93
This finished the benchmarking refactor.
This op is a requirement for computing the Not Adjacent Form of a number. Which is used on the most performant Point mul algorithms.
It does not even need to turn the `Scalar` into bytes. We just apply & 0b0000_0011 to the first limb.
- Implemented Non-Adjacent transformation algorithm. - Implemented conversions from `i8` into `Scalar`. - Add tests for both.
The benchmarks implemented show an improvement over the `double_and_add` method currently used.
Now the function takes not just the `Scalar` but also a the exponent of a power of 2. Then it computes `Scalar (mod 2^exponent)`. The exponent has to be <= 256.
This computes the width-wNAF of a positive integer.
- profile.release section created in Cargo.toml with optimizations.
The algorithm now is working so it should be the base for the Window-W NAF Point Mul method.
Also: - refactored benchmarks. - removed related tests. - Bench all of the point ops benchmarks with `RistrettoPoint` inputs.
We got rid of them both and applyed a simple pre-computed constant which is `1/2 (mod l)` so we just need to multiply the `FieldElement` by the constant and we directly get it's half. Everything has been reduced to the `Half` implementation now.
- `fast_even_half` should be used for even `FieldElements` only and performs almost 4x faster than the `Half` trait impl. - `Half` trait should be used when we don't know if the `FieldElement` will be even or not. - Implemented benchmarks for both functions that implement the same operation. - Modified `mod_sqrt()` implementation to work with the fast `half` implementation.
Tests are now passing.
- Defined `MINUS_ONE_HALF` on constants in order to not perform an operation for which we know the result previously on every `legendre_symbol` call. - Refactored the function with the constant usage. - Refactored some doc-comments on `FieldElement` functions.
Since the algorithm allows you to just divide by two even numbers but it also manages to get always even numbers, we can apply `fast_even_half` every iteration.
Applied the same changes that were done in 13d484f but for `Scalar`. Also left `fast_half_without_modulo` for point mul implementations.
This is the inital draft of Sonny.
Merge branch 'windowing' of https://github.com/dusk-network/dusk-zerocaf into windowing
CPerezz
added
enhancement
New feature or request
testing
This feature requires to be tested.
speed_improvement
New implementation or changes that speed up existing processes.
labels
Dec 14, 2019
Codecov Report
@@ Coverage Diff @@
## master #94 +/- ##
==========================================
+ Coverage 98.82% 99.55% +0.73%
==========================================
Files 5 5
Lines 3476 4082 +606
==========================================
+ Hits 3435 4064 +629
+ Misses 41 18 -23
Continue to review full report at Codecov.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
enhancement
New feature or request
speed_improvement
New implementation or changes that speed up existing processes.
testing
This feature requires to be tested.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update benches to
Criterion v0.3
.Implemented:
into_bits()
forScalar
.mod_4()
forScalar
.Scalar
.Half
,Pow
andlegendre_symbol()
forFieldElement
andScalar
.Shr
implementation forScalar
.Implemented and benchmarked
Closes #93 & #94 & #92