LibGCrypt Examples

Rüdiger Sonderfeld cplusplushelp@gmx.net
Thu, 18 Apr 2002 00:19:26 +0200


Am Mittwoch, 17. April 2002 23:59 schrieben Sie:
> On Wed Apr 17 2002; 23:40, kingruedi wrote:
> >   gcry_md_write(md5,buffer,len); /*<-- this should create the checksum*/
> >   printf("%s\n",buffer);
> >   gcry_md_close(md5);
>
> No, you can't use it like this, try this instead:
>
> gcry_md_write( md5, buffer, len );
> gcry_md_final( md5 );
> {
>         byte *digest = gcry_md_read( md5, GCRY_MD_MD5 );
>         int i = 0;
>         for ( i=0; i<gcry_md_get_algo_dlen( GCRY_MD_MD5 ); i++ )
>                 printf("%02X", digest[i]);
> }

I think I understood how to use this lib now.

thanks a lot