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

Prime 256 is too long #90

Open
micchickenburger opened this issue Dec 31, 2023 · 1 comment
Open

Prime 256 is too long #90

micchickenburger opened this issue Dec 31, 2023 · 1 comment

Comments

@micchickenburger
Copy link

Prime Group 256 is defined here:

"125617018995153554710546479714086468244499594888726646874671447258204721048803",

I calculate this prime having a length of 264 bits instead of 256 bits. All the other primes are the correct length. (It is possible that I made an error in my code, though.)

@bufistov
Copy link

Hey @micchickenburger! I was eventually able to take a look into this thanks to the global day off on Friday :)

I think you are partially correct :) This particular number requieres 257 bits, 33 bytes to fit.
Here is a small check I tried:

$ python3
Python 3.12.7 (main, Oct  1 2024, 02:05:46) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a=125617018995153554710546479714086468244499594888726646874671447258204721048803
>>> bin(a)
'0b10001010110111000101101101001001011100000111000000100010101101001001011001111001010000000101101000011011001110011010111000111011110100101101010011110100010101001111001111110110101010110110010010110010111111000011111011011010110110010101000101110110011100011'
>>> len(bin(a))
259
>>> len(bin(a))-2
257
>>>

I wanted to create a test that checks the size of all the numbers in the parameters, but this test actually already exists. Please take a look.

The same test also sends us to the related discussion about why the parameter is actually of 257 bits instead of 256 bits.
I understood that this is a known issue, but no-one care since such small prime numbers cannot be used in a real life application. We keep it only for testing purposes.

bufistov pushed a commit to bufistov/tssrp6a that referenced this issue Nov 29, 2024
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

No branches or pull requests

2 participants