[C++] Using crypto library, how to clear StringSource/Sink (currently keeps appending new hash to previous one)
I have a homework assignment that involves using the libcrypto library and I’m having an issue. I’m suppose to take an input file with one name per line, read it in, and hash it using libcrypto hash algorithms and then output it a file with the original name and hash all on one line (separated by a comma). I’ve got it working for the most part but the new hash is appending to the old hash, by the time I get to the final name in the file my hash is 4 + lines long. I would guess I would clear or delete StringSource or StringSink in some way but I can’t figure out how to actually accomplish that (the documentation on this isn't that great). Any insight would be appreciated, I've included a snippet of the code below, if more is needed please let me know.
StringSource x (fileName, true, new HashFilter (hash, new HexEncoder ( new StringSink (value) ) ) );
Submitted July 15, 2017 at 09:55AM by mully1121
via reddit http://ift.tt/2upLCIo