2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,36 +1,4 @@
|
|||
pad=: ,1,(0#~512 | [: - 65 + #),(64#2)#:#
|
||||
|
||||
f=:4 :0
|
||||
'B C D'=: _32 ]\ y
|
||||
if. x < 20 do.
|
||||
(B*C)+.D>B
|
||||
elseif. x < 40 do.
|
||||
B~:C~:D
|
||||
elseif. x < 60 do.
|
||||
(B*C)+.(B*D)+.C*D
|
||||
elseif. x < 80 do.
|
||||
B~:C~:D
|
||||
end.
|
||||
)
|
||||
|
||||
K=: ((32#2) #: 16b5a827999 16b6ed9eba1 16b8f1bbcdc 16bca62c1d6) {~ <.@%&20
|
||||
|
||||
plus=:+&.((32#2)&#.)
|
||||
|
||||
H=: #: 16b67452301 16befcdab89 16b98badcfe 16b10325476 16bc3d2e1f0
|
||||
|
||||
process=:4 :0
|
||||
W=. (, [: , 1 |."#. _3 _8 _14 _16 ~:/@:{ ])^:64 x ]\~ _32
|
||||
'A B C D E'=. y=._32[\,y
|
||||
for_t. i.80 do.
|
||||
TEMP=. (5|.A) plus (t f B,C,D) plus E plus (W{~t) plus K t
|
||||
E=. D
|
||||
D=. C
|
||||
C=. 30 |. B
|
||||
B=. A
|
||||
A=. TEMP
|
||||
end.
|
||||
,y plus A,B,C,D,:E
|
||||
)
|
||||
|
||||
sha1=: [:> [: process&.>/ (<H) (,~ |.) _512<\ pad
|
||||
require '~addons/ide/qt/qt.ijs'
|
||||
getsha1=: 'sha1'&gethash_jqtide_
|
||||
getsha1 'Rosetta Code'
|
||||
48c98f7e5a6e736d790ab740dfc3f51a61abe2b5
|
||||
|
|
|
|||
|
|
@ -1,5 +1,36 @@
|
|||
text2bits=: (8#2) ,@:#: a. i. ]
|
||||
bits2hex=: '0123456789abcdef' {~ _4 #.\ ,
|
||||
pad=: ,1,(0#~512 | [: - 65 + #),(64#2)#:#
|
||||
|
||||
bits2hex sha1 text2bits 'Rosetta Code'
|
||||
48c98f7e5a6e736d790ab740dfc3f51a61abe2b5
|
||||
f=:4 :0
|
||||
'B C D'=: _32 ]\ y
|
||||
if. x < 20 do.
|
||||
(B*C)+.D>B
|
||||
elseif. x < 40 do.
|
||||
B~:C~:D
|
||||
elseif. x < 60 do.
|
||||
(B*C)+.(B*D)+.C*D
|
||||
elseif. x < 80 do.
|
||||
B~:C~:D
|
||||
end.
|
||||
)
|
||||
|
||||
K=: ((32#2) #: 16b5a827999 16b6ed9eba1 16b8f1bbcdc 16bca62c1d6) {~ <.@%&20
|
||||
|
||||
plus=:+&.((32#2)&#.)
|
||||
|
||||
H=: #: 16b67452301 16befcdab89 16b98badcfe 16b10325476 16bc3d2e1f0
|
||||
|
||||
process=:4 :0
|
||||
W=. (, [: , 1 |."#. _3 _8 _14 _16 ~:/@:{ ])^:64 x ]\~ _32
|
||||
'A B C D E'=. y=._32[\,y
|
||||
for_t. i.80 do.
|
||||
TEMP=. (5|.A) plus (t f B,C,D) plus E plus (W{~t) plus K t
|
||||
E=. D
|
||||
D=. C
|
||||
C=. 30 |. B
|
||||
B=. A
|
||||
A=. TEMP
|
||||
end.
|
||||
,y plus A,B,C,D,:E
|
||||
)
|
||||
|
||||
sha1=: [:> [: process&.>/ (<H) (,~ |.) _512<\ pad
|
||||
|
|
|
|||
|
|
@ -1,42 +1,5 @@
|
|||
text2bits=: (8#2) ,@:#: a. i. ]
|
||||
words2bits=: ,@:((32#2)&#:)
|
||||
text2bits=: (8#2) ,@:#: a. i. ]
|
||||
bits2hex=: '0123456789abcdef' {~ _4 #.\ ,
|
||||
|
||||
pad=: _32 #.\ (, 1,(0#~512 | [: - 65 + #),(64#2)#:#)
|
||||
lim32=: 2^32
|
||||
rot32=: (] lim32&|@* 2 ^ [) + ] <.@% 2 ^ 32- [
|
||||
and=: 17 b.
|
||||
notimplies=: 18 b.
|
||||
xor=: 22 b.
|
||||
or=: 23 b.
|
||||
|
||||
f=:4 :0
|
||||
'B C D'=: y
|
||||
if. x < 20 do.
|
||||
(B and C) or D notimplies B
|
||||
elseif. x < 40 do.
|
||||
B xor C xor D
|
||||
elseif. x < 60 do.
|
||||
(B and C) or (B and D) or C and D
|
||||
elseif. x < 80 do.
|
||||
B xor C xor D
|
||||
end.
|
||||
)
|
||||
|
||||
K=: 16b5a827999 16b6ed9eba1 16b8f1bbcdc 16bca62c1d6 {~ <.@%&20
|
||||
|
||||
process=:3 :0
|
||||
H=. 16b67452301 16befcdab89 16b98badcfe 16b10325476 16bc3d2e1f0
|
||||
W=. (, [: , 1 rot32 _3 _8 _14 _16 xor/@:{ ])^:64 y
|
||||
'A B C D E'=. H
|
||||
for_t. i.80 do.
|
||||
TEMP=. lim32|(5 rot32 A) + (t f B,C,D) + E + (W{~t) + K t
|
||||
E=. D
|
||||
D=. C
|
||||
C=. 30 rot32 B
|
||||
B=. A
|
||||
A=. TEMP
|
||||
end.
|
||||
,lim32|H + A,B,C,D,E
|
||||
)
|
||||
|
||||
sha1=: _16 process\ pad
|
||||
bits2hex sha1 text2bits 'Rosetta Code'
|
||||
48c98f7e5a6e736d790ab740dfc3f51a61abe2b5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue