;;;; message-digest-item.scm -*- Scheme -*- ;;;; Kon Lovett, Jul '18 ;;;; Kon Lovett, Aug '17 ;;;; Kon Lovett, Apr '12 ;;;; Kon Lovett, May '10 (message-digest.scm) ;;;; Kon Lovett, Jan '06 (message-digest.scm) (module message-digest-item (;export ; message-digest-object message-digest-file message-digest-port ; message-digest-object! message-digest-file! message-digest-port!) (import scheme (chicken base) (chicken type) message-digest-type message-digest-update-item) (include-relative "message-digest.types") (define-type pathname string) (: message-digest-object (message-digest-kind * #!rest -> message-digest-result-type)) (: message-digest-file (message-digest-kind pathname #!rest -> message-digest-result-type)) (: message-digest-port (message-digest-kind output-port #!rest -> message-digest-result-type)) (: message-digest-object! (message-digest-kind * message-digest-buffer #!rest -> message-digest-result-type)) (: message-digest-file! (message-digest-kind pathname message-digest-buffer -> message-digest-result-type)) (: message-digest-port! (message-digest-kind output-port message-digest-buffer -> message-digest-result-type)) ;; Single Source API ;; (define (message-digest-object mdk obj . opts) (let-optionals* opts ((restyp (message-digest-result-form)) (start 0) (end #f) ) (let ((md (initialized-message-digest mdk))) (message-digest-update-object md obj start end) (finalize-message-digest md restyp) ) ) ) (define (message-digest-file mdk flnm . opts) (let-optionals* opts ((restyp (message-digest-result-form))) (let ((md (initialized-message-digest mdk))) (message-digest-update-file md flnm) (finalize-message-digest md restyp) ) ) ) (define (message-digest-port mdk port . opts) (let-optionals* opts ((restyp (message-digest-result-form))) (let ((md (initialized-message-digest mdk))) (message-digest-update-port md port) (finalize-message-digest md restyp) ) ) ) ;; (define (message-digest-object! mdk obj buf . opts) (let-optionals* opts ((start 0) (end #f) ) (let ((md (initialized-message-digest mdk))) (message-digest-update-object md obj start end) (finalize-message-digest! md buf) ) ) ) (define (message-digest-file! mdk flnm buf) (let ((md (initialized-message-digest mdk))) (message-digest-update-file md flnm) (finalize-message-digest! md buf) ) ) (define (message-digest-port! mdk port buf) (let ((md (initialized-message-digest mdk))) (message-digest-update-port md port) (finalize-message-digest! md buf) ) ) ) ;module message-digest-item