Skip to content

Commit 1035567

Browse files
authored
Merge pull request #398 from libtom/improve/base16_api
Improve base16 api
2 parents c315b1c + 06c0606 commit 1035567

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

doc/crypt.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6710,12 +6710,12 @@ \subsection{URL--safe 'base64url' encoding}
67106710
\begin{verbatim}
67116711
int base16_encode(const unsigned char *in, unsigned long inlen,
67126712
char *out, unsigned long *outlen,
6713-
int caps);
6713+
unsigned int options);
67146714
\end{verbatim}
67156715

67166716
Where \textit{in} is the binary string,
67176717
\textit{out} is where the ASCII output is placed
6718-
and \textit{caps} is either $0$ to use lower-letter \textit{a..f} or else to use caps \textit{A..F}.
6718+
and \textit{options} is either $0$ to use lower-letter \textit{a..f} or else to use caps \textit{A..F}.
67196719

67206720
To decode a base16 string call:
67216721

src/headers/tomcrypt_misc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int base32_decode(const char *in, unsigned long inlen,
5454
#ifdef LTC_BASE16
5555
int base16_encode(const unsigned char *in, unsigned long inlen,
5656
char *out, unsigned long *outlen,
57-
int caps);
57+
unsigned int options);
5858
int base16_decode(const char *in, unsigned long inlen,
5959
unsigned char *out, unsigned long *outlen);
6060
#endif

src/misc/base16/base16_decode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/**
2222
Base16 decode a string
2323
@param in The Base16 string to decode
24+
@param inlen The length of the Base16 data
2425
@param out [out] The destination of the binary decoded data
2526
@param outlen [in/out] The max size and resulting size of the decoded data
2627
@return CRYPT_OK if successful

src/misc/base16/base16_encode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
@param inlen The length of the input buffer
2323
@param out [out] The destination of the Base16 encoded data
2424
@param outlen [in/out] The max size and resulting size of the encoded data
25-
@param caps Output 'a-f' on 0 and 'A-F' otherwise.
25+
@param options Output 'a-f' on 0 and 'A-F' otherwise.
2626
@return CRYPT_OK if successful
2727
*/
2828
int base16_encode(const unsigned char *in, unsigned long inlen,
2929
char *out, unsigned long *outlen,
30-
int caps)
30+
unsigned int options)
3131
{
3232
unsigned long i, x;
3333
const char *alphabet;
@@ -52,7 +52,7 @@ int base16_encode(const unsigned char *in, unsigned long inlen,
5252
x--;
5353
*outlen = x; /* returning the length without terminating NUL */
5454

55-
if (caps == 0) alphabet = alphabets[0];
55+
if (options == 0) alphabet = alphabets[0];
5656
else alphabet = alphabets[1];
5757

5858
for (i = 0; i < x; i += 2) {

0 commit comments

Comments
 (0)