# Hash chaining in both directions

Hash chaining in both directions
0

#1

Hi,

I have a theoretical/concept question. For those not familiar with a hash chains let me first illustrate how they work in principle before posting my question:

I’ll use MD5 hash function

``````echo "this is my text" | md5sum -
b4f9352c2d75bc2c69902f8efb5fd3be   -> hash  of "this is my text"
``````

to create a chain you would in principle do :

``````md5(this is my text) =  b4f9352c2d75bc2c69902f8efb5fd3be
md5(b4f9352c2d75bc2c69902f8efb5fd3be) = 6e77d1d70d94a4fb4ba9786f242755f8
md5(6e77d1d70d94a4fb4ba9786f242755f8) = 5ae3e365f97f6219dd628e85996e55bd
etc....
``````

so as you can see this is one directional chain

``````A -> #(A) -> #(#A) -> #(#(#A)) -> etc...
``````

in which the proof of correctness of the #(A) is located in #(#(A)) (That is, the next hash in the chain).

My question is:

Is there a way to bidirectionally link the two chains, so the the proof of #(#(A)) is located in #(#(#(A))) as well as in #(A). Of course, maybe not in the previous one but is there a solution that can guarantee the validity of the next next # in the sequence just by looking the previous one.

Naive solution is to create another chain that combines the produced hashes of the original chain with the new ones created but in the opposite direction. However, this would require to recompute the entire chain each time a new iteration to the original chain is made.

So what I am looking for is a better solution…