crypto1.h 836 B

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