Post
Topic
Board Development & Technical Discussion
Re: Double hashing: less entropy?
by
Kazimir
on 11/06/2012, 12:06:05 UTC
Sad don't write recursive code. its bad. for the stack and people mind.
Well it was pseudocode, just to get the general idea.

In more detail: (this does something different than the example above)
Code:
function DeepHash( input , depth )
{
  h = '';
  while(0≤(depth--)) h = Hash(h+input); // where Hash(x) is a regular hasing function, e.g. sha256
  return h;
}

DeepHash(input,1) is the same as Hash(input)
DeepHash(input,2) gives Hash(Hash(input)+input)
DeepHash(input,3) gives Hash(Hash(Hash(input)+input))+input)
etc.

Quote
also your code is kind of broken... what does Hash with only one input?
It was a polymorphic function, a two-parameter alternative to the already existing Hash function with one input (i.e. regular sha256).