1 #ifndef PYCABCRYPT 2 #define PYCABCRYPT 3 4 #include <sys/types.h> 5 #include <string.h> 6 #include <stdio.h> 7 #include "portable_endian.h" 8 9 #if defined(_WIN32) 10 typedef unsigned char uint8_t; 11 typedef uint8_t u_int8_t; 12 typedef unsigned short uint16_t; 13 typedef uint16_t u_int16_t; 14 typedef unsigned uint32_t; 15 typedef uint32_t u_int32_t; 16 typedef unsigned long long uint64_t; 17 typedef uint64_t u_int64_t; 18 #define snprintf _snprintf 19 #define __attribute__(unused) 20 #elif defined(__sun) 21 typedef uint8_t u_int8_t; 22 typedef uint16_t u_int16_t; 23 typedef uint32_t u_int32_t; 24 typedef uint64_t u_int64_t; 25 #else 26 #include <stdint.h> 27 #endif 28 29 #define explicit_bzero(s,n) memset(s, 0, n) 30 #define DEF_WEAK(f) 31 32 int bcrypt_hashpass(const char *key, const char *salt, char *encrypted, size_t encryptedlen); 33 int encode_base64(char *, const u_int8_t *, size_t); 34 int timingsafe_bcmp(const void *b1, const void *b2, size_t n); 35 int bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt, size_t saltlen, uint8_t *key, size_t keylen, unsigned int rounds); 36 37 #endif 38 39