Hexa format

Brad Hards bradh at frogmouth.net
Mon Jan 30 11:26:59 CET 2006


On Monday 30 January 2006 09:46 am, joel vennin wrote:
> I've just a simple question for you, i would like to know if there is
> a function inside the gcrypt library to convert digest buffer to a
> hexa string representation. In fact, i'm using the gcry_md_hash_buffer
> function and i want to display on the screen the hexa representation
> of the digest buffer.
There is some code in src/sexp.c that does this (look at convert_to_hex()), 
but it is trivial to write your own.

> I've got another question, i want to know what it is more efficient:
>   - use the gcry_md_hash_buffer function
>   - or use the set of functions:
>        - gcry_md_write
>        - gcry_md_read
For SHA1 and RMD160, gcry_md_hash_buffer will probably be faster. Otherwise it 
probably isn't going to make much difference, although it does depend on your 
exact setup (where the data comes from, costs of caching, memory limits). If 
it is really important, do both and time it.

BTW: You could have read the code in cipher/md.c - that is all I did.
Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/attachments/20060130/4459d9af/attachment.pgp


More information about the Gcrypt-devel mailing list