aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/skein/skein_512.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-06-06 19:57:46 +0000
committerlloyd <[email protected]>2009-06-06 19:57:46 +0000
commit95033a027fcda13453010805880ad7450d3ac3ff (patch)
tree4233c904bcc712e0af61ce75353163ad657a836a /src/hash/skein/skein_512.cpp
parenta96eae0b3394b64aea544f9f0ce4664d3b4a5c58 (diff)
Mark Skein_512 with the BOTAN_DLL macro
Add a comment that the limitation of the personalization string being a maximum of 64 characters is due to the implementation and not the specification (but it makes it easy to implement, and in this particular case 64 characters is probably fine). Add some tests for the personalization option, generated by the Skein reference implementation. Disable stripping whitespace in checks/misc.cpp:strip - it strips the personalization tag, which breaks the test, and isn't needed otherwise because the test files are well-formed.
Diffstat (limited to 'src/hash/skein/skein_512.cpp')
-rw-r--r--src/hash/skein/skein_512.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp
index c8a26ae82..eaef641ed 100644
--- a/src/hash/skein/skein_512.cpp
+++ b/src/hash/skein/skein_512.cpp
@@ -132,6 +132,7 @@ void initial_block(u64bit H[9], u64bit T[3], u32bit output_bits,
{
clear_mem(H, 9);
+ // ASCII("SHA3") followed by version (0x0001) code
byte config_str[32] = { 0x53, 0x48, 0x41, 0x33, 0x01, 0x00, 0 };
store_le(output_bits, config_str + 8);
@@ -140,6 +141,11 @@ void initial_block(u64bit H[9], u64bit T[3], u32bit output_bits,
if(personalization != "")
{
+ /*
+ This is a limitation of this implementation, and not of the
+ algorithm specification. Could be fixed relatively easily, but
+ doesn't seem worth the trouble.
+ */
if(personalization.length() > 64)
throw Invalid_Argument("Skein personalization must be <= 64 bytes");