# Pseudo-Hadamard Transform in SAFER K-64

The PHT seems so simple: `b1 = 2*a1 + a2; b2 = a1 + a2`. and yet, i am definitely missing something, since the paper for SAFER K-64 shows:

``````INPUT VECTOR is 0 0 0 0 0 0 0 1
OUTPUT VECTOR is 1 1 1 1 1 1 1 1
``````

where each value is 8 bits.

can someone explain how in the world does `2 * 0 + 0` become `1`??? i believe this is the only thing keeping my safer implementation from working properly.

-
Maybe this is just because I really don't understand it, but wouldn't this be better placed at Mathematics? – AviD Jul 7 '11 at 0:08
i also posted there – calccrypto Jul 7 '11 at 0:12
This is a fine place to post. The main issue is that it is a highly obscure question; this will be true no matter where it is posted. – D.W. Jul 7 '11 at 4:32

## 1 Answer

You have confused the PHT transformation with the PHT layers of the block cipher's round function:

• The PHT transformation maps a two-byte input to a two-byte output. It uses the formula you listed. For instance, PHT(0,1) = (1,1).

• The PHT layers of the round function map a 8-byte input to a 8-byte output. Each round has a sequence of 3 layers. Each layer consists of 4 parallel PHT transformations.

The input/output vector you list is for the PHT layers of the round function, not for the PHT transformation itself. If you follow the computation diagram (see, e.g., Figure 7.12 and Section 7.7.1 in the appropriate chapter of the Handbook on Applied Cryptography, you will see how the PHT layers transform the input (0,0,0,0,0,0,0,1) to (1,1,1,1,1,1,1,1) by application of 12 PHT transformations in the appropriate sequence.

One last comment: I do not recommend using SAFER K-64. It is an outdated cipher. There are a number of shortcomings: there are some minor cryptanalytic weaknesses in it; it has not been studied very much; and worse, the key size and block size are too small. For these reasons, I do not recommend that you use SAFER K-64 or that you expose it as an option to your users. Instead, I recommend that you use AES.

-
yes. i know, im just trying to figure out how all sorts of different ciphers work. Here's the c++ library i wrote from what i have learned. – calccrypto Jul 7 '11 at 5:07
darn it. i wrote it correctly all, so something else is wrong. thanks for clearing this up for me! – calccrypto Jul 7 '11 at 17:41