hex conversion
Max
maxim.suraev at campus.tu-berlin.de
Sun Dec 21 11:43:01 CET 2014
20.12.2014 18:58, Werner Koch пишет:
> If you need an MPI, you can do that with
>
> gcry_error_t err;
> gcry_mpi_t n;
> char string[] = "abcdef010203040506070809";
>
> err = gcry_mpi_scan (&n, GCRYMPI_FMT_HEX, string, 0, 0);
> if (err)
> print_error ();
>
> gcry_mpi_print and gcry_mpi_aprint can be used to print in hex format.
>
> S-expressions also have an hex format "(#abcdef010203040506070809)" and
> the s-expressions scanning fucntions support that. For everything elese
> you need to do it of your own (look at gnupg/common/convert.c).
>
>
Thank you for explanation. Although just duplicating code feels wrong - is there some
library I could link against?
cheers,
Max.
More information about the Gcrypt-devel
mailing list