Brian Smith
028140bb33
Reformat addition chain window building code to better show pattern.
...
Make the 2 digit, `_10`, the first argument to more closely match the
Haskell code in the source article. Align the code into columns to
further clarify the patterns.
2017-09-04 09:23:27 -10:00
Brian Smith
91a7c641c2
Use more efficient addition chain for scalar inversion.
...
Use the addition chain from
https://briansmith.org/ecc-inversion-addition-chains-01#curve25519_scalar_inversion .
In my benchmarking, this consistently runs at least 20% faster.
2017-09-03 17:00:42 -10:00
khyperia
6747133519
Optimize scalar inversion by implementing square()
...
This shows an 11% speedup for invert()
2017-08-21 21:35:26 -07:00
Isis Lovecruft
17290db44c
Update copyright/license headers in source files.
2017-08-15 05:09:20 +00:00
Isis Lovecruft
f2883028dc
Use subtle version 0.2.0.
...
* CLOSES PR#66 https://github.com/isislovecruft/curve25519-dalek/pull/66
2017-08-01 02:22:43 +00:00
Isis Lovecruft
4bcf8bed9d
Move subtle to its own crate.
2017-05-31 21:20:56 +00:00
Isis Lovecruft
674a00df5b
Some rustfmt fixes. I disagreed with all the other ones.
2017-05-28 22:42:09 +00:00
Isis Lovecruft
0c38718346
Rename subtle::arrays_equal_ct() to subtle::arrays_equal().
...
It's already obvious that it's constant-time because it's in the subtle
module.
2017-05-26 22:35:45 +00:00
Henry de Valence
69c62a8a17
Serde Scalar support
2017-05-15 22:40:09 -07:00
Isis Lovecruft
4a646806b8
Merge branch 'feature/scalarmult-lhs' into develop
2017-05-14 09:35:15 +00:00
Isis Lovecruft
61d07693ec
Merge remote-tracking branch 'hdevalence/feature/operator_scalar_mult_r2' into develop
2017-05-14 09:34:45 +00:00
Isis Lovecruft
ae11d4bc76
Merge remote-tracking branch 'hdevalence/feature/vartime-module' into develop
2017-05-14 09:34:14 +00:00
Isis Lovecruft
944e8e1649
Fix and allow some non-snakecased variables in scalar tests.
2017-05-09 00:05:11 +00:00
Isis Lovecruft
9a9959061d
Merge remote-tracking branch 'hdevalence/feature/clippy-fixes' into develop
2017-05-06 00:16:09 +00:00
Isis Lovecruft
8f4114a211
Merge remote-tracking branch 'hdevalence/feature/streamable-hash-to-scalar' into develop
2017-05-05 23:52:59 +00:00
Henry & Isis
c6dc9d318d
Add a helper function to construct a Scalar from a u64
2017-05-03 19:32:31 -07:00
Henry & Isis
7cbb8dd94e
Merge branch 'feature/streamable-hash-to-scalar' into develop
2017-05-03 19:32:09 -07:00
Henry de Valence
b05c897123
Implement operators for Scalars using multiply_add
2017-05-02 22:29:18 -07:00
Henry de Valence
91e11b6318
Change docstring to match the trait bound
2017-05-02 21:22:04 -07:00
Henry de Valence
6ea1d4dad2
Add an implementation of Scalar inversion
2017-04-28 22:59:56 -07:00
Henry de Valence
653f134bc7
Implement Mul, MulAssign, zero(), one() for UnpackedScalar
2017-04-28 22:57:17 -07:00
Henry de Valence
b5ccb42759
Rename lminus1 to l_minus_1
2017-04-28 22:54:00 -07:00
Henry de Valence
057c84abd5
Add a bits() function for scalars
2017-04-28 22:51:32 -07:00
Henry de Valence
7f4b96150d
Remove explicit lifetimes
2017-04-02 23:36:05 +02:00
Henry de Valence
b3041f2adc
Remove unnecessary if statements
2017-04-02 23:27:38 +02:00
Henry de Valence
eca28fd3e8
Refactor Scalar::hash_from_bytes to allow streaming input to the hash.
2017-03-27 04:49:00 -07:00
Isis Lovecruft
5ebbd5dd86
Remove an XXX comment about using something better than array_ref!().
...
It turns out array_ref!() is probably the best way, or, at least, we're
already using it everywhere.
2017-03-17 21:42:58 +00:00
Isis Lovecruft
d549fdc8f9
Whitespace fixes.
2017-03-17 21:42:40 +00:00
Isis Lovecruft
f6930997d2
Make #[feature(test)] depend on #[cfg(all(test, feature = "bench"))].
...
* FIXES Issue #38 :
https://github.com/isislovecruft/curve25519-dalek/pull/38
2017-03-14 01:59:08 +00:00
Isis Lovecruft
3882a41d27
Remove test_ prefix from tests in scalar module.
2017-03-14 01:58:39 +00:00
Isis Lovecruft
4afe4ae37f
Move scalar module benchmarks to separate module.
2017-03-14 01:52:42 +00:00
Henry de Valence
b61ed818b8
Remove all remaining warnings
2017-03-07 01:37:31 -08:00
Isis Lovecruft
f48947fb57
Merge remote-tracking branch 'hdevalence/feature/some-cleanup-tweaks' into develop
2017-02-28 05:50:22 +00:00
Henry de Valence
fe15bc1d0b
Add note on fn main() in doctest
2017-02-27 11:22:07 -08:00
Henry de Valence
a93798d209
Add a function to hash a byte slice to a scalar.
2017-02-27 11:19:06 -08:00
Henry de Valence
e5c0d789fd
Add a Scalar::as_bytes() method.
2017-02-26 15:25:05 -08:00
Henry de Valence
950519b97b
Implement Debug for Scalar
2017-02-26 15:25:05 -08:00
Isis Lovecruft
e4d041836e
Move load3 and load4 to new utils module and remove #[allow(dead_code)].
2017-02-21 06:15:08 +00:00
Isis Lovecruft
6f67a7d716
Rename util module to subtle.
...
* CHANGE subtle module documentation slightly to clarify the module's purpose.
* FIXES issue #25 .
2017-02-21 06:01:22 +00:00
Isis Lovecruft
5308fef210
Add CTEq trait and implement it for Scalar.
2017-02-21 05:44:35 +00:00
Isis Lovecruft
7b57be69fd
Implement constant time equality check for scalars.
2017-02-21 05:41:14 +00:00
Isis Lovecruft
32da4c7d50
Implement Neg for Scalar.
2017-02-21 05:41:14 +00:00
Isis Lovecruft
8c432ef78a
Another obsessive compulsive whitespace fix.
2017-02-21 01:46:01 +00:00
Isis Lovecruft
1e7199dcc4
Remove now unused core::clone::Clone from scalar.
2017-01-27 02:16:30 +00:00
Isis Lovecruft
d88b6c01c4
Merge remote-tracking branch 'tarcieri/no-std' into develop
2017-01-27 02:13:04 +00:00
Isis Lovecruft
39f417f75e
Merge remote-tracking branch 'hdevalence/feature/move-ct-traits' into develop
2017-01-20 21:51:19 +00:00
Tony Arcieri
d08bc7395e
Add #![no_std] ( fixes #16 )
...
Use ::core in lieu of ::std, allowing this crate to be usable in #![no_std]
environments.
Gates features that presently depend on ::std (presently just rand) behind a
"std" cargo feature, which is enabled by default.
2017-01-18 15:16:01 -08:00
Henry de Valence
63e7e9f8de
Implement CTAssignable for Scalar
2017-01-06 12:56:53 -05:00
Henry de Valence
ef2987349f
Add bench for unpacked multiply_add
2016-12-23 13:01:16 -08:00
Henry de Valence
85d4b7e98c
Split the Scalar type into Scalar and UnpackedScalar
...
The Scalar type is stored in memory as an array of bytes. This allows easy
access to the bits of a scalar for Scalar x Point operations, at the cost of
forcing a pack/unpack for Scalar x Scalar. This commit splits the Scalar type
into Scalar (packed) and UnpackedScalar (limbs).
2016-12-23 12:49:00 -08:00
Henry de Valence
e2dfa17879
Add fixme on load3/4 as utilities
2016-12-23 10:03:30 -08:00
Isis Lovecruft
c9b0e45afb
Specify the RNG for Scalar::random.
2016-12-14 05:54:22 +00:00
Henry de Valence
c6b1b497b0
Add benchmark for Scalar::random()
2016-12-09 17:45:54 -08:00
Henry de Valence
d8476fe6cf
Add a Scalar::random() constructor
...
This adds a dependency on the `rand` crate, used to construct an
OS-backed CSPRNG. The implementation in this commit is somewhat
inefficient as it constructs a new OsRng object every time; it might be
better to construct it once. (Seems like a lot of overhead for a few
getrandom(2) calls...)
2016-12-09 17:38:51 -08:00
Isis Lovecruft
387a56fe2c
Initial commit.
2016-12-08 05:12:00 +00:00