summaryrefslogtreecommitdiffstats
path: root/mpi-patches/add-mpi-toradix-with-case
blob: b94fdb19542a4231aa90e3e8ec9de49d34e9abe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Index: mpi-1.8.6/mpi.c
===================================================================
--- mpi-1.8.6.orig/mpi.c	2011-12-10 12:05:35.000000000 -0800
+++ mpi-1.8.6/mpi.c	2011-12-10 12:05:39.000000000 -0800
@@ -2615,9 +2615,9 @@
 
 /* }}} */
 
-/* {{{ mp_toradix(mp, str, radix) */
+/* {{{ mp_toradix_case(mp, str, radix, low) */
 
-mp_err mp_toradix(mp_int *mp, unsigned char *str, int radix)
+mp_err mp_toradix_case(mp_int *mp, unsigned char *str, int radix, int low)
 {
   int  ix, pos = 0;
 
@@ -2648,7 +2648,7 @@
       }
 
       /* Generate digits, use capital letters */
-      ch = s_mp_todigit(rem, radix, 0);
+      ch = s_mp_todigit(rem, radix, low);
 
       str[pos++] = ch;
     }
@@ -2676,10 +2676,15 @@
 
   return MP_OKAY;
 
-} /* end mp_toradix() */
+} /* end mp_toradix_case() */
 
 /* }}} */
 
+mp_err mp_toradix(mp_int *mp, unsigned char *str, int radix)
+{
+  return mp_toradix_case(mp, str, radix, 0);
+}
+
 /* {{{ mp_char2value(ch, r) */
 
 int    mp_char2value(char ch, int r)
Index: mpi-1.8.6/mpi.h
===================================================================
--- mpi-1.8.6.orig/mpi.h	2011-12-10 12:05:35.000000000 -0800
+++ mpi-1.8.6/mpi.h	2011-12-10 12:05:39.000000000 -0800
@@ -213,6 +213,7 @@
 int    mp_radix_size(mp_int *mp, int radix);
 int    mp_value_radix_size(int num, int qty, int radix);
 mp_err mp_toradix(mp_int *mp, unsigned char *str, int radix);
+mp_err mp_toradix_case(mp_int *mp, unsigned char *str, int radix, int low);
 
 int    mp_char2value(char ch, int r);