Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   miracl output (https://forum.exetools.com/showthread.php?t=9456)

Peter[Pan] 04-13-2006 20:18

miracl output
 
I was working on some stuff from the miracl library (first time i used it) i have a little problem with outputting the bignums, heres my problem.

From reading the manual i see there is cotnum and cotstr:

Cotnum goes to FILE * and cotstr can go to CHAR *

so naturally i used cotstr, the problem is every so often when the bignum starts with a leading 0 it doesnt output it.

Example: 0F33 -> "F33"

I fixed this by manually looping through all the bignums and throwing them through a %.2X sprintf but this is kinda lame, there is a way to maybe force miracl to present that leading zero ?

Thanks.

cnbragon/iPB 04-14-2006 10:59

it seems there is nothing special method to implement what u want.
first,u can use "big_to_bytes" procedure to output the hex value to a buffer , then use "wsprintf" to convert to ASCII Character.
Second, u can modify the miracl lib by your self. find the "cotstr" procedure in mrio2.c,
trace to miro1.c , u will find itl call "otstr" procedure. so u can modify the source codes
from here

forever
{
nd=numdig(_MIPP_ mr_mip->w6);
...
}

and re-make ms32.lib by yourself. but this will change another proc of miracl,so be carefully.

Peter[Pan] 04-14-2006 22:21

Thanks i think i wont bother modifying the library, i found that it only ever happens to the first char, so seen as i know how many chars are getting returned, if it doesnt have that amount i strcat a "0" before i attach the rest of the string.

Thanks again :)


All times are GMT +8. The time now is 12:37.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX