1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* Simple class for computing SHA1. */
9 * To compute the SHA1 of a buffer using this class you should write something
11 * void SHA1(const uint8_t* buf, unsigned size, uint8_t hash[20])
14 * S.update(buf, size);
17 * If there are multiple buffers or chunks, the update method can be called
18 * multiple times and the SHA1 is computed on the concatenation of all the
19 * buffers passed to it.
20 * The finish method may only be called once and cannot be followed by calls
24 #ifndef mozilla_SHA1_h_
25 #define mozilla_SHA1_h_
27 #include "mozilla/StandardInteger.h"
31 uint32_t w
[16]; /* input buffer */
34 uint64_t size
; /* count of hashed bytes. */
35 unsigned H
[22]; /* 5 state variables, 16 tmp values, 1 extra */
39 static const unsigned int HashSize
= 20;
41 void update(const uint8_t *dataIn
, uint32_t len
);
42 void finish(uint8_t hashout
[20]);
46 #endif /* mozilla_SHA1_h_ */