If you restart the session and enter
> echo test1 | md5
it will output another random 'hash' each time. But within one session it knows that md5 should produce the same output. Running > echo test1 | md5
multiple times, or even > VAR1="test1"; echo $VAR1 | md5
produces the same output for me within the same session, while > echo test2 | md5
results in a different, but also session-consistent hash.