diff --git a/collects/file/md5.ss b/collects/file/md5.ss index 185cdb2af4..f0701f3e00 100644 --- a/collects/file/md5.ss +++ b/collects/file/md5.ss @@ -72,6 +72,7 @@ ;; 2009-12-20 / Eli ;; - `mzscheme' -> `scheme/base' ;; - moved from mzlib/md5 to file/md5 +;; - made it work on strings again (require (for-syntax scheme/base)) @@ -220,9 +221,10 @@ [(a-thing) (md5 a-thing #t)] [(a-thing hex-encode?) (let ([a-port - (cond [(bytes? a-thing) (open-input-bytes a-thing)] + (cond [(bytes? a-thing) (open-input-bytes a-thing)] + [(string? a-thing) (open-input-string a-thing)] [(input-port? a-thing) a-thing] - [else (raise-type-error 'md5 "input-port or bytes" + [else (raise-type-error 'md5 "input-port, bytes, or string" a-thing)])]) (encode (step4 a-port) hex-encode?))])) diff --git a/collects/file/scribblings/md5.scrbl b/collects/file/scribblings/md5.scrbl index a8ec5ccf80..082941703b 100644 --- a/collects/file/scribblings/md5.scrbl +++ b/collects/file/scribblings/md5.scrbl @@ -11,7 +11,7 @@ @defmodule[file/md5] -@defproc[(md5 [in (or/c input-port? bytes?)]) bytes?]{ +@defproc[(md5 [in (or/c input-port? bytes? string?)]) bytes?]{ Produces a byte string containing 32 hexadecimal digits (lowercase) that is the MD5 hash of the given input stream or byte string.