Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

hmac_sha512.h 776B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) 2014 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_HMAC_SHA512_H
  5. #define STARWELS_CRYPTO_HMAC_SHA512_H
  6. #include "crypto/sha512.h"
  7. #include <stdint.h>
  8. #include <stdlib.h>
  9. /** A hasher class for HMAC-SHA-512. */
  10. class CHMAC_SHA512
  11. {
  12. private:
  13. CSHA512 outer;
  14. CSHA512 inner;
  15. public:
  16. static const size_t OUTPUT_SIZE = 64;
  17. CHMAC_SHA512(const unsigned char* key, size_t keylen);
  18. CHMAC_SHA512& Write(const unsigned char* data, size_t len)
  19. {
  20. inner.Write(data, len);
  21. return *this;
  22. }
  23. void Finalize(unsigned char hash[OUTPUT_SIZE]);
  24. };
  25. #endif // STARWELS_CRYPTO_HMAC_SHA512_H