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

random doctest failure in src/sage/tests/book_stein_ent.py #33035

Closed
yyyyx4 opened this issue Dec 17, 2021 · 14 comments
Closed

random doctest failure in src/sage/tests/book_stein_ent.py #33035

yyyyx4 opened this issue Dec 17, 2021 · 14 comments

Comments

@yyyyx4
Copy link
Member

yyyyx4 commented Dec 17, 2021

Part of #32544:

sage -t --long --random-seed=248665222928234939040854301866666446071 src/sage/tests/book_stein_ent.py
**********************************************************************
File "src/sage/tests/book_stein_ent.py", line 208, in sage.tests.book_stein_ent
Failed example:
    decrypt(c, d, n)
Expected:
    123
Got:
    109489
**********************************************************************
1 item had failures:
   1 of 262 in sage.tests.book_stein_ent
    [261 tests, 1 failure, 15.47 s]

(From a patchbot run in #32744.)

CC: @williamstein

Component: cryptography

Author: Michael Orlitzky

Branch/Commit: 7bb8387

Reviewer: Lorenz Panny

Issue created by migration from https://trac.sagemath.org/ticket/33035

@yyyyx4 yyyyx4 added this to the sage-9.5 milestone Dec 17, 2021
@yyyyx4
Copy link
Member Author

yyyyx4 commented Dec 17, 2021

comment:1

The error is because the preceding call to rsa() generates a key with p=q when using this seed.

@orlitzky
Copy link
Contributor

comment:3

Instead of

....:     p = next_prime(ZZ.random_element(2**(bits//2 +1)),
....:                    proof=proof)
....:     q = next_prime(ZZ.random_element(2**(bits//2 +1)),
....:                    proof=proof)

we should be able to do

....:     p = q = ZZ.zero()
....:     while (p == q):
....:         p = next_prime(ZZ.random_element(2**(bits//2 +1)),
....:                        proof=proof)
....:         q = next_prime(ZZ.random_element(2**(bits//2 +1)),
....:                        proof=proof)

(we really only need to regenerate q, but this is nice and symmetric.)

But for these tests to serve their intended purpose we'll need William (hint hint) to pick a solution so that it can be incorporated into the book (https://github.com/williamstein/ent) as well.

@williamstein
Copy link
Contributor

comment:4

Hint taken. How about this?

....:     while True:
....:         p = next_prime(ZZ.random_element(2**(bits//2 + 1)),
....:                        proof=proof)
....:         q = next_prime(ZZ.random_element(2**(bits//2 + 1)),
....:                        proof=proof)
....:         if p != q: break

@orlitzky
Copy link
Contributor

comment:5

Replying to @williamstein:

Hint taken. How about this?

Even better. I'll post a branch later today. Thanks.

@orlitzky
Copy link
Contributor

Last 10 new commits:

26a7332build/pkgs/singular/spkg-install.in: Remove workaround for singular.idx, it is now in doc.tbz2
bb1f741build/pkgs/singular/spkg-install.in: Remove workaround for make paralellization bugs
2673632Port to API changes in singular 4.2.1p2
720d10eUpdate tests for singular 4.2.1p2
cca353bsrc/sage/rings/polynomial/hilbert.pyx: Fix doctest markup
8c6c949build/pkgs/flint/: Add patch for threads with GCC < 4.9
eea6328build/pkgs/singular/spkg-install.in: singular.hlp -> singular.info
a137b7eMerge tag '9.5.beta8' into t/32907/update_singular_to_4_2_1p2
0856554build/pkgs/singular: Update to 4.2.1p3
e1c448eMerge commit '0856554' into develop

@orlitzky
Copy link
Contributor

Commit: e1c448e

@orlitzky
Copy link
Contributor

Branch: u/mjo/ticket/33035

@orlitzky
Copy link
Contributor

Author: Michael Orlitzky

@orlitzky
Copy link
Contributor

comment:7

Those extra commits are from #32907 which is already merged but isn't in beta9.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 29, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

7bb8387Trac #33035: fix a randomly failing test in sage.tests.book_stein_ent.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 29, 2021

Changed commit from e1c448e to 7bb8387

@yyyyx4
Copy link
Member Author

yyyyx4 commented Jan 16, 2022

Reviewer: Lorenz Panny

@slel
Copy link
Member

slel commented Jan 30, 2022

comment:10

Setting milestone to 9.6 now that 9.5 is out.

@slel slel modified the milestones: sage-9.5, sage-9.6 Jan 30, 2022
@vbraun
Copy link
Member

vbraun commented Feb 16, 2022

Changed branch from u/mjo/ticket/33035 to 7bb8387

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

No branches or pull requests

5 participants