scrypt.h 798 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef INCLUDE_SCRYPT_H_
  2. #define INCLUDE_SCRYPT_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stdint.h> /* uint8_t */
  7. #include <stdlib.h> /* size_t */
  8. typedef struct scrypt_state_s scrypt_state_t;
  9. struct scrypt_state_s {
  10. unsigned int r;
  11. unsigned int n;
  12. unsigned int p;
  13. size_t block_size;
  14. /* scrypt params */
  15. uint8_t* b;
  16. /* ro_mix params */
  17. uint8_t* x;
  18. uint8_t* v;
  19. uint8_t* t;
  20. };
  21. int scrypt_state_init(scrypt_state_t* state);
  22. void scrypt_state_destroy(scrypt_state_t* state);
  23. void scrypt(scrypt_state_t* state,
  24. const uint8_t* passphrase,
  25. size_t passphase_len,
  26. const uint8_t* salt,
  27. size_t salt_len,
  28. uint8_t* out,
  29. size_t out_len);
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif /* INCLUDE_SCRYPT_H_ */