Why are the outputs of the md5sum tool and Crypto++'s MD5 different?
The echo command appends a new line at the end, by default. The -n option omits this character. Compare these two executions:

&gt; echo -n "test123" | md5sum
cc03e747a6afbbcbf8be7668acfebee5

&gt; echo "test123" | md5sum
4a251a2ef9bbf4ccc35f97aba2c9cbda


So the difference between the hash values is simply caused by the new line character.