[crypticl-cvs] CVS crypticl/src

tskogan tskogan at common-lisp.net
Sun Jan 21 01:15:22 UTC 2007


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

Modified Files:
	utilities.lisp aes.lisp 
Log Message:
Porting to SBCL 1.0.1:
-force hex to return lowercase hex digits.
-replace defconstant with defparameter because of picky behavior in SBCL.


--- /project/crypticl/cvsroot/crypticl/src/utilities.lisp	2007/01/20 19:33:41	1.7
+++ /project/crypticl/cvsroot/crypticl/src/utilities.lisp	2007/01/21 01:15:22	1.8
@@ -67,10 +67,12 @@
   
 (defun octet-vector-to-hex-string (bv)
   "Returns a hex string representation of a byte vector. Does not ignore leading zeros."
-  (let ((hex-string ""))
-    (dotimes (i (length bv) hex-string )
-      (setf hex-string 
-	(concatenate 'string hex-string (format nil "~2,'0X" (aref bv i)))))))
+  (string-downcase 
+   (let ((hex-string ""))
+     (dotimes (i (length bv) hex-string )
+       (setf hex-string 
+         (concatenate 'string hex-string 
+                      (format nil "~2,'0X" (aref bv i))))))))
 
 (defun pp-hex (ov)
   "Pretty-print byte array in hex with 8 hex digits per block."
@@ -96,8 +98,7 @@
     
  
 
-;;;(defun byte-vector-to-hex-string (bv)
-;;;  "Legacy support. Will be removed"
+;;;(defun byte-vector-to-hex-string (bv) "Legacy support. Will be removed"
 ;;;  (octet-vector-to-hex-string bv))
 
 (defun hexo (str)
@@ -213,7 +214,7 @@
 Each character is converted to a single byte. Intended for working with
 ASCII strings and 8-bit encodings.
 "
-  (map '(simple-array (unsigned-byte 8))
+  (map '(simple-array (unsigned-byte 8) (*))
     ;; NB! char-code can return a number bigger than 8 bits
     #'(lambda (c) (ldb (byte 8 0) (char-code c))) s))
 
--- /project/crypticl/cvsroot/crypticl/src/aes.lisp	2007/01/18 21:50:37	1.7
+++ /project/crypticl/cvsroot/crypticl/src/aes.lisp	2007/01/21 01:15:22	1.8
@@ -22,10 +22,10 @@
 
 (in-package crypticl)
 
-(defconstant NB 4
+(defparameter NB 4
   "Number of 32 bits words in the state = number of columns in state. Equals variable BC in the reference implementation.")
 
-(defconstant logtable
+(defparameter logtable
   #(  0   0  25   1  50   2  26 198  75 199  27 104  51 238 223   3
    100   4 224  14  52 141 129 239  76 113   8 200 248 105  28 193
    125 194  29 181 249 185  39 106  77 228 166 114 154 201   9 120
@@ -44,7 +44,7 @@
    103  74 237 222 197  49 254  24  13  99 140 128 192 247 112   7)
   )
 
-(defconstant alogtable
+(defparameter alogtable
   #(  1   3   5  15  17  51  85 255  26  46 114 150 161 248  19  53
     95 225  56  72 216 115 149 164 247   2   6  10  30  34 102 170
    229  52  92 228  55  89 235  38 106 190 217 112 144 171 230  49
@@ -63,7 +63,7 @@
     57  75 221 124 132 151 162 253  28  36 108 180 199  82 246   1)
     )
 
-(defconstant Sbox
+(defparameter Sbox
   #( 99 124 119 123 242 107 111 197  48   1 103  43 254 215 171 118
    202 130 201 125 250  89  71 240 173 212 162 175 156 164 114 192
    183 253 147  38  54  63 247 204  52 165 229 241 113 216  49  21
@@ -82,7 +82,7 @@
    140 161 137  13 191 230  66 104  65 153  45  15 176  84 187  22)
   "S-box.")
 
-(defconstant Si
+(defparameter Si
   #( 82   9 106 213  48  54 165  56 191  64 163 158 129 243 215 251
    124 227  57 130 155  47 255 135  52 142  67  68 196 222 233 203
     84 123 148  50 166 194  35  61 238  76 149  11  66 250 195  78
@@ -103,7 +103,7 @@
 
 
 
-(defconstant RC #(#x00 #x01 #x02 #x04 #x08 #x10 #x20 #x40 #x80
+(defparameter RC #(#x00 #x01 #x02 #x04 #x08 #x10 #x20 #x40 #x80
 		  #x1b #x36 #x6c #xd8 #xab #x4d #x9a #x2f
 		  #x5e #xbc #x63 #xc6 #x97 #x35 #x6a #xd4
 		  #xb3 #x7d #xfa #xef #xc5 #x91)




More information about the Crypticl-cvs mailing list