Inlined the hashtable in sha1.

cvs
Doug Coleman 2005-09-08 16:05:25 +00:00
parent 5648b40a16
commit dadffdf6e3
1 changed files with 8 additions and 10 deletions

View File

@ -16,7 +16,6 @@ SYMBOL: D
SYMBOL: E
SYMBOL: w
SYMBOL: K
SYMBOL: f-table
: reset-w ( -- )
80 <vector> w set ;
@ -53,6 +52,7 @@ SYMBOL: f-table
! f(t;B,C,D) = (B AND C) OR (B AND D) OR (C AND D) (40 <= t <= 59)
! f(t;B,C,D) = B XOR C XOR D (60 <= t <= 79)
! use this syntax eventually
! JUMP-TABLE: f 4 ( maximum )
! {{
! [[ 0 [ >r over bitnot r> bitand >r bitand r> bitor ] ]]
@ -66,16 +66,14 @@ SYMBOL: f-table
! J: 2 f 2dup bitand >r pick bitand >r bitand r> r> bitor bitor ;
! J: 3 f bitxor bitxor ;
! todo: make inlined
{
{ [ dup 0 = ] [ drop >r over bitnot r> bitand >r bitand r> bitor ] }
{ [ dup 1 = ] [ drop bitxor bitxor ] }
{ [ dup 2 = ] [ drop 2dup bitand >r pick bitand >r bitand r> r> bitor bitor ] }
{ [ dup 3 = ] [ drop bitxor bitxor ] }
} f-table set
: sha1-f ( B C D t -- f_tbcd )
20 /i f-table get cond ;
20 /i
{
{ [ dup 0 = ] [ drop >r over bitnot r> bitand >r bitand r> bitor ] }
{ [ dup 1 = ] [ drop bitxor bitxor ] }
{ [ dup 2 = ] [ drop 2dup bitand >r pick bitand >r bitand r> r> bitor bitor ] }
{ [ dup 3 = ] [ drop bitxor bitxor ] }
} cond ;
: make-w ( -- )
! compute w, steps a-b of RFC 3174, section 6.1