1 // Copyright 2021 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_HASH_SHA1_NACL_H_ 6 #define BASE_HASH_SHA1_NACL_H_ 7 8 #include <stdint.h> 9 10 namespace base { 11 12 // Used for storing intermediate data during an SHA1 computation. Callers 13 // should not access the data. 14 class SHA1Context { 15 public: 16 void Init(); 17 void Update(const void* data, size_t nbytes); 18 void Final(); 19 const unsigned char* GetDigest() const; 20 21 private: 22 void Pad(); 23 void Process(); 24 25 uint32_t A, B, C, D, E; 26 27 uint32_t H[5]; 28 29 union { 30 uint32_t W[80]; 31 uint8_t M[64]; 32 }; 33 34 uint32_t cursor; 35 uint64_t l; 36 }; 37 38 } // namespace base 39 40 #endif // BASE_HASH_SHA1_NACL_H_ 41