X-Git-Url: http://git.kpe.io/?p=md5.git;a=blobdiff_plain;f=md5.lisp;h=e0f87b78c2f4cf0bd92c2f04debe535f7db665e9;hp=941f1884830d211aaefe9134beef950c59cdc790;hb=1d6c29ab81a2bb80496fb37d1eb70928b181ff35;hpb=40f3c97fb68ce35a0eaaa6cc66768f3b3ca8751b diff --git a/md5.lisp b/md5.lisp index 941f188..e0f87b7 100644 --- a/md5.lisp +++ b/md5.lisp @@ -5,7 +5,7 @@ ;;;; cmucl-help mailing-list hosted at cons.org, in November 2001 and ;;;; has been placed into the public domain. ;;;; -;;;; $Id: md5.lisp,v 1.3 2003/05/04 19:12:26 kevin Exp $ +;;;; $Id$ ;;;; ;;;; While the implementation should work on all conforming Common ;;;; Lisp implementations, it has only been optimized for CMU CL, @@ -63,9 +63,10 @@ ;;; Section 2: Basic Datatypes -(deftype ub32 () - "Corresponds to the 32bit quantity word of the MD5 Spec" - `(unsigned-byte 32)) +(eval-when (:compile-toplevel :load-toplevel :execute) + (deftype ub32 () + "Corresponds to the 32bit quantity word of the MD5 Spec" + `(unsigned-byte 32))) (defmacro assemble-ub32 (a b c d) "Assemble an ub32 value from the given (unsigned-byte 8) values, @@ -206,9 +207,9 @@ accordingly." (declare (type md5-regs regs) (type (simple-array ub32 (16)) block) (optimize (speed 3) (safety 0) (space 0) (debug 0))) - (let ((a (md5-regs-a regs)) (b (md5-regs-b regs)) - (c (md5-regs-c regs)) (d (md5-regs-d regs))) - (declare (type ub32 a b c d)) + (let ((A (md5-regs-a regs)) (B (md5-regs-b regs)) + (C (md5-regs-c regs)) (D (md5-regs-d regs))) + (declare (type ub32 A B C D)) ;; Round 1 (with-md5-round (f block) (A B C D 0 7 1)(D A B C 1 12 2)(C D A B 2 17 3)(B C D A 3 22 4) @@ -234,10 +235,10 @@ accordingly." (A B C D 8 6 57)(D A B C 15 10 58)(C D A B 6 15 59)(B C D A 13 21 60) (A B C D 4 6 61)(D A B C 11 10 62)(C D A B 2 15 63)(B C D A 9 21 64)) ;; Update and return - (setf (md5-regs-a regs) (mod32+ (md5-regs-a regs) a) - (md5-regs-b regs) (mod32+ (md5-regs-b regs) b) - (md5-regs-c regs) (mod32+ (md5-regs-c regs) c) - (md5-regs-d regs) (mod32+ (md5-regs-d regs) d)) + (setf (md5-regs-a regs) (mod32+ (md5-regs-a regs) A) + (md5-regs-b regs) (mod32+ (md5-regs-b regs) B) + (md5-regs-c regs) (mod32+ (md5-regs-c regs) C) + (md5-regs-d regs) (mod32+ (md5-regs-d regs) D)) regs)) ;;; Section 3.4: Converting 8bit-vectors into 16-Word Blocks @@ -508,9 +509,10 @@ simple-arrays with such element types." (update-md5-state state sequence :start start :end real-end)) (finalize-md5-state state))) -(defconstant +buffer-size+ (* 128 1024) - "Size of internal buffer to use for md5sum-stream and md5sum-file -operations. This should be a multiple of 64, the MD5 block size.") +(eval-when (:compile-toplevel :load-toplevel :execute) + (defconstant +buffer-size+ (* 128 1024) + "Size of internal buffer to use for md5sum-stream and md5sum-file +operations. This should be a multiple of 64, the MD5 block size.")) (deftype buffer-index () `(integer 0 ,+buffer-size+))