Re: Crack better hash()

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Thu, 19 Jun 2003 18:48:01 -0400 (06/20/03 08:48:01)
, Lucius Hilley <l3euphoria at bellsouth.net> wrote:

>
>
> I must concede the first one somehow turns out to be a fancy way of
> a one to one conversion.  Sort of like a XOR with some constant value.
> a 'u' would always encode to a #E7.  or something like that.
> Would simple be a process of building a decryption table from the
> encoder.  This algorithm is slightly different in nature and doesn't
> have that problem.  Now, where is it's weakness?
>
> function hash(sequence s)
> integer size
> sequence result
> size = length(s)
> result = repeat(0, size)
> for A = 1 to length(s) do
> for B = 1 to size do
> result[B] += 1
> result[B] *= s[A] + B
> result[B] = and_bits(result[B], #FF)
> end for
> end for
> return result
> end function

Just a few thoughts.

Because this ends up with the same number of independant equations as you 
have unknowns, one could derive the plain text by solving the simultaneous 
equations.

Also, the strength of the hash is limited by the length of the input 
string. It might be better to enable the user to specify an arbitary return 
length. The longer the return string, the stronger the hash.

Just for performance, you might like to do this...

 for A = 1 to length(s) do
 result += 1
 for B = 1 to size do
 result[B] *= s[A] + B
 end for
 result = and_bits(result, #FF)
 end for

-- 

cheers,
Derek Parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu