[crypticl-cvs] CVS crypticl/src

tskogan tskogan at common-lisp.net
Sat Feb 17 01:08:58 UTC 2007


Update of /project/crypticl/cvsroot/crypticl/src
In directory clnet:/tmp/cvs-serv19611/src

Modified Files:
	utilities.lisp sha.lisp common.lisp 
Log Message:
Cleanup.Fix broken pdf.


--- /project/crypticl/cvsroot/crypticl/src/utilities.lisp	2007/02/04 20:58:00	1.11
+++ /project/crypticl/cvsroot/crypticl/src/utilities.lisp	2007/02/17 01:08:58	1.12
@@ -5,9 +5,6 @@
 ;;;; Author: Taale Skogan
 ;;;; Distribution:  See the accompanying file LICENSE.
 
-;;To do:
-;;-testvectors
-
 (in-package crypticl)
 
 
@@ -24,8 +21,6 @@
       ((>= ,var ,gstop))
        , at body)))
 
-
-
 (defun octet-vector-to-integer 
     (vector &optional (start 0) (end (length vector)))
   "Represents 8 bits byte string as integer. Assumes byte is 8 bits. Uses big endian format. Vector must be an array of bytes"
@@ -71,7 +66,6 @@
 	(coerce (ldb bytespec integer) '(unsigned-byte 8))))
     result))
 
-
 (defun int-as-octet-vector-add (ov n)
   "Add n to octet vector ov and keep size of octet vector."
   (integer-to-octet-vector (+ (octet-vector-to-integer ov) n) :vector ov))
@@ -101,9 +95,6 @@
 	(write-string (format nil "~2,'0X" x) str)
 	(incf count)))))
 	   
-     
-  
-
 (defun  hex-prepad-zero (ov size)
   "Size is minimum length in octets. NB! One octet = 2 hex litterals."
   (let* ((out (hex ov))
@@ -112,11 +103,6 @@
 	(concat (make-string (* 2 prefix-length) :initial-element #\0)
 		out)
       out)))
-    
- 
-
-;;;(defun byte-vector-to-hex-string (bv) "Legacy support. Will be removed"
-;;;  (octet-vector-to-hex-string bv))
 
 (defun hexo (str)
   (hex-string-to-octet-vector str))
@@ -144,8 +130,6 @@
 	  (parse-integer
 	   str :start str-offset :end (+ 1 str-offset) :radix 16))))))
 	  
-
-
 (defun insert-space (string)
   "Inserts a space between every 8th char in a string. Useful for pretty-printing a SHA-1 hash string."
   (let ((new-string ""))
@@ -158,7 +142,6 @@
 	  (concatenate 'string 
 	    new-string (format nil "~A" (aref string i))))))))
 
-
 (defun octet-vector-copy (in &optional (start 0) (end (length in))
                                        out (out-start 0))
   "Returns copy of input vector or copies it into out at the given offset."
@@ -187,15 +170,13 @@
    ((every #'vectorp args) (apply #'concatenate (cons 'vector args)))
    (t (error "Invalid types ~A" args))))
 
+
 (defun make-str (lst)
   "Construct a string from a list of string"
   (with-output-to-string (str)
     (dolist (s lst)
       (write-string s str))))
 
-
-;;;; String utilities
-
 (defun split-seq (seq pred &key (start 0) end key strict)
   "Return a list of subseq's of SEQ, split on predicate PRED.
 Start from START, end with END.  If STRICT is non-nil, collect
@@ -225,7 +206,6 @@
       (unless (equal (aref v1 i) (aref v2 i))
 	(return nil)))))
 
-
 (defun string-startswith (s prefix)
   "Return true if the string s starts with the given prefix"
   (let ((len (length prefix)))
@@ -251,6 +231,5 @@
 the same platform."
   (map 'string #'code-char octet-vector))
 
-
 (defun make-byte-array (size)  
   (make-array size :element-type '(unsigned-byte 8) :initial-element 0))
\ No newline at end of file
--- /project/crypticl/cvsroot/crypticl/src/sha.lisp	2007/01/20 15:46:59	1.11
+++ /project/crypticl/cvsroot/crypticl/src/sha.lisp	2007/02/17 01:08:58	1.12
@@ -389,25 +389,21 @@
     (dolist (x test-list (format t "OK."))
       (let ((in (first x))
 	    (ex (second x)))
-	(assert (string= (octet-vector-to-hex-string
-			  (sha-1-on-octet-vector in)) ex)()
+	(assert (string= (hex (sha-1-on-octet-vector in)) ex)()
 	  "sha-1 test for input string ~A~%" in)
 
 	(let ((obj (make-SHA-1)))
           ;; Test hash only.
-	  (assert (string= (octet-vector-to-hex-string
-			    (hash obj in)) ex) ()
+	  (assert (string= (hex (hash obj in)) ex) ()
 	    "sha-1 CLOS test for input string ~A~%" in)
           ;; Test add and hash.
 	  (update obj in)   
-	  (assert (string= (octet-vector-to-hex-string
-			    (hash obj)) ex) ()
+	  (assert (string= (hex (hash obj)) ex) ()
 	    "sha-1 CLOS update+hash test for input string ~A~%" in))))
 
     (when test-long
       (format t "Testing long vector. This may take some seconds...~%")
-      (assert (string= (octet-vector-to-hex-string
-			(sha-1-on-octet-vector #200000(2)))
+      (assert (string= (hex (sha-1-on-octet-vector #200000(2)))
 		       "f4c046625d9c6672e0356bbe0ed5cd93adfa924b") ()
 	"sha-1 test for long test vector 200000.")
       (format t "Done testing long vector.~%"))))
--- /project/crypticl/cvsroot/crypticl/src/common.lisp	2007/01/20 19:33:41	1.10
+++ /project/crypticl/cvsroot/crypticl/src/common.lisp	2007/02/17 01:08:58	1.11
@@ -1,15 +1,10 @@
 ;;;;-*-lisp-*-
 ;;;; The Crypticl cryptographic library.
 ;;;;
-;;;; Description: Common functionality.
+;;;; Description: Common functionality across cryptographic primitives.
 ;;;; Author: Taale Skogan
 ;;;; Distribution:  See the accompanying file LICENSE.
 
-;; TODO:
-;;-register constructors for byte-encoding constructors in the same way 
-;; as for normal constructors.
-;;-better spki string encoding with type.
-
 (in-package crypticl)
 
 (defun print-external-symbols ()




More information about the Crypticl-cvs mailing list