Mark Spanbroek
457b8623be
Add usage example to Readme
...
- unit test that example code works
- fixes for said unit test
2023-11-13 11:46:45 +01:00
Mark Spanbroek
70c03b834f
Add Sponge.digest() call that takes bytes
2023-11-13 11:46:45 +01:00
Mark Spanbroek
d8a176930d
Pad byte sequences with 0x1
...
To ensure unique field elements for sequences that
end with 0x0.
2023-11-13 11:46:45 +01:00
Mark Spanbroek
ce1d79a59b
Streaming API for converting bytes to field elements
2023-11-13 11:46:45 +01:00
Mark Spanbroek
fd260207b2
Remove unused import
2023-11-13 11:46:45 +01:00
Mark Spanbroek
4825c0a88c
Add streaming API for sponge
2023-11-13 11:46:45 +01:00
Mark Spanbroek
3cbd9a3a4c
Fix merkle root of odd number of elements
2023-11-13 11:40:35 +01:00
Mark Spanbroek
9c1d18e1a2
Address review comments
...
Co-Authored-By: Dmitriy Ryajov <dryajov@gmail.com>
2023-11-13 11:40:01 +01:00
Balazs Komuves
f5835d5fdc
add domain separation for the sponge construction
2023-11-13 11:40:01 +01:00
Balazs Komuves
01aa256970
minor improvements
2023-11-13 11:40:01 +01:00
Balazs Komuves
929793b9ad
add sponge construction
2023-11-13 11:40:01 +01:00
Mark Spanbroek
573a77f14f
Export conversion of field elements to bytes on main API
2023-11-08 11:13:45 +01:00
Mark Spanbroek
dbe3d8a692
Rename marshal -> toBytes, unmarshal -> fromBytes
...
For two reasons:
- to distinguish them from the marshalling functions
from constantine
- they do not follow the convention that something
that is marshalled can be unmarshalled, because
they take in 31 bytes but produce 32 bytes
2023-11-08 11:13:45 +01:00
Mark Spanbroek
1c7c5d4ec4
Conversion of field elements into bytes
2023-11-08 11:13:45 +01:00
Mark Spanbroek
5e980dd816
Document conversion of bytes into field elements
2023-11-02 09:31:10 +01:00
Mark Spanbroek
03ed357ca4
Only support unmarshalling of little-endian bytes
...
Big-endian bytes had weird padding; 0's to the right,
then a single 0 to the left.
2023-11-02 09:31:10 +01:00
Mark Spanbroek
10b4a3659a
Pad big endian bytes with 0's to the right
2023-11-02 09:31:10 +01:00
Mark Spanbroek
996a1c8a7a
Ensure that we don't have any side-effects
...
Required for integration into libp2p, and a
good idea in general :)
2023-11-02 09:31:10 +01:00
Mark Spanbroek
43c2aab913
move unmarshal into its own module called 'io'
...
Includes separate tests for unmarshalling that
were previously tested as part of the merkleRoot
calculation.
Includes tests for unmarshalling little endian
and big endian byte arrays.
2023-11-02 09:31:10 +01:00
Mark Spanbroek
e19a08e6c3
Test merkleRoot() against reference
...
Co-Authored-By: Balazs Komuves <bkomuves@gmail.com>
2023-11-02 09:31:10 +01:00
Mark Spanbroek
4668f09496
Determine merkle root of byte arrays
2023-11-02 09:31:10 +01:00
Mark Spanbroek
40eac466e2
Add installation instructions to Readme
2023-10-26 09:52:28 +02:00
Mark Spanbroek
331a68e4bd
Add continous integration through Github actions
2023-10-26 09:52:28 +02:00
Mark Spanbroek
1d9d0d1f54
Perform string to array conversion at compiletime
2023-10-26 09:52:28 +02:00
Mark Spanbroek
0e91bea0f6
Convert under_scores to camelCase
2023-10-26 09:52:28 +02:00
Mark Spanbroek
f73bce6aa1
convert visual inspection tests to unit tests
2023-10-26 09:52:28 +02:00
Mark Spanbroek
b72c92639b
Fix imports
2023-10-26 09:52:28 +02:00
Mark Spanbroek
0cdbed1dc2
Remove trailing whitespace
2023-10-26 09:52:28 +02:00
Mark Spanbroek
5220f372c1
Add nimble dependency on constantine
2023-10-26 09:52:28 +02:00
Mark Spanbroek
660330d216
Add nimble file
2023-10-26 09:52:28 +02:00
Mark Spanbroek
721fd6ac89
Add license file
2023-10-26 09:52:28 +02:00
Mark Spanbroek
1d81384c0c
Add editorconfig and gitignore
2023-10-26 09:52:28 +02:00
Mark Spanbroek
9f202e0a39
Moving files around to be compatible with nimble
2023-10-26 09:52:28 +02:00
Balazs Komuves
20b4ee4079
quick Nim implementation of Poseidon2 via constantine (BN254, t=3)
2023-10-24 13:19:11 +02:00