# Prime computation for Diffie Hellman

While reading some cryptographic RFCs, came across the Diffie Hellman prime computation formula:

2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }

I am curious what the expression [2^894 pi] means here. The part specifically confusing me is the space between 2^894 and pi. It cannot be a multiplication operation as that does not give me the correct result. I am sure the answer is straightforward for someone with mathematical background...

It's multiplication of 2^894 and pi.

(2^1024 - 2^960 - 1 + 2^64 * ( (2^894 * pi) + 129093))


Wolfram Alpha

• Thanks Rob. I did try that the result was too long. The prime value from RFC is: "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF" I suppose the bits after 1024 are ignored. Also, good to know about this site for big computations
– Paani
Mar 9, 2020 at 0:10
• The bits aren't ignored. It's just not an integer as given. Add floor() and you'll see it's the same size: wolframalpha.com/input/…*+%28+%282%5E894+*pi%29+%2B+129093+%29%29+in+hexadecimal Mar 9, 2020 at 0:28
• This value you presented here isn't precisely the prime (again, multiplying times pi isn't going to give you an integer, and it all becomes very dependent on how you precisely do the calculation). They found a nearby prime that had more trailing 1s (see the link that Maarten provides for why they throw pi in there. It's not for math reasons.) Mar 9, 2020 at 0:31
• Hello, which link are you talking about? Apr 29, 2023 at 16:08
• @PolDellaiera I'm not sure what Maarten originally posted since I expect he's deleted his comment. But see crypto.stackexchange.com/questions/14467/… and specifically en.wikipedia.org/wiki/Nothing-up-my-sleeve_number Well known constants like π are often used in cryptography to signal that you didn't carefully choose the seed to create a subtle flaw. (Unfortunately, much as a magician may show "nothing up their sleeves" to distract you from the trick, similar things are possible with "nothing up my sleeve" numbers. Still, it's a common technique.) Apr 29, 2023 at 17:16