move sha1 and sha2 to checksums.sha, update usages

db4
Doug Coleman 2009-05-17 17:58:36 -05:00
parent e342082722
commit b352bbdc12
17 changed files with 35 additions and 32 deletions

View File

@ -1,5 +1,5 @@
USING: kernel io strings byte-arrays sequences namespaces math USING: kernel io strings byte-arrays sequences namespaces math
parser checksums.hmac tools.test checksums.md5 checksums.sha2 parser checksums.hmac tools.test checksums.md5 checksums.sha
checksums ; checksums ;
IN: checksums.hmac.tests IN: checksums.hmac.tests
@ -46,4 +46,3 @@ IN: checksums.hmac.tests
"JefeJefeJefeJefeJefeJefeJefeJefe" "JefeJefeJefeJefeJefeJefeJefeJefe"
"what do ya want for nothing?" sha-256 hmac-bytes hex-string "what do ya want for nothing?" sha-256 hmac-bytes hex-string
] unit-test ] unit-test

View File

@ -1,9 +1,8 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays checksums checksums.md5 checksums.md5.private USING: accessors arrays checksums combinators fry io io.binary
checksums.sha1 combinators fry io io.binary io.encodings.binary io.encodings.binary io.files io.streams.byte-array kernel
io.files io.streams.byte-array kernel math math.vectors memoize locals math math.vectors memoize sequences ;
sequences locals accessors ;
IN: checksums.hmac IN: checksums.hmac
<PRIVATE <PRIVATE

View File

@ -1,6 +1,6 @@
! Copyright (C) 2009 Doug Coleman. ! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test checksums.interleave checksums.sha2 ; USING: tools.test checksums.interleave checksums.sha ;
IN: checksums.interleave.tests IN: checksums.interleave.tests
[ [

View File

@ -32,6 +32,6 @@ ARTICLE: "checksums.openssl" "OpenSSL checksums"
"An example where we compute the SHA1 checksum of a string using the OpenSSL implementation of SHA1:" "An example where we compute the SHA1 checksum of a string using the OpenSSL implementation of SHA1:"
{ $example "USING: byte-arrays checksums checksums.openssl ;" "\"hello world\" >byte-array openssl-sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } { $example "USING: byte-arrays checksums checksums.openssl ;" "\"hello world\" >byte-array openssl-sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" }
"If we use the Factor implementation, we get the same result, just slightly slower:" "If we use the Factor implementation, we get the same result, just slightly slower:"
{ $example "USING: byte-arrays checksums checksums.sha1 ;" "\"hello world\" >byte-array sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } ; { $example "USING: byte-arrays checksums checksums.sha ;" "\"hello world\" >byte-array sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } ;
ABOUT: "checksums.openssl" ABOUT: "checksums.openssl"

View File

@ -0,0 +1,18 @@
USING: help.markup help.syntax ;
IN: checksums.sha
HELP: sha-224
{ $class-description "SHA-224 checksum algorithm." } ;
HELP: sha-256
{ $class-description "SHA-256 checksum algorithm." } ;
ARTICLE: "checksums.sha" "SHA-2 checksum"
"The SHA family of checksum algorithms are one-way hashes useful for checksumming data. SHA-1 is considered insecure, while SHA-2 It is generally considered to be pretty strong." $nl
"SHA-2 checksums:"
{ $subsection sha-224 }
{ $subsection sha-256 }
"SHA-1 checksum:"
{ $subsection sha1 } ;
ABOUT: "checksums.sha"

View File

@ -1,6 +1,6 @@
USING: arrays kernel math namespaces sequences tools.test USING: arrays kernel math namespaces sequences tools.test
checksums.sha2 checksums ; checksums.sha checksums ;
IN: checksums.sha2.tests IN: checksums.sha.tests
: test-checksum ( text identifier -- checksum ) : test-checksum ( text identifier -- checksum )
checksum-bytes hex-string ; checksum-bytes hex-string ;

View File

@ -5,7 +5,7 @@ io.binary math.bitwise checksums checksums.common
sbufs strings combinators.smart math.ranges fry combinators sbufs strings combinators.smart math.ranges fry combinators
accessors locals checksums.stream multiline literals accessors locals checksums.stream multiline literals
generalizations ; generalizations ;
IN: checksums.sha2 IN: checksums.sha
SINGLETON: sha1 SINGLETON: sha1
INSTANCE: sha1 stream-checksum INSTANCE: sha1 stream-checksum

View File

@ -0,0 +1 @@
SHA checksum algorithms

View File

@ -1,11 +0,0 @@
USING: help.markup help.syntax ;
IN: checksums.sha2
HELP: sha-256
{ $class-description "SHA-256 checksum algorithm." } ;
ARTICLE: "checksums.sha2" "SHA2 checksum"
"The SHA2 checksum algorithm implements a one-way hash function. It is generally considered to be pretty strong."
{ $subsection sha-256 } ;
ABOUT: "checksums.sha2"

View File

@ -1 +0,0 @@
SHA2 checksum algorithm

View File

@ -1,6 +1,6 @@
USING: assocs classes help.markup help.syntax kernel USING: assocs classes help.markup help.syntax kernel
quotations strings words words.symbol furnace.auth.providers.db quotations strings words words.symbol furnace.auth.providers.db
checksums.sha2 furnace.auth.providers math byte-arrays checksums.sha furnace.auth.providers math byte-arrays
http multiline ; http multiline ;
IN: furnace.auth IN: furnace.auth

View File

@ -3,7 +3,7 @@
USING: accessors assocs namespaces kernel sequences sets USING: accessors assocs namespaces kernel sequences sets
destructors combinators fry logging destructors combinators fry logging
io.encodings.utf8 io.encodings.string io.binary random io.encodings.utf8 io.encodings.string io.binary random
checksums checksums.sha2 urls checksums checksums.sha urls
html.forms html.forms
http.server http.server
http.server.filters http.server.filters

View File

@ -1,7 +1,6 @@
! Copyright (C) 2008 John Benediktsson ! Copyright (C) 2008 John Benediktsson
! See http://factorcode.org/license.txt for BSD license ! See http://factorcode.org/license.txt for BSD license
USING: byte-arrays checksums checksums.md5 checksums.sha
USING: byte-arrays checksums checksums.md5 checksums.sha1
kernel math math.parser math.ranges random unicode.case kernel math math.parser math.ranges random unicode.case
sequences strings system io.binary ; sequences strings system io.binary ;

View File

@ -47,8 +47,7 @@ $nl
"Checksum implementations:" "Checksum implementations:"
{ $subsection "checksums.crc32" } { $subsection "checksums.crc32" }
{ $vocab-subsection "MD5 checksum" "checksums.md5" } { $vocab-subsection "MD5 checksum" "checksums.md5" }
{ $vocab-subsection "SHA1 checksum" "checksums.sha1" } { $vocab-subsection "SHA checksums" "checksums.sha" }
{ $vocab-subsection "SHA2 checksum" "checksums.sha2" }
{ $vocab-subsection "Adler-32 checksum" "checksums.adler-32" } { $vocab-subsection "Adler-32 checksum" "checksums.adler-32" }
{ $vocab-subsection "OpenSSL checksums" "checksums.openssl" } ; { $vocab-subsection "OpenSSL checksums" "checksums.openssl" } ;

View File

@ -1,4 +1,4 @@
USING: checksums checksums.sha1 sequences byte-arrays kernel ; USING: checksums checksums.sha sequences byte-arrays kernel ;
IN: benchmark.sha1 IN: benchmark.sha1
: sha1-file ( -- ) : sha1-file ( -- )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2009 Maxim Savchenko ! Copyright (C) 2009 Maxim Savchenko
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: namespaces ecdsa tools.test checksums checksums.sha2 ; USING: namespaces ecdsa tools.test checksums checksums.sha ;
IN: ecdsa.tests IN: ecdsa.tests
SYMBOLS: priv-key pub-key signature ; SYMBOLS: priv-key pub-key signature ;
@ -27,4 +27,4 @@ SYMBOLS: priv-key pub-key signature ;
message sha-256 checksum-bytes message sha-256 checksum-bytes
signature get pub-key get signature get pub-key get
"prime256v1" [ set-public-key ecdsa-verify ] with-ec "prime256v1" [ set-public-key ecdsa-verify ] with-ec
] unit-test ] unit-test