A simple CyaSSL-based HMAC-MD5 implementation. Licensed under GPL v2.

Dependents:   RFrec_full RFtrans_full

The output will be base64-encoded, with trailing "==", like this:

j62o/jZsAZD9i9m+32lIuQ==

Example

#include "mbed.h"
#include "hmac_md5.h"

Serial pc(USBTX, USBRX); // tx, rx

void main(void)
{
    
    const char * key = "MySecretKey";
    
    const char * text = "message to be signed";
    
    char output[26];
    
    HMAC_MD5(key, text, output);

    printf("result = %s\n", output);

    while(true){}
}
Committer:
igrokhotkov
Date:
Wed Feb 06 20:35:03 2013 +0000
Revision:
0:83f3dcfa5c8f
initial revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
igrokhotkov 0:83f3dcfa5c8f 1 /* coding.h
igrokhotkov 0:83f3dcfa5c8f 2 *
igrokhotkov 0:83f3dcfa5c8f 3 * Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
igrokhotkov 0:83f3dcfa5c8f 4 *
igrokhotkov 0:83f3dcfa5c8f 5 * This file is part of CyaSSL.
igrokhotkov 0:83f3dcfa5c8f 6 *
igrokhotkov 0:83f3dcfa5c8f 7 * CyaSSL is free software; you can redistribute it and/or modify
igrokhotkov 0:83f3dcfa5c8f 8 * it under the terms of the GNU General Public License as published by
igrokhotkov 0:83f3dcfa5c8f 9 * the Free Software Foundation; either version 2 of the License, or
igrokhotkov 0:83f3dcfa5c8f 10 * (at your option) any later version.
igrokhotkov 0:83f3dcfa5c8f 11 *
igrokhotkov 0:83f3dcfa5c8f 12 * CyaSSL is distributed in the hope that it will be useful,
igrokhotkov 0:83f3dcfa5c8f 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
igrokhotkov 0:83f3dcfa5c8f 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
igrokhotkov 0:83f3dcfa5c8f 15 * GNU General Public License for more details.
igrokhotkov 0:83f3dcfa5c8f 16 *
igrokhotkov 0:83f3dcfa5c8f 17 * You should have received a copy of the GNU General Public License
igrokhotkov 0:83f3dcfa5c8f 18 * along with this program; if not, write to the Free Software
igrokhotkov 0:83f3dcfa5c8f 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
igrokhotkov 0:83f3dcfa5c8f 20 */
igrokhotkov 0:83f3dcfa5c8f 21
igrokhotkov 0:83f3dcfa5c8f 22
igrokhotkov 0:83f3dcfa5c8f 23 #ifndef CTAO_CRYPT_CODING_H
igrokhotkov 0:83f3dcfa5c8f 24 #define CTAO_CRYPT_CODING_H
igrokhotkov 0:83f3dcfa5c8f 25
igrokhotkov 0:83f3dcfa5c8f 26 #include "types.h"
igrokhotkov 0:83f3dcfa5c8f 27
igrokhotkov 0:83f3dcfa5c8f 28 #ifdef __cplusplus
igrokhotkov 0:83f3dcfa5c8f 29 extern "C" {
igrokhotkov 0:83f3dcfa5c8f 30 #endif
igrokhotkov 0:83f3dcfa5c8f 31
igrokhotkov 0:83f3dcfa5c8f 32
igrokhotkov 0:83f3dcfa5c8f 33 /* decode needed by CyaSSL */
igrokhotkov 0:83f3dcfa5c8f 34 CYASSL_LOCAL int Base64_Decode(const byte* in, word32 inLen, byte* out,
igrokhotkov 0:83f3dcfa5c8f 35 word32* outLen);
igrokhotkov 0:83f3dcfa5c8f 36
igrokhotkov 0:83f3dcfa5c8f 37 CYASSL_API int Base64_Encode(const byte* in, word32 inLen, byte* out,
igrokhotkov 0:83f3dcfa5c8f 38 word32* outLen);
igrokhotkov 0:83f3dcfa5c8f 39
igrokhotkov 0:83f3dcfa5c8f 40 #if defined(OPENSSL_EXTRA) || defined(SESSION_CERTS) || defined(CYASSL_KEY_GEN) || defined(CYASSL_CERT_GEN) || defined(HAVE_WEBSERVER)
igrokhotkov 0:83f3dcfa5c8f 41 CYASSL_LOCAL
igrokhotkov 0:83f3dcfa5c8f 42 int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen);
igrokhotkov 0:83f3dcfa5c8f 43 #endif
igrokhotkov 0:83f3dcfa5c8f 44
igrokhotkov 0:83f3dcfa5c8f 45 #ifdef __cplusplus
igrokhotkov 0:83f3dcfa5c8f 46 } /* extern "C" */
igrokhotkov 0:83f3dcfa5c8f 47 #endif
igrokhotkov 0:83f3dcfa5c8f 48
igrokhotkov 0:83f3dcfa5c8f 49 #endif /* CTAO_CRYPT_CODING_H */
igrokhotkov 0:83f3dcfa5c8f 50