2

In this question I learned that it's possible to create an iostream that hashes its full input.

Though this example here uses boost. Is it possible to do this without boost and if yes, how?

Community
  • 1
  • 1
keyboard
  • 2,137
  • 1
  • 20
  • 32
  • Do what. Of course. You use another library. What hash anyways? md5? sha1? blake2? – sehe Apr 08 '16 at 12:16
  • Ideally the hashing algorithm should be exchangeable, that's why I didn't specify it. Though we can assume md5 here. – keyboard Apr 08 '16 at 13:03
  • I don't quite understand the rest of your comment. I'm just asking how to do your cool hashing-stream without boost. I don't quite understand how to do it with basic STL streams. – keyboard Apr 08 '16 at 13:04
  • Use a library. libcrypto, Crypto++, PoCo, and many many more libraries implement these. – sehe Apr 08 '16 at 13:05
  • And re. how to get it in `std::ostream` use a custom `std::streambuf`. [@DietmarKuhl](http://stackoverflow.com/users/1120273/dietmar-k%C3%BChl) has some rather cool answers showing this (for compression/encryption) IIRC) – sehe Apr 08 '16 at 13:06
  • Thanks, I'll have a look. I don't want to have too many dependencies (and increased binary size) - that's also why I avoid boost. – keyboard Apr 08 '16 at 13:13
  • Can you please clarify your question a little bit? What exactly do you want to hash - and when? With every `flush`? – J. D. Jun 26 '18 at 19:55

0 Answers0