[128729] in cryptography@c2.net mail archive

home help back first fref pref prev next nref lref last post

Re: Looking through a modulo operation

daemon@ATHENA.MIT.EDU (lists@notatla.org.uk)
Wed Jul 23 09:29:56 2008

Date: Wed, 23 Jul 2008 03:46:47 +0100
To: matt.ball@ieee.org, cryptography@metzdowd.com
In-Reply-To: <ed843b100807201514r3a985135tfa4e691750838b3e@mail.gmail.com>
From: lists@notatla.org.uk


"Matt Ball" <matt.ball ieee.org> wrote

> Here is a C implementation of __random32:
> 
> typedef unsigned long u32;
> struct rnd_state { u32 s1, s2, s3; };
> static u32 __random32(struct rnd_state *state)
> {
> #define TAUSWORTHE(s,a,b,c,d) ((s&c)<<d) ^ (((s <<a) ^ s)>>b)
> 
>     state->s1 = TAUSWORTHE(state->s1, 13, 19, 4294967294UL, 12);
>     state->s2 = TAUSWORTHE(state->s2,  2, 25, 4294967288UL, 4);
>     state->s3 = TAUSWORTHE(state->s3,  3, 11, 4294967280UL, 17);
> 
>     return (state->s1 ^ state->s2 ^ state->s3);
> }

I see TAUSWORTHE (briefly tested with the above constants) isn't a
permutation of the 32-bit input state and is going to get very dull
when s is 0.

---------------------------------------------------------------------
The Cryptography Mailing List
Unsubscribe by sending "unsubscribe cryptography" to majordomo@metzdowd.com

home help back first fref pref prev next nref lref last post