[xmlsec] Re: Problem: Comparing decimal with hexadecimal numbers
Remy Lebeau
gambit47 at yahoo.com
Mon Sep 15 16:56:04 PDT 2003
--- "Wouter" <wsh at xs4all.nl> wrote:
> It is possible to get a hex string representation
> of the number (thanks to the code of Remy :),
> but would anyone know how to convert this
> (either ASN.1 byte array, of hex string) to
> decimal representation??? Any suggestion or idea
> on this is welcome.
The code I submitted also included code for converting
a hex string back to its original binary format. As
long as the binary is sizeof(int), you should be able
to do a simple cast, ie (I haven't yet seen how Alex
integrated it, otherwise I'd give you an actual code
sample):
xmlChar hex = "75BCD15"; // decimal 123456789
xmlSecByte *buf;
xmlSecSize bufsize = 0;
int i;
// convert hex to binary,
// assign data pointer to buf
// assign buffer size to bufsize
if( bufsize == sizeof(int) )
i = *(int*)buf;
Gambit
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the xmlsec
mailing list