Check-in [aef7825f91]
Overview
Comment:Changed hex output to use lowercase letters
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | crypto
Files: files | file ages | folders
SHA3-256: aef7825f9134e3548fd26767ad72295a030ef5368558ca8b2f9a6a20a398a20d
User & Date: bohagan on 2023-11-13 03:14:16
Other Links: branch diff | manifest | tags
Context
2023-11-14
00:53
Updated error messages and optimized when to add error message to result. check-in: 2b4e85a3eb user: bohagan tags: crypto
2023-11-13
03:14
Changed hex output to use lowercase letters check-in: aef7825f91 user: bohagan tags: crypto
02:26
Corrected test cases check-in: 1d173cfaca user: bohagan tags: crypto
Changes
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27







-
+







#include <stdio.h>
#include <string.h>
#include <openssl/evp.h>
#include <openssl/cmac.h>
#include <openssl/hmac.h>

/* Constants */
const char *hex = "0123456789ABCDEF";
const char *hex = "0123456789abcdef";

/* Macros */
#define BUFFER_SIZE 65536
#define CHAN_EOF 0x10

/* Digest format and operation */
#define BIN_FORMAT 0x01
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34







-
+







/*
 * Binary string to hex string
 */
int String_to_Hex(unsigned char* input, int ilen, unsigned char *output, int olen) {
    int count = 0;
    unsigned char *iptr = input;
    unsigned char *optr = &output[0];
    const char *hex = "0123456789ABCDEF";
    const char *hex = "0123456789abcdef";

    for (int i = 0; i < ilen && count < olen - 1; i++, count += 2) {
        *optr++ = hex[(*iptr>>4)&0xF];
        *optr++ = hex[(*iptr++)&0xF];
    }
    *optr = 0;
    return count;