kazu-yamamoto / crypton

lowlevel set of cryptographic primitives for haskell
Other
26 stars 17 forks source link

[Feature] signLazy / verifyLazy functions for Ed25519 and Ed448 #29

Open epoberezkin opened 10 months ago

epoberezkin commented 10 months ago

Currently there are only sign / verify functions that compute sha512 hash of the passed data internally. The problem with that is that it doesn't allow signing/verifying lazy bytestrings.

We can split implementation of crypton_ed25519_sign / crypton_ed25519_sign_open (and also crypton_decaf_ed448_sign / crypton_ed448_sign_open) to two parts to allow passing digests as well, and expose them as singDigest / verifyDigest functions in both modules that accept sha 512 hashes (like in other modules).

@kazu-yamamoto We will do the PR if it's ok.

kazu-yamamoto commented 10 months ago

Of course!

dpwiz commented 10 months ago

Unfortunately we've found that the algorithm uses a digest prefix of its own and then again, with a prefix derived from the previous digest. That makes it challenging to make a proper API, like the signDigest in the other modules, as it would involve callback ping-pong through FFI.

epoberezkin commented 10 months ago

It's possible to make singLazy/verifyLazy, by passing array of chunk pointers to C function, but it won't work well for large number of chunks probably...

We'll park this idea for now.