(foreign-declare "#include \"implementations/MD5/crypt_md5.c\"") ;; TODO: setting with "$apr1$" ;; 3 bytes salt (where is that used?) (define (crypt-md5 password setting) ;; 6 bytes of salt => 8 characters ;; 16 bytes of hash => 22 characters ;; 3 for "$1$" + 8 for salt + 1 for "$" + 22 for hash = 34 ASCII chars or bytes (let ((output (make-string 34))) (if ((foreign-lambda c-pointer "md5_crypt" c-string c-string scheme-pointer) password setting output) output ;; TODO: implement proper error handling (error "Error running MD5 crypt"))))