Hash from C# to C++

J

James Kanze

this would be perfect for me but I need that in C++. Anybody
could help me?

There's code for it at my site:
http://kanze.james.neuf.fr/code-en.html. The code itself is
part of the IO subsystem (historical reasons---yah, that sounds
like a good excuse), and uses other parts of the library, so you
might have to pick up the entire library. Anyway, you can
browse the IO subsystem documentation, to see if it's of any use
to you: the basic types are defined in Digest.hh, with separate
header files for each of the supported digest types (e.g.
MD5.hh, SHA1.hh, etc.). There are several ways of using the
classes; perhaps the simplest is just:

output << text << std::accumulate( text.begin(), text.end(),
Hasher< Policy >() ) ;

(except that you'd normally use the typedef for the appropriate
Hasher< Policy >, declared in its corresponding header, e.g.
MD5Hasher, declared in MD5.hh, etc.).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top