<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<br>
<blockquote type="cite" cite="mid001001c38141$19fe4f20$0401a8c0@hert">
<blockquote type="cite">
<pre wrap="">11) src/mscrypto/bignum.c, xmlSecMSCryptoDecToHex(),
xmlSecMSCryptoHexToDec() and friends
Sorry, I don't understand what you wrote in these functions. IMHO,
there were too many code and
too many mallocs for such a simple task. I rewrote both functions.
Please check that I did not break
break your tests.
</pre>
</blockquote>
<pre wrap=""><!---->
Could you explain the approach you've taken with the newly written code
here? I've taken a look why they are not working, but excexpt for a
wrong assertion at line 198 (should be become xmlSecAssert2(outBase <=
sizeof(xmlSecMSCryptoRevLookupTable), NULL);) I couldn't find a trivial
error, nor could I understand what the code does.
</pre>
</blockquote>
This code is wrong (I sent a message about that last night). I know how
to write a better code<br>
(faster/less mallocs) than one you intialy wrote and I hope to do it
tonight. The basic idea is <br>
to implement following operations:<br>
- add int to bignum<br>
- mul bignum by int<br>
- div bignum by int<br>
where bignum is a binary buffer that MSCrypto returns. After that
converting that buffer (bignum)<br>
to and from dec string is a piece of cake:<br>
bignum-->dec string<br>
dec_str = "";<br>
while(bignum != 0) {<br>
dec _str += convert_to_char(bignum % 10);<br>
bignum = bignum / 10;<br>
}<br>
<br>
dec string->bignum<br>
bignum = 0;<br>
for(i = 0; i < strlen(dec_string);i++) {<br>
bignum = bignum * 10;<br>
bignum = bignum + convert_to_int(dec_str[i]);<br>
}<br>
<br>
<br>
Aleksey<br>
<br>
<br>
<br>
</body>
</html>