Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad indentation and work distribution #1

Closed
GrosQuildu opened this issue Nov 11, 2019 · 1 comment · Fixed by #2
Closed

Bad indentation and work distribution #1

GrosQuildu opened this issue Nov 11, 2019 · 1 comment · Fixed by #2

Comments

@GrosQuildu
Copy link
Contributor

Hi
I had tried to use your code and noticed three things:

  • indentation is wrong in roca.py and optimization.py scripts:

          a_prime = start
          while a_prime < stop:
            if manager.finished:
              break 
              
              # Construct polynomial
              m_inv = int(inverse_mod(M_prime, N))

    Infinite loop over if manager.finished.

  • Distribution of work (below # Spawn processes) is wrong. For example with 512 bit key and 7 cpus:

     top = 0xc5772
     c_prime = 0x65ab4
     ord_prime = 0x125430
     start | stop |  stop-start
     0x80000 | 0x1c359 | -0x63ca7
     0x1c359 | 0x386b2 | 0x1c359
     0x386b2 | 0x54a0c | 0x1c35a
     0x54a0c | 0x70d65 | 0x1c359
     0x70d65 | 0x8d0bf | 0x1c35a
     0x8d0bf | 0xa9418 | 0x1c359
     0xa9418 | 0xc5772 | 0x1c35a
    

    First worker returns immediately, and next four do unnecessary jobs.

    Should be something like:

    top = 0xc5772
    c_prime = 0x65ab4
    ord_prime = 0x125430
    start | stop |  stop-start
    0x80000 | 0x89ec8 | 0x9ec8
    0x89ec8 | 0x93d90 | 0x9ec8
    0x93d90 | 0x9dc58 | 0x9ec8
    0x9dc58 | 0xa7b20 | 0x9ec8
    0xa7b20 | 0xb19e8 | 0x9ec8
    0xb19e8 | 0xbb8b0 | 0x9ec8
    0xbb8b0 | 0xc5778 | 0x9ec8
    
  • manager.finished not working, when one worker finds the factorization, other workers don't stop

@brunoproduit
Copy link
Owner

Hey, thanks for bringing that up !
Indeed the code seems to be wrongly indented and the workers are broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants