# [cryptography] ciphers with keys modifying control flow?

Sandy Harris sandyinchina at gmail.com
Wed Sep 29 03:28:39 EDT 2010

```On Tue, Sep 28, 2010 at 11:45 AM, Sandy Harris <sandyinchina at gmail.com> wrote:

> Where does something like the key-dependent rotations in CAST-128 or 256,
> or the data dependent ones in RC5 or RC6 fit in? That key material is not
> being mixed into the text, and it does control an operation, but I'm not sure
> if it meets your criteria of interest.

Just remembered another one...

I did some work on a potential Advanced Hash Standard contest entry, but
did not enter it because it was neither complete nor particularly good by

It was called 3D for Data-Dependent Diffusion. The main diffusion part
was a variant on a pseudo-Hadamard transform. I drove it with data
from the hash, but it could easily be driven by key-derived data for
use in a cipher.

Your basic PHT for some data type T is:

pht2(T *a, T *b)
{
T x, y ;
x = *a + *b ;
y = x + *a ;    // 2*a+b
*a = x ;
*b = y ;
}

Larger PHTs are built up recursively from that.
A 2n-way PHT is two n-ways followed by n
2-ways to mix the halves.

A 4-way uses 4 2-ways. An 8-way uses two
4-ways then 4 2-ways,total 12 2-ways. A
16-way uses 12 + 12 + 8 = 32 2-ways.

I used a 16-way PHT, 16 32-bit items in 3D-512
and 16 16-bits in 3D-256. Using 16-bit objects
that way was one of the things I thought was

Throw in a global control variable z and you can
have:

pht2(T *a, T *b)
{
T x, y ;
x = *a + *b ;
y = x + *a ;    // 2*a+b
if (z & 1) {
*a = x ;
*b = y ;
}
else {
*a = y ;
*b = x ;
}
z >>= 1 ;
}

32 bits of z then control the 32 2-way PHTs that
make up the 16-way one. The key-derived data
z is directly controlling a bunch of if/else choices.

Is that an example of what you wanted?

```