Browse Source
Implement FIPS 180-4 algos: sha512/256 and sha512/224
Implement FIPS 180-4 algos: sha512/256 and sha512/224
These algorithms are simple extensions to the existing sha512 algo using different initialization vectors and producing truncated output.pull/1906/head
9 changed files with 134 additions and 1 deletions
-
1NEWS
-
2ext/hash/hash.c
-
78ext/hash/hash_sha.c
-
2ext/hash/php_hash.h
-
8ext/hash/php_hash_sha.h
-
6ext/hash/tests/hash_algos.phpt
-
12ext/hash/tests/hash_copy_001.phpt
-
13ext/hash/tests/sha512-224.phpt
-
13ext/hash/tests/sha512-256.phpt
@ -0,0 +1,13 @@ |
|||
--TEST-- |
|||
sha512/224 algorithm |
|||
--SKIPIF-- |
|||
<?php if(!extension_loaded("hash")) print "skip"; ?> |
|||
--FILE-- |
|||
<?php |
|||
echo hash('sha512/224', '') . "\n"; |
|||
echo hash('sha512/224', 'abc') . "\n"; |
|||
echo hash('sha512/224', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu') . "\n"; |
|||
--EXPECT-- |
|||
6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4 |
|||
4634270f707b6a54daae7530460842e20e37ed265ceee9a43e8924aa |
|||
23fec5bb94d60b23308192640b0c453335d664734fe40e7268674af9 |
|||
@ -0,0 +1,13 @@ |
|||
--TEST-- |
|||
sha512/256 algorithm |
|||
--SKIPIF-- |
|||
<?php if(!extension_loaded("hash")) print "skip"; ?> |
|||
--FILE-- |
|||
<?php |
|||
echo hash('sha512/256', '') . "\n"; |
|||
echo hash('sha512/256', 'abc') . "\n"; |
|||
echo hash('sha512/256', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu') . "\n"; |
|||
--EXPECT-- |
|||
c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a |
|||
53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23 |
|||
3928e184fb8690f840da3988121d31be65cb9d3ef83ee6146feac861e19b563a |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue