blowfish.h 1003 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stddef.h>
  4. #define STATUS_BLOWFISH_SUCCESS 0
  5. #define STATUS_BLOWFISH_INVALID_KEY_LENGTH (-1)
  6. #define STATUS_BLOWFISH_KEY_TOO_LONG (-2)
  7. #define BLOWFISH_LITTLE_ENDIAN 0
  8. #define BLOWFISH_BIG_ENDIAN 1
  9. #define BLOWFISH_MIN_KEY_LENGTH 1
  10. #define BLOWFISH_MAX_KEY_LENGTH 56
  11. #define BLOWFISH_BLOCK_SIZE 8
  12. #if defined(__cplusplus)
  13. extern "C" {
  14. #endif
  15. typedef struct _BLOWFISH_KEY {
  16. uint32_t SubKey[18];
  17. uint32_t SBox[4][256];
  18. } BLOWFISH_KEY;
  19. void accelc_Blowfish_encrypt(uint8_t srcBytes[8],
  20. const BLOWFISH_KEY* srcKey,
  21. int Endian);
  22. void accelc_Blowfish_decrypt(uint8_t srcBytes[8],
  23. const BLOWFISH_KEY* srcKey,
  24. int Endian);
  25. int accelc_Blowfish_set_key(const uint8_t srcUserKey[], uint8_t UserKeyLength,
  26. BLOWFISH_KEY* dstKey);
  27. #if defined(__cplusplus)
  28. }
  29. #endif