Add test for challenge 1 (hex to base64)
This commit is contained in:
parent
2fb3ea46fc
commit
067ad59444
4 changed files with 35 additions and 17 deletions
5
utils.c
5
utils.c
|
@ -36,9 +36,8 @@ size_t hex_to_bytes(unsigned char *out, const char hex[static 1]) {
|
|||
return strlen(hex) / 2 + strlen(hex) % 2;
|
||||
}
|
||||
|
||||
unsigned char *bytes_to_base64(unsigned char *out,
|
||||
const unsigned char in[static 1], size_t len) {
|
||||
static const unsigned char base64_table[65] =
|
||||
char *bytes_to_base64(char *out, const unsigned char in[static 1], size_t len) {
|
||||
static const char base64_table[65] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
for (size_t i = 0; i < len - 2; i += 3) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue