(define (hexencode str) (let loop ((l (reverse (string->list str))) (r "")) (if (null? l) r (let ((n (char->integer (car l)))) (if (< n 16) (loop (cdr l) (string-append "0" (number->string n 16) r)) (loop (cdr l) (string-append (number->string n 16) r))))))) (define md5sum (let ((d (digest-by-name "md5"))) (lambda (f) (hexencode (file-digest d f))))) (define sha1sum (let ((d (digest-by-name "sha1"))) (lambda (f) (hexencode (file-digest d f))))) ; this gives different values for the same file with different names.