Advertisement
aaaaaa123456789

sha256.h

Oct 25th, 2014
221
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.    This header file is hereby released to the public domain.
  3.    ~aaaaaa123456789, 2014-10-25
  4. */
  5. #ifndef SHA256
  6.  
  7. #define SHA256
  8.  
  9. #ifdef __cplusplus
  10.   extern "C" {
  11. #endif
  12.  
  13. enum sha256_opcodes {
  14.   // inputs
  15.   SHA256_IN_BLOCK = 0,
  16.   SHA256_IN_BUFFER = 1,
  17.   SHA256_IN_FILE = 2,
  18.   SHA256_IN_FILENAME = 3,
  19.   // outputs
  20.   SHA256_OUT_WORDS = 0, // 32 bits
  21.   SHA256_OUT_BYTES = 4,
  22.   SHA256_OUT_LONGS = 8, // 64 bits
  23.   SHA256_OUT_STRING = 12,
  24.   // flags
  25.   SHA256_LENGTH_BITS = 16, // length is in bits
  26.   SHA256_REVERSE_WORDS = 32, // reverse word order
  27.   SHA256_UPPERCASE_HEX = 64, // hex digits A-F are uppercase in string outputs
  28.   SHA256_REVERSE_ENDIAN = 64, // when not returning 32-bit words
  29. };
  30.  
  31. enum sha256_errors {
  32.   SHA256_INVALID_OPCODE = 1,
  33.   SHA256_FILE_NOT_FOUND = 2,
  34.   SHA256_INVALID_ARGUMENT = 3,
  35.   SHA256_IO_ERROR = 4,
  36.   SHA256_PREMATURE_EOF = 5,
  37. };
  38.  
  39. int sha256(int op, void * in, void * out, long long skip, long long length);
  40.  
  41. #ifdef __cplusplus
  42.   }
  43. #endif
  44.  
  45. #endif
Advertisement
RAW Paste Data Copied
Advertisement