crypto1.h 904 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct {
  8. uint32_t odd;
  9. uint32_t even;
  10. } Crypto1;
  11. void crypto1_reset(Crypto1* crypto1);
  12. void crypto1_init(Crypto1* crypto1, uint64_t key);
  13. uint8_t crypto1_bit(Crypto1* crypto1, uint8_t in, int is_encrypted);
  14. uint8_t crypto1_byte(Crypto1* crypto1, uint8_t in, int is_encrypted);
  15. uint32_t crypto1_word(Crypto1* crypto1, uint32_t in, int is_encrypted);
  16. uint32_t crypto1_filter(uint32_t in);
  17. uint32_t prng_successor(uint32_t x, uint32_t n);
  18. void crypto1_decrypt(
  19. Crypto1* crypto,
  20. uint8_t* encrypted_data,
  21. uint16_t encrypted_data_bits,
  22. uint8_t* decrypted_data);
  23. void crypto1_encrypt(
  24. Crypto1* crypto,
  25. uint8_t* keystream,
  26. uint8_t* plain_data,
  27. uint16_t plain_data_bits,
  28. uint8_t* encrypted_data,
  29. uint8_t* encrypted_parity);
  30. #ifdef __cplusplus
  31. }
  32. #endif