# Red Pike cipher

```So, if I understand this right;
x and k are pairs of 32-bit numbers, as Red Pike is a 64-bit block
system and 32 is the maximum int size on most platforms.

k is key material, x is a pointer to the data.

No state is preserved when encrypting x with k, so to encrypt lots of
data, you must string it into a series of "x" and apply the cipher to
each block.

Am I mistaken? Is this any better than AES-ECB, then, if no cipher state
is preserved between encrypted blocks?

On 27/02/14 13:08, Anonymous Remailer (austria) wrote:
> /* Red Pike cipher source code */
>
> #include <stdint.h>
>
> typedef uint32_t word;
>
> #define CONST 0x9E3779B9
> #define ROUNDS 16
>
> #define ROTL(X, R) (((X) << ((R) & 31)) | ((X) >> (32 - ((R) & 31))))
> #define ROTR(X, R) (((X) >> ((R) & 31)) | ((X) << (32 - ((R) & 31))))
>
> void encrypt(word * x, const word * k)
> {
>   unsigned int i;
>   word rk0 = k[0];
>   word rk1 = k[1];
>
>   for (i = 0; i < ROUNDS; i++)
>   {
>     rk0 += CONST;
>     rk1 -= CONST;
>
>     x[0] ^= rk0;
>     x[0] += x[1];
>     x[0] = ROTL(x[0], x[1]);
>
>     x[1] = ROTR(x[1], x[0]);
>     x[1] -= x[0];
>     x[1] ^= rk1;
>   }
>
>   rk0 = x[0]; x[0] = x[1]; x[1] = rk0;
> }
>
> void decrypt(word * x, const word * k)
> {
>   word dk[2] =
>   {
>     k[1] - CONST * (ROUNDS + 1),
>     k[0] + CONST * (ROUNDS + 1)
>   };
>
>   encrypt(x, dk);
> }
>

--
43.2% of funding goal, with 14 days left:
http://igg.me/at/yourfirstgmo/x/4252296
T: @onetruecathal, @IndieBBDNA
P: +3538763663185
W: http://indiebiotech.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x988B9099.asc
Type: application/pgp-keys
Size: 6176 bytes
Desc: not available
URL: <http://cpunks.org/pipermail/cypherpunks/attachments/20140227/ff26aa93/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://cpunks.org/pipermail/cypherpunks/attachments/20140227/ff26aa93/attachment.sig>

```