mirror of
https://github.com/pmai/sha3.git
synced 2025-12-22 07:44:29 +01:00
Added testing with SHA3 test vectors from Keccak Code Package.
This commit is contained in:
10
README
10
README
@ -133,6 +133,16 @@ The testcases from the Keccak test data can be run with the following
|
|||||||
form:
|
form:
|
||||||
|
|
||||||
(keccak:test-keccak-msgkat
|
(keccak:test-keccak-msgkat
|
||||||
|
"/Path/To/MsgKatDirectory"
|
||||||
|
(lambda (total-bits bit-rate output-bits message)
|
||||||
|
(declare (ignore total-bits bit-rate))
|
||||||
|
(sha3:sha3-digest-vector message :output-bit-length output-bits :raw-keccak-p t)))
|
||||||
|
|
||||||
|
The adapted SHA-3 testcases from the Keccak Code Package test vectors
|
||||||
|
available under https://github.com/gvanas/KeccakCodePackage/tree/master/TestVectors
|
||||||
|
can be run with the following form:
|
||||||
|
|
||||||
|
(keccak:test-sha3-msgkat
|
||||||
"/Path/To/MsgKatDirectory"
|
"/Path/To/MsgKatDirectory"
|
||||||
(lambda (total-bits bit-rate output-bits message)
|
(lambda (total-bits bit-rate output-bits message)
|
||||||
(declare (ignore total-bits bit-rate))
|
(declare (ignore total-bits bit-rate))
|
||||||
|
|||||||
@ -36,7 +36,8 @@
|
|||||||
#:test-with-testsuite
|
#:test-with-testsuite
|
||||||
#:read-testsuite-from-file
|
#:read-testsuite-from-file
|
||||||
#:test-with-testsuite-from-file
|
#:test-with-testsuite-from-file
|
||||||
#:test-keccak-msgkat))
|
#:test-keccak-msgkat
|
||||||
|
#:test-sha3-msgkat))
|
||||||
|
|
||||||
(cl:in-package #:keccak-reference)
|
(cl:in-package #:keccak-reference)
|
||||||
|
|
||||||
@ -380,3 +381,22 @@
|
|||||||
(setq result nil))
|
(setq result nil))
|
||||||
finally
|
finally
|
||||||
(return result)))
|
(return result)))
|
||||||
|
|
||||||
|
(defun test-sha3-msgkat (directory &optional function)
|
||||||
|
(loop with result = t
|
||||||
|
for (filename total-bits bit-rate output-bits) in
|
||||||
|
'(("ShortMsgKAT_SHA3-224.txt" 1600 1152 224)
|
||||||
|
("ShortMsgKAT_SHA3-256.txt" 1600 1088 256)
|
||||||
|
("ShortMsgKAT_SHA3-384.txt" 1600 832 384)
|
||||||
|
("ShortMsgKAT_SHA3-512.txt" 1600 576 512))
|
||||||
|
do
|
||||||
|
(unless
|
||||||
|
(test-with-testsuite-from-file
|
||||||
|
(merge-pathnames filename directory)
|
||||||
|
(if (null function)
|
||||||
|
(lambda (message) (keccak total-bits bit-rate output-bits message))
|
||||||
|
(lambda (message)
|
||||||
|
(funcall function total-bits bit-rate output-bits message))))
|
||||||
|
(setq result nil))
|
||||||
|
finally
|
||||||
|
(return result)))
|
||||||
|
|||||||
Reference in New Issue
Block a user