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.

chacha20.h 673B

1234567891011121314151617181920212223242526
  1. // Copyright (c) 2017 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_CHACHA20_H
  5. #define STARWELS_CRYPTO_CHACHA20_H
  6. #include <stdint.h>
  7. #include <stdlib.h>
  8. /** A PRNG class for ChaCha20. */
  9. class ChaCha20
  10. {
  11. private:
  12. uint32_t input[16];
  13. public:
  14. ChaCha20();
  15. ChaCha20(const unsigned char* key, size_t keylen);
  16. void SetKey(const unsigned char* key, size_t keylen);
  17. void SetIV(uint64_t iv);
  18. void Seek(uint64_t pos);
  19. void Output(unsigned char* output, size_t bytes);
  20. };
  21. #endif // STARWELS_CRYPTO_CHACHA20_H