Hash(input,depth) :=
Hash(input) if depth==1
Hash(Hash(input)+input,depth-1) otherwise
(where 'Hash' can be any regular hashing function, such as sha256)

don't write recursive code. its bad. for the stack and people mind.
also your code is kind of broken... what does Hash with only one input?