You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sha1.h 647B

12345678910111213141516171819202122232425262728
  1. // Copyright (c) 2014-2016 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef STARWELS_CRYPTO_SHA1_H
  5. #define STARWELS_CRYPTO_SHA1_H
  6. #include <stdint.h>
  7. #include <stdlib.h>
  8. /** A hasher class for SHA1. */
  9. class CSHA1
  10. {
  11. private:
  12. uint32_t s[5];
  13. unsigned char buf[64];
  14. uint64_t bytes;
  15. public:
  16. static const size_t OUTPUT_SIZE = 20;
  17. CSHA1();
  18. CSHA1& Write(const unsigned char* data, size_t len);
  19. void Finalize(unsigned char hash[OUTPUT_SIZE]);
  20. CSHA1& Reset();
  21. };
  22. #endif // STARWELS_CRYPTO_SHA1_H