In part A I used chosen plaintext attack 26 times (once for each letter in the alphabet). Each time I've put a letter at the beginning of a block and pad the rest with spaces (or let the encryption pad it for me) then I queried on this block and looked for the only non-space letter in the ciphertext (there is exactly one) and that is the value of S(a) where a is the queries letter and S() is the substitution operation.

Regarding question 2 part B we are asked to find P the in-block permutation used by the scheme and there is a hint about using known statistics of pairs of letters, however I dont see how one can rely on such statistics when P messes the order of the letters in the block, pairs of letters that are common may be thrown to the two different ends of the block. What I did is n/26 times put hte 26 different letters of the alphabet at the 26*i places in the block (i is the number of the iteration) and by using S from the previous part I know which letter will be substitutioted for what lettter and thus can find where P moved each place in the block to.

In part C, I think I can do the same as in part A (the block will be padded) as the block must be of size at least 1. So S can be found the same as in part A. To find P we will have to try to guess n (the block size) and for each n try to do the same as in part B only with one letter at a time. We will know we found the right n when we get a full permutation of size n.

Your thoughts, feedback and criticism will be much apprecaited.