(import-os-error-syscall %crypt (key salt) "scm_crypt") (define (crypt key salt) (let* ((allowed-char-set (rx (| alpha digit "." "/"))) (salt-regexp (rx (: ,allowed-char-set ,allowed-char-set)))) (if (not (= (string-length salt) 2)) (error "salt must have length 2")) (if (not (regexp-search? salt-regexp salt)) (error "illegal char in salt " salt)) (if (> (string-length key) 8) (error "key too long " (string-length key))) (%crypt key salt)))