Download | Plain Text | No Line Numbers


  1. #ifndef CIPHER_H
  2. #define CIPHER_H
  3.  
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #endif
  8.  
  9. #include <stdint.h>
  10.  
  11. /* size of key */
  12. #define KEY_SIZE 256
  13.  
  14. typedef struct
  15. {
  16. char *out; /* pointer to output buffer */
  17. char cipher[KEY_SIZE]; /* cipher used for decryption */
  18. uint32_t ret; /* internal */
  19. uint32_t off1; /* internal */
  20. uint32_t off2; /* internal */
  21. uint32_t prepend_hashkey; /* use for omit prepending a hashkey */
  22. uint32_t unused;
  23. } ctx_t;
  24.  
  25. /*
  26.  * returns number of initialized cipher values
  27.  * that's always KEY_SIZE (=256)
  28.  */
  29. extern int CipherInit(ctx_t *ctx);
  30.  
  31. /*
  32.  * returns number of "decrypted" bytes written to output buffer
  33.  * NOTE: that's in_len+1 on first run (hashkey will be prepended)
  34.  * and in_len for the rest
  35.  */
  36. extern uint32_t CipherUpdate(ctx_t *ctx, const char *in_data, uint32_t in_len);
  37.  
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41.  
  42. #endif
  43.