summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/webrtc/rtc_base/sha1.h
blob: f3242b34989a14baf8a836b930dc532dc0e724b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * SHA-1 in C
 * By Steve Reid <sreid@sea-to-sky.net>
 * 100% Public Domain
 *
*/

// Ported to C++, Google style, under namespace rtc.

#ifndef RTC_BASE_SHA1_H_
#define RTC_BASE_SHA1_H_

#include <stdint.h>
#include <stdlib.h>

namespace rtc {

struct SHA1_CTX {
  uint32_t state[5];
  // TODO: Change bit count to uint64_t.
  uint32_t count[2];  // Bit count of input.
  uint8_t buffer[64];
};

#define SHA1_DIGEST_SIZE 20

void SHA1Init(SHA1_CTX* context);
void SHA1Update(SHA1_CTX* context, const uint8_t* data, size_t len);
void SHA1Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]);

}  // namespace rtc

#endif  // RTC_BASE_SHA1_H_