• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2008 Google Inc. All Rights Reserved.
2 // Author: mschilder@google.com (Marius Schilder)
3 
4 #ifndef _EMBEDDED_SHA_H_
5 #define _EMBEDDED_SHA_H_
6 
7 #include <inttypes.h>
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif  // __cplusplus
12 
13 typedef struct SHA_CTX {
14   uint64_t count;
15   uint32_t state[5];
16   union {
17     uint8_t b[64];
18     uint32_t w[16];
19   } buf;
20 } SHA_CTX;
21 
22 void SHA_init(SHA_CTX* ctx);
23 void SHA_update(SHA_CTX* ctx, const void* data, int len);
24 const uint8_t* SHA_final(SHA_CTX* ctx);
25 
26 // Convenience method. Returns digest parameter value.
27 const uint8_t* SHA(const void* data, int len, uint8_t* digest);
28 
29 #define SHA_DIGEST_SIZE 20
30 
31 #ifdef __cplusplus
32 }
33 #endif  // __cplusplus
34 
35 #endif  // _EMBEDDED_SHA_H_
36