mirror of
https://github.com/pmai/sha3.git
synced 2025-12-22 15:54:30 +01:00
Compare commits
9 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
| ec555c785c | |||
| a9cd1d2d5e | |||
| c89cddace7 | |||
| fc1c70579e | |||
| 9391b65603 | |||
| 4cb18313ac | |||
| b0e5a4a44d | |||
| f3e56080be | |||
| a016c81cf4 |
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -1,2 +1,2 @@
|
||||
/*.lisp ident
|
||||
/*.asd ident
|
||||
*.lisp ident
|
||||
*.asd ident
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
*.fas
|
||||
*.fasl
|
||||
*.ofasl
|
||||
*.64ofasl
|
||||
*.nfasl
|
||||
*.xfasl
|
||||
*.dx32fsl
|
||||
|
||||
13
NEWS
13
NEWS
@ -1,3 +1,16 @@
|
||||
Release 1.0.2
|
||||
=============
|
||||
|
||||
* Fixes a bug reported by Orivej Desh where two or more calls to
|
||||
sha3-update which didn't fill the buffer could lead to the second
|
||||
and later updates being ignored, thereby creating wrong message
|
||||
digests.
|
||||
|
||||
Release 1.0.1
|
||||
=============
|
||||
|
||||
* Change to 32bit implementation for 64bit LispWorks.
|
||||
|
||||
Release 1.0.0
|
||||
=============
|
||||
|
||||
|
||||
7
README
7
README
@ -3,6 +3,13 @@ This library is an implementation of the Secure Hash Algorithm 3
|
||||
messages with an integral number of octets, i.e. sub-byte length
|
||||
messages are not supported.
|
||||
|
||||
NOTE that prior to release 1.0.2 this package had a bug in the
|
||||
generation of message digests where multiple calls to sha3-update
|
||||
with partial buffers could lead to input data being ignored and
|
||||
therefore erroneous message digests being generated. Uses with
|
||||
only one call to sha3-update and the high-level routines were not
|
||||
affected by this bug.
|
||||
|
||||
The code should be portable across nearly all ANSI compliant CL
|
||||
implementations with specialized versions tuned for implementations
|
||||
that offer unboxed 64bit arithmetic, unboxed 32bit arithmetic and for
|
||||
|
||||
12
sha3.asd
12
sha3.asd
@ -50,9 +50,11 @@
|
||||
(:file "keccak-64bit" :depends-on ("pkgdef" "common"))
|
||||
#+(or (and :sbcl (not (or :x86-64 :alpha)))
|
||||
:cmucl
|
||||
(and :ccl :64-bit-target))
|
||||
(and :ccl :64-bit-target)
|
||||
(and :lispworks :lispworks-64bit))
|
||||
(:file "keccak-32bit" :depends-on ("pkgdef" "common"))
|
||||
#-(or :sbcl :cmucl (and :ccl :64-bit-target))
|
||||
#-(or :sbcl :cmucl (and :ccl :64-bit-target)
|
||||
(and :lispworks :lispworks-64bit))
|
||||
(:file "keccak-16bit" :depends-on ("pkgdef" "common"))
|
||||
(:file "sha3"
|
||||
:depends-on ("pkgdef"
|
||||
@ -61,7 +63,9 @@
|
||||
"keccak-64bit"
|
||||
#+(or (and :sbcl (not (or :x86-64 :alpha)))
|
||||
:cmucl
|
||||
(and :ccl :64-bit-target))
|
||||
(and :ccl :64-bit-target)
|
||||
(and :lispworks :lispworks-64bit))
|
||||
"keccak-32bit"
|
||||
#-(or :sbcl :cmucl (and :ccl :64-bit-target))
|
||||
#-(or :sbcl :cmucl (and :ccl :64-bit-target)
|
||||
(and :lispworks :lispworks-64bit))
|
||||
"keccak-16bit"))))
|
||||
|
||||
17
sha3.lisp
17
sha3.lisp
@ -110,16 +110,21 @@ and `end', which must be numeric bounding-indices."
|
||||
#.*optimize-declaration*)
|
||||
;; Handle potential remaining bytes
|
||||
(unless (zerop buffer-index)
|
||||
(let ((remainder (- (length buffer) buffer-index)))
|
||||
(declare (type fixnum remainder))
|
||||
(let ((remainder (- (length buffer) buffer-index))
|
||||
(length (- end start)))
|
||||
(declare (type fixnum remainder length))
|
||||
(replace buffer vector :start1 buffer-index :start2 start :end2 end)
|
||||
(when (>= (- end start) remainder)
|
||||
;; Return if still unfilled buffer
|
||||
(when (< length remainder)
|
||||
(incf (sha3-state-buffer-index state) length)
|
||||
(return-from sha3-update))
|
||||
;; Else handle now complete buffer
|
||||
(keccak-state-merge-input keccak-state bit-rate buffer 0)
|
||||
(keccak-f keccak-state))
|
||||
(keccak-f keccak-state)
|
||||
(setf (sha3-state-buffer-index state) 0
|
||||
start (min (+ start remainder) end))))
|
||||
start (+ start remainder))))
|
||||
;; Now handle full blocks, stuff any remainder into buffer
|
||||
(loop for block-offset of-type fixnum from start to end by rate-bytes
|
||||
(loop for block-offset of-type fixnum from start below end by rate-bytes
|
||||
do
|
||||
(cond
|
||||
((<= (+ block-offset rate-bytes) end)
|
||||
|
||||
Reference in New Issue
Block a user