Go icon indicating copy to clipboard operation
Go copied to clipboard

[IMPLEMENTATION] DSA algorithm implementation

Open ddaniel27 opened this issue 1 year ago • 3 comments

Hi team, this is my DSA implementation. This PR needs a little bit of context.

I tried to follow the exact same algorithm steps as Wikipedia says but this has a big problem: efficiency. I'm talking about waiting around 1.5 mins to get the keys generated. Even this is not the exact amount of time because having randomness adds inconsistency (this is the keygen took 10s or 10m but on average 1.5m).

This is why I took a look at the current go dsa implementation. As you might see, we have the same aproach in the generation parameters loop (i.e. GPLoop for me, GeneratePrimes for DSA Go implementation), this is so far the most optimal way I found to get the p and q params, so I tried to replicated it in my own way also with the added value of explaining most decisions because some decisions seems arbitray but it's all for (again) efficiency.

I hope the context helps a little bit to clarify why the core algorithm appears to be a "copy" of the DSA std library. Honestly, after studying many different implementations, this is the only viable one.

ddaniel27 avatar Sep 14 '24 15:09 ddaniel27

Codecov Report

Attention: Patch coverage is 92.38095% with 8 lines in your changes missing coverage. Please review.

Project coverage is 87.43%. Comparing base (822634f) to head (bbc98cb). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cipher/dsa/dsa.go 92.38% 4 Missing and 4 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #737      +/-   ##
==========================================
- Coverage   87.68%   87.43%   -0.25%     
==========================================
  Files         209      210       +1     
  Lines        5547     7054    +1507     
==========================================
+ Hits         4864     6168    +1304     
- Misses        542      741     +199     
- Partials      141      145       +4     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Sep 14 '24 15:09 codecov-commenter

Hey @raklaptudirm @yanglbme hope you are well. I re-open a PR for this implementation. Last one was closed by stale status. I hope you can take a look at this PR this time. Also the pipeline is failing because some lint errors not related with my PR. I could track two errors, both in math/matrix/strassenmatrixmultiply_test.go line 69 and 106. Let me know if you think it's good open another PR to fix the pipeline errors. :)

ddaniel27 avatar Sep 14 '24 15:09 ddaniel27

@raklaptudirm @yanglbme I created a PR to fix the tests failing for lint. After merge that PR You/I can update this PR to merge this too :)

ddaniel27 avatar Sep 25 '24 15:09 ddaniel27