module Vectors.SipHash where import Data.List import Data.Word import Data.ByteString(ByteString, pack) import Data.Hashabler(SipKey(..)) -- Formerly a translation of test vectors from reference implementation: -- https://github.com/veorq/SipHash/blob/master/main.c -- -- however in this commit we've bootstrapped our own test vectors (because our -- Hashable implementation of ByteString does a final mixConstructor). siphashKey :: SipKey siphashKey = SipKey 0x0706050403020100 0x0F0E0D0C0B0A0908 -- inputs from (empty string) to (00 01 02 ... 3e), with adjustments for endianness. siphashInputs :: [ByteString] siphashInputs = map (pack . concatMap reverse . chunk 8) $ inits [0 .. 0x3e] where chunk n = go where go [] = [] go l = let (xs,ys) = splitAt n l in xs : go ys siphashVectors64 :: [Word64] siphashVectors64 = [14614514471790295042,5305072771304469167,15199726367185699164,5018144799576303008,7639485884170413123,1728999940227668757,4663900856472491237,8987301527070786211,10735345031678819290,10891516631726898201,16335609031844238828,2004685866475395357,18416220911360515354,14760595849907032311,12543658505816683903,13670690956696771625,16002044945267615361,17201333720333255567,7860750978331722535,15864465671004129668,14519832692663505109,6787308162488065037,13714199362673327233,1546856778285276578,1789791628172767705,5922800717932161698,9462350363463106929,12267145147416141209,4068907351284512602,8124098861931527524,4898634620393262315,14230684656416461808,7608965072255915324,18325068624228792898,10037319761725141701,16439803823014902270,12821700362716262539,17933077170558805172,3145901100272672393,14136578367262651283,5686924464040940468,6613357180710989142,5490375567102337274,9018066808732339872,13519138252686448880,4713626915669956303,10820840603508315935,6038032730676057936,5451739437405512349,5688962190151351874,8695790138263660399,11448330624545539519,7417965968367537213,2180935201157028709,11018055330163659073,8651795392266676569,5371928850730305959,982074353042585444,5286966838722579125,6515006163435375810,8643810353258188234,7689489469850774561,7151495410825153093,6440598915744458835] siphashVectors128 :: [(Word64, Word64)] siphashVectors128 = [(15192892025397720504,5234914216409367256),(16299781529751447434,4033877241234850146),(8677680790915771939,10362088197631035322),(18179934835064621361,18347474016445480966),(16115755081845747118,5926861119562214497),(11747623105198455226,4284541233788986758),(15430893466269372675,11587497537378633964),(1021750389591521953,1671979510912770940),(2628890859266717423,3615320296146253935),(16325229402487052916,1567320211663515745),(11161756538292443822,13997946810241271213),(11417492639794862121,1961694456604112407),(9083649268983738540,14651948482467621470),(9485659365554077811,6844849926576725598),(12152259344095122816,11632674694016626152),(7766084023347114836,12456908111094541580),(5600823379228348409,8014268384935218321),(7975233538481291483,13376768143960401653),(17062196455588167834,1059229835368351549),(3937600510331643943,3575929021207247067),(14585268922832753248,17532769292687084424),(3665810151866572063,9912157575151191039),(10133382753165222564,6901277170852954897),(13091796013442399812,2761704637414108730),(8808149294746585941,149168373107196048),(7625855647274872875,13954003697453180638),(1177951283461634916,14289574093791336186),(4750669921796665881,10185119962134289240),(12974823068461932893,12484080860125018617),(4867143662533898294,7105171212178889597),(11118107787394611035,8283159671643622685),(14399621284813220879,17675321563970135131),(9574637178457987324,9818357690910241679),(14849865547610817554,562190063127534759),(1532906824937679174,14252676337321439733),(2544106688795302139,4098605923897962162),(3515695553555759219,13901904954693524348),(2563723427330715015,1174271398988457753),(2712688811487781283,6742410184364566379),(10991009002349020526,10041821596392927019),(4835087449915938270,3864997623701641491),(624928535671640187,2440531479829439938),(5767190414836857586,16070284921383000489),(17770236640316458045,6217588682801826413),(18223656063065286639,888736825182638828),(18085893751765476781,2622334262063636772),(4412004158409367520,4224947387030001514),(17605012953961149692,12603181927501249544),(401435918347308244,17250487200197851562),(2714116188711642933,6314921969958979817),(8241883660509098252,2435819177377244933),(16313916132621393174,9200274968391458992),(15104019596156736334,8859308926606083790),(9667595755730399270,6493090352259839748),(4789100151539007937,4952478105685174720),(9492887381757740762,10607284052663984950),(7209100661377577350,8797977534605362354),(10768499517985902075,4384668695737866491),(1014283419227691561,6121522695836896124),(16819681856528715678,17888920511531788312),(11844050685726081986,1178779867236181661),(812879375455589111,11914216092965081323),(12797185947657368807,671938835356377422),(1260154313253446678,4468008281566968439)]