Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Implement and benchmark windowing point multiplication ops #94

Merged
merged 36 commits into from
Dec 14, 2019
Merged

Commits on Oct 14, 2019

  1. Implement Shr for Scalar

    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.
    CPerezz committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    c8b7aab View commit details
    Browse the repository at this point in the history
  2. Implement into_bits for Scalar

    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`.
    CPerezz committed Oct 14, 2019
    Configuration menu
    Copy the full SHA
    3c9c896 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2019

  1. Implement Display for FieldElement

    This is required by `BenchmarkId::new()` in order
    to print the blackboxed inputs.
    
    Also added `Panic` docs of the `inverse` function.
    CPerezz committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    48698be View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1926af3 View commit details
    Browse the repository at this point in the history
  3. Implement "Shift Left to Right Binary Point Mul"

    This algorithm performs point multiplication in with
    an estimated cost of: `(t*A/2)+tD.
    
    This may improve the status of #93
    CPerezz committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    0e7ceda View commit details
    Browse the repository at this point in the history
  4. Update benchmarks to Criterion v0.3

    Implemented benchmarks for `FieldElement` ops and
    blackboxed the inputs.
    CPerezz committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    4dfe10d View commit details
    Browse the repository at this point in the history
  5. Finnish benchmark update to Criterion v0.3

    Also compared lrbs method against the double_and_add.
    It performs slightly better so it's good news for #93
    CPerezz committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    5c59d18 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    528d0da View commit details
    Browse the repository at this point in the history
  7. Add ristretto benchmarks and finnish refactor.

    This finished the benchmarking refactor.
    CPerezz committed Oct 15, 2019
    Configuration menu
    Copy the full SHA
    6879088 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2019

  1. Implement fast modulo-4 op for Scalar

    This op is a requirement for computing the
    Not Adjacent Form of a number.
    Which is used on the most performant Point
    mul algorithms.
    CPerezz committed Oct 16, 2019
    Configuration menu
    Copy the full SHA
    3e1c1d2 View commit details
    Browse the repository at this point in the history
  2. Optimize mod4 function for Scalar

    It does not even need to turn the `Scalar` into
    bytes. We just apply & 0b0000_0011 to the first
    limb.
    CPerezz committed Oct 16, 2019
    Configuration menu
    Copy the full SHA
    b446445 View commit details
    Browse the repository at this point in the history
  3. Implement NAF computation algorithm

    - Implemented Non-Adjacent transformation algorithm.
    - Implemented conversions from `i8` into `Scalar`.
    - Add tests for both.
    CPerezz committed Oct 16, 2019
    Configuration menu
    Copy the full SHA
    2aa512a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    903f917 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9d4ab5d View commit details
    Browse the repository at this point in the history
  6. Implement binary NAF method for Point mul.

    The benchmarks implemented show an improvement over
    the `double_and_add` method currently used.
    CPerezz committed Oct 16, 2019
    Configuration menu
    Copy the full SHA
    c40f2a8 View commit details
    Browse the repository at this point in the history
  7. Implement mod4() more generically for powers of 2

    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.
    CPerezz committed Oct 16, 2019
    Configuration menu
    Copy the full SHA
    5e325b8 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ef766df View commit details
    Browse the repository at this point in the history
  9. Implement, test & benchmark windowed_naf() function.

    This computes the width-wNAF of a positive integer.
    CPerezz committed Oct 16, 2019
    Configuration menu
    Copy the full SHA
    255f186 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f1910ff View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2019

  1. Configuration menu
    Copy the full SHA
    b579dbf View commit details
    Browse the repository at this point in the history
  2. Remove inlining compiler hints and refactor benchmarks

    - profile.release section created in Cargo.toml
    with optimizations.
    CPerezz committed Oct 18, 2019
    Configuration menu
    Copy the full SHA
    7878f6c View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2019

  1. Refactor Window-w NAF method and implemented tests

    The algorithm now is working so it should be the
    base for the Window-W NAF Point Mul method.
    CPerezz committed Oct 20, 2019
    Configuration menu
    Copy the full SHA
    daa3f53 View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2019

  1. Configuration menu
    Copy the full SHA
    f5376ea View commit details
    Browse the repository at this point in the history
  2. Remove kalinski_inverse function since it's not needed anymore

    Also:
    - refactored benchmarks.
    - removed related tests.
    - Bench all of the point ops benchmarks with
    `RistrettoPoint` inputs.
    CPerezz committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    0ceb707 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    51be815 View commit details
    Browse the repository at this point in the history
  4. Refactor Half and inner_half implementations.

    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.
    CPerezz committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    13d484f View commit details
    Browse the repository at this point in the history
  5. Fork Half impl in two different implementations.

    - `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.
    CPerezz committed Oct 21, 2019
    Configuration menu
    Copy the full SHA
    713cf40 View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2019

  1. Refactor a wrong implementation of Shr for Scalar

    Tests are now passing.
    CPerezz committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    ef51a7e View commit details
    Browse the repository at this point in the history
  2. Optimize legendre_symbol with pre-computed const.

    - 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.
    CPerezz committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    db3440a View commit details
    Browse the repository at this point in the history
  3. Optimized Pow implementation by using fast_even_half

    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.
    CPerezz committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    71f1680 View commit details
    Browse the repository at this point in the history
  4. Refactor Half implementations as done with FieldElement

    Applied the same changes that were done in 13d484f
    but for `Scalar`.
    
    Also left `fast_half_without_modulo` for point mul
    implementations.
    CPerezz committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    fe7a1b4 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2019

  1. Updating paper

    LukePearson1 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    a98f210 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d9be36b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    80bbfb2 View commit details
    Browse the repository at this point in the history
  4. Update paper

    This is the inital
    draft of Sonny.
    LukePearson1 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    7839d20 View commit details
    Browse the repository at this point in the history
  5. Update paper

    Merge branch 'windowing' of https://github.com/dusk-network/dusk-zerocaf into windowing
    LukePearson1 committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    dbd5b70 View commit details
    Browse the repository at this point in the history