Preface: here is the official site for the Blowfish algorithm:


The Blowfish algorithm uses an s-box, which consists of hex digits of pi (found here: http://www.schneier.com/code/constants.txt). I'm guessing that this s-box serves a very similar purpose to the s-box in AES (right?)

However, at the bottom of that file, there is a smaller box called p_array or parray or something. I have no idea what it does! Also, is there some sort of significance to why the hex digits for pi are used, and not some random values?

  • 1
    $\begingroup$ Actually, the digits of $\pi$ are only used as the initial value of the P- and S-boxes. During the key schedule, they will be replaced by pseudo-random numbers depending on the initial values as well as the key. $\endgroup$ – Paŭlo Ebermann Nov 8 '12 at 9:32

Yes. Blowfish's S-boxes serve a similar purpose as AES's S-box.

The P-array is used as part of the key schedule, to make sure that each round is different (this helps prevents slide attacks and related-key attacks).

I recommend you read the official specification of Blowfish and Wikipedia's article on Blowfish for more about the design rationale for Blowfish.

The use of digits of pi is a "nothing up my sleeve" number.

Bruce Schneier (the algorithm designer) wanted to use a random number. For Blowfish, it basically doesn't matter what number you use, if it is random. However, Bruce also wanted everyone to be able to see that he didn't somehow pick some very special choice of number that introduces a trapdoor. The digits of pi are basically random-looking, and cannot be controlled by Bruce. Therefore, they make a standard choice for a "nothing up my sleeve" number.

See also How to choose constants in a cryptographic function? and Wikipedia on nothing up my sleeve numbers.

| improve this answer | |
  • $\begingroup$ That was really helpful. I've been studying this algorithm lately and I just wanted to make sure those assumptions were correct! Since you seem to know a lot about this, I just found an interesting quotation from Schneier that I could use some insight on. He said "there is a class of keys that can be detected, although not broken--in Blowfish variants of 14 rounds or less." Do you know what he means, and why it is true? $\endgroup$ – SwaroopGiwali Nov 8 '12 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.