33int main(
int argc,
char *argv[]) {
34 unsigned char buf[512];
39 if (argc < 2 || argv[1][0] ==
'\0') {
40 fprintf(stderr,
"Usage: bintest <value>\n");
47 printf(
"Result code from mp_int_read_string() = %d (%s)\n",
res,
51 printf(
"%d bytes needed to write this value in 2's complement.\n", len);
54 printf(
"Result code from mp_int_to_binary() = %d (%s)\n",
res,
60 for (ix = 0; ix < (len - 1); ++ix) {
61 printf(
"%d.", buf[ix]);
63 printf(
"%d\n", buf[ix]);
67 printf(
"Result code from mp_int_read_binary() = %d (%s)\n",
res,
72 printf(
"[%s]\n\n", buf);
76 printf(
"%d bytes needed to write this value as unsigned.\n", len);
79 printf(
"Result code from mp_int_to_unsigned() = %d\n",
res);
83 for (ix = 0; ix < (len - 1); ++ix) {
84 printf(
"%d.", buf[ix]);
87 printf(
"%d\n", buf[ix]);
93 printf(
"Result code from mp_int_read_unsigned() = %d (%s)\n",
res,
98 printf(
"[%s]\n\n", buf);
#define mp_int_read_binary
#define mp_int_unsigned_len
#define mp_int_to_unsigned
#define mp_int_read_string
#define mp_int_read_unsigned
#define mp_int_binary_len