]> gitweb.factorcode.org Git - factor.git/commitdiff
pop-front more efficient now
authorDoug Coleman <erg@trifocus.net>
Sun, 16 Oct 2005 22:13:00 +0000 (22:13 +0000)
committerDoug Coleman <erg@trifocus.net>
Sun, 16 Oct 2005 22:13:00 +0000 (22:13 +0000)
contrib/crypto/md5.factor
contrib/crypto/polynomial.factor
contrib/crypto/sha1.factor

index ceff8ec659506941892bb7d78b9b5cee266b1d18..5dd3fbe58c4eab5d516ebdcd4d714364cccc4cbb 100644 (file)
@@ -23,6 +23,16 @@ SYMBOL: old-d
     old-c c update-old-new
     old-d d update-old-new ;
 
+: get-md5-debug ( -- str )
+    [ [ a b c d ] [ get 4 >be % ] each ] "" make ;
+
+: get-md5 ( -- str )
+    [ [ a b c d ] [ get 4 >le % ] each ] "" make ;
+
+: get-old-md5-debug ( -- str )
+    [ [ old-a old-b old-c old-d ] [ get 4 >be % ] each ] "" make ;
+
+
 ! Let [abcd k s i] denote the operation
 ! a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s)
 
@@ -55,7 +65,6 @@ SYMBOL: old-d
 ! I(X,Y,Z) = Y xor (X v not(Z))
 : I ( X Y Z -- IXYZ )
     rot swap bitnot bitor bitxor ;
-
 : S11 7  ; inline
 : S12 12 ; inline
 : S13 17 ; inline
@@ -140,20 +149,28 @@ SYMBOL: old-d
     S41 61 pick 4 nth-int  [ I ] ABCD
     S42 62 pick 11 nth-int [ I ] DABC
     S43 63 pick 2 nth-int  [ I ] CDAB
+
+    "63: " write get-old-md5-debug hex-string print
+    "63change: " write get-md5-debug hex-string print
+
     S44 64 pick 9 nth-int  [ I ] BCDA
+
+    "64: " write get-old-md5-debug hex-string print
+    "64change: " write get-md5-debug hex-string print
+
     update-md
     drop ;
 
-: get-md5 ( -- str )
-    [ [ a b c d ] [ get 4 >le % ] each ] "" make ;
+
 
 IN: crypto
 : string>md5 ( string -- md5 )
-    [
+    [
         initialize-md5 pad-string-md5
         dup length num-blocks [ 2dup get-block process-md5-block ] repeat
         drop get-md5
-    ] with-scope ;
+        ;
+    ! ] with-scope ;
 
 : string>md5str ( string -- str )
     string>md5 hex-string ;
index 5d92e137fca09faa5f5d97daa67125c491119f99..366ced640ff3b0a2dd6d3dfe46db24dc744cd9aa 100644 (file)
@@ -77,7 +77,7 @@ IN: math
 IN: math-internals
 
 : pop-front ( seq -- seq )
-    reverse dup pop drop reverse ;
+    1 swap tail ;
 
 : /-last ( seq seq -- a )
     #! divide the last two numbers in the sequences
index 5a558979cd24c42a210d91f44ee8e13c97740a6a..74c09394797118651af6bf5da17eaeb10e9bf921 100644 (file)
@@ -81,7 +81,11 @@ SYMBOL: K
             [ nth-int-be w get push ] 2keep
         ] [
             dup sha1-W w get push
+<<<<<<< sha1.factor
+        ] if
+=======
         ] if 
+>>>>>>> 1.8
     ] repeat ;
 
 : init-letters ( -- )