1 /*Copyright (c) Brian B.
3 This library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public
5 License as published by the Free Software Foundation; either
6 version 3 of the License, or (at your option) any later version.
7 See the file LICENSE included with this distribution for more
10 Portions Copyright (c) 1994, Regents of the University of California
19 #define SHA_BLOCK_LEN 64
20 #define SHA_DIGEST_LEN 32
21 #define SHA_DIGEST_STRLEN (SHA_DIGEST_LEN * 2 + 1)
22 #define HMAC_IPAD 0x36
23 #define HMAC_OPAD 0x5C
28 uint8_t buf
[SHA_BLOCK_LEN
];
30 void sha_init (sha_t
*ctx
);
31 void sha_update (sha_t
*ctx
, const uint8_t *data
, size_t len
);
32 void sha_final (sha_t
*ctx
, uint8_t *digest
);
36 uint8_t ipad
[SHA_BLOCK_LEN
];
37 uint8_t opad
[SHA_BLOCK_LEN
];
39 void hmac_init (hmac_t
*ctx
, uint8_t *key
, size_t len
);
40 void hmac_update (hmac_t
*ctx
, const uint8_t *data
, size_t len
);
41 void hmac_final (hmac_t
*ctx
, uint8_t *dst
, size_t len
);