Re: Secure permutations on non-power-of-2 ranges?

From: Nick Johnson (arachnid_at_notdot.net)
Date: 08/24/05


Date: 23 Aug 2005 15:19:12 -0700

Nick Johnson wrote:
> For a cipher such as TEA, which already uses a Feistel cipher, is it
> possible to integrate the 'shrinking' function into the cipher itself,
> instead of running the cipher multiple times as described above?

To answer my own question, masking the intermediate values in the
cipher to the desired range appears to work. For example, in the code
given at (http://en.wikipedia.org/wiki/XTEA), one masks v0 and v1 with
255 after each modification to achieve a 16 bit block cipher. Can
anyone verify that I'm not doing something fundamentally stupid that
will break the usefulness of the cipher?

-Nick Johnson