Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/crypt.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6710,12 +6710,12 @@ \subsection{URL--safe 'base64url' encoding}
\begin{verbatim}
int base16_encode(const unsigned char *in, unsigned long inlen,
char *out, unsigned long *outlen,
int caps);
unsigned int options);
\end{verbatim}

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

To decode a base16 string call:

Expand Down
2 changes: 1 addition & 1 deletion src/headers/tomcrypt_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int base32_decode(const char *in, unsigned long inlen,
#ifdef LTC_BASE16
int base16_encode(const unsigned char *in, unsigned long inlen,
char *out, unsigned long *outlen,
int caps);
unsigned int options);
int base16_decode(const char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen);
#endif
Expand Down
1 change: 1 addition & 0 deletions src/misc/base16/base16_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
Base16 decode a string
@param in The Base16 string to decode
@param inlen The length of the Base16 data
@param out [out] The destination of the binary decoded data
@param outlen [in/out] The max size and resulting size of the decoded data
@return CRYPT_OK if successful
Expand Down
6 changes: 3 additions & 3 deletions src/misc/base16/base16_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
@param inlen The length of the input buffer
@param out [out] The destination of the Base16 encoded data
@param outlen [in/out] The max size and resulting size of the encoded data
@param caps Output 'a-f' on 0 and 'A-F' otherwise.
@param options Output 'a-f' on 0 and 'A-F' otherwise.
@return CRYPT_OK if successful
*/
int base16_encode(const unsigned char *in, unsigned long inlen,
char *out, unsigned long *outlen,
int caps)
unsigned int options)
{
unsigned long i, x;
const char *alphabet;
Expand All @@ -52,7 +52,7 @@ int base16_encode(const unsigned char *in, unsigned long inlen,
x--;
*outlen = x; /* returning the length without terminating NUL */

if (caps == 0) alphabet = alphabets[0];
if (options == 0) alphabet = alphabets[0];
else alphabet = alphabets[1];

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