Re: Hash from C# to C++
On Jul 17, 8:53 am, mikethebike <michael.sg...@gmail.com> wrote:
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.).
James Kanze (GABI Software) email:firstname.lastname@example.org
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34