rurban / smhasher

Hash function quality and speed tests
https://rurban.github.io/smhasher/
Other
1.86k stars 179 forks source link

Update discohash to v1, add v2, clear up versions and correct implementation bug: no bad seeds! :) #273

Closed o0101 closed 1 year ago

o0101 commented 1 year ago

@rurban would it be a terrible idea to remove the bad seeds functions at the bottom of this file?

Also in this change set:

Clear up discohash versions, add 128-bit versions for v1 and v2

@rurban I'm using templates here so you probably won't like this as I don't see it anywhere else in the hashes code. I'm sorry I just didn't want to repeat the hash function code when they can be parameterized with the "hashsize" template as done here. Let me know if that's no good for you and I'll change it! :)

Technically this is adding 3 new hashes, "Discohash v1 128-bit, Discohah v2, Discohash v2 128-bit", but the 128 bit versions are just existing extensions of v1 (not new), and the v2 is just fixing some errors in v1 (m8[index]) and the finalization step to make it a bit more incompressible. However they're both distinct hashes and pass all the tests, including bad seeds. I haven't tested the 128-bit variants here, but they pass in smhasher3.

In a couple days I'll update the 512 bit variant to use the new thread safe implementation (a bug fixed by Frank Wojcik)

--- results ---

cris@Criss-MacBook-Air:~/Code/collab/smhasher$ ./build/SMHasher --test=BadSeeds --extra discohash1 --- Testing discohash "DISCoHAsH 64 (was BEBB4185) v1" GOOD

[[[ BadSeeds Tests ]]]

Testing 1129 internal secrets: 0x107a36 0x110890 0x124ac7 0x125ce5 0x126314 0x126ce 0x127b0 0x1296ec 0x132da3 0x133490 0x133d5d 0x1375b7 0x1377a1 0x137a87 0x13becb 0x148e56 0x14d1f 0x15587c 0x15e0ba 0x162cb7 0x1690a6 0x16ccf 0x16d4a 0x16d4b0 0x1752fa 0x1a675b 0x1a7cfe 0x1aba86 0x1b174d 0x1b1c53 0x1b39b 0x1b65ad 0x1b81c7 0x1bbf3c 0x1c05f6 0x1c16 0x1c2f3b 0x1c64 0x1c7882 0x1ca279 0x1d29fc 0x1d4d47 0x1d4fd7 0x1d690e 0x1d8484 0x1da78a 0x1db9a3 0x1dec9e 0x1e22e0 0x1e460c 0x1e95ad 0x1ee5b 0x1f48e4 0x1f4a8 0x1f5ecc 0x1f6c45 0x1f88e0 0x1faf59 0x1fc25f 0x1ffda4 0x2003fa 0x200fff 0x20296c 0x204631 0x20afbc 0x20f169 0x20fdc3 0x210307 0x211524 0x21281c 0x214bb1 0x215c6b 0x218756 0x218f74 0x21c14a 0x21c151 0x21cbbf 0x224793 0x225d0b 0x228754 0x22b59e 0x22c4ec 0x22e297 0x22fce1 0x22fde2 0x23134c 0x2350a1 0x236fc 0x23f029 0x24409a 0x24884f 0x24db7 0x24f0b1 0x268c70 0x2716d1 0x27248c 0x272f86 0x273760 0x27c879 0x27ce88 0x27d90d 0x27edc1 0x2817d3 0x281dc4 0x283b3b 0x285b3d 0x2a554a 0x2aba20 0x2ad77b 0x2afe70 0x2b2a62 0x2be048 0x2c8651 0x2cd3f3 0x2cd9b3 0x2cf6bf 0x2dbb72 0x2de72b 0x2df73b 0x2e3cc0 0x2f111a 0x2f383b 0x2f7343 0x2f89f3 0x2f9db3 0x2fb3a7 0x301c59 0x306cad 0x3143a4 0x31adab 0x31ba4b 0x31bac2 0x320d06 0x3327ce 0x33729 0x338df8 0x33b00d 0x33c24e 0x33c744 0x33d1b0 0x346fc1 0x34ef2c 0x35508e 0x3555ec 0x359f55 0x36307 0x36524a 0x3677ba 0x368467 0x368d0b 0x37449c 0x378855 0x378a17 0x37edea 0x37efef 0x38335d 0x383fd5 0x3847b3 0x38525c 0x3871d7 0x387d0f 0x3889dc 0x38aeaa 0x38d123 0x38ddff 0x39192e 0x393dde 0x3948bc 0x395b90 0x3963e2 0x3987ee 0x39ccad 0x39ceeb 0x39fcfb 0x3a1bb8 0x3a27f8 0x3a5582 0x3a5cc 0x3a6305 0x3ab33c 0x3abfdd 0x3ac690 0x3ac703 0x3ad8df 0x3afb1a 0x3b1196 0x3b1c47 0x3b2fed 0x3b6703 0x3b671d 0x3b9835 0x3b9f85 0x3bb0d2 0x3bc720 0x3be4e8 0x3bf5db 0x3c2756 0x3c2a5e 0x3c2ae9 0x3c4bd7 0x3c564c 0x3c8dca 0x3cb5f5 0x3ce86e 0x3ce964 0x3d03e5 0x3d0621 0x3d4df0 0x3d648b 0x3d73b3 0x3d7423 0x3d7ccf 0x3dc98 0x3dcc4f 0x3df271 0x3e00e5 0x3e1752 0x3e4862 0x3e529c 0x3e7a7d 0x3e80b2 0x3e82da 0x3e84e9 0x3e8f08 0x3eb764 0x3ed746 0x3ef180 0x3f07f9 0x3f0a76 0x3f3449 0x3f6700 0x3f6d4d 0x3f8029 0x3fbb79 0x3fc4f0 0x3fcb91 0x400005ea 0x4000196d 0x40003214 0x4000bb12 0x4000cf8b 0x4000d595 0x4000d648 0x4000d8f1 0x400100fa 0x4001059c 0x40011404 0x40013382 0x40013ad6 0x40016ae6 0x40017491 0x40017d50 0x40018c16 0x4001a1e2 0x4001ae30 0x4001cb61 0x4001da64 0x4001df6d 0x4001f179 0x40020fea 0x40021b9e 0x40021fec 0x40023b4a 0x40024171 0x4002c2b1 0x4002fd53 0x40036f17 0x4003cb68 0x4003dd98 0x4004150e 0x40045f43 0x40047935 0x4004a9ab 0x4004d9d9 0x4004eec4 0x40051f98 0x4006c063 0x4006ed7e 0x40071d05 0x400741bc 0x4007e348 0x40082df4 0x4008424c 0x400885a6 0x40097a8e 0x400996ce 0x4009a4cf 0x4009e971 0x400a3079 0x400a4f1b 0x400ada69 0x400b31fc 0x400b4811 0x400b5166 0x400b845b 0x400beef9 0x400c4e0a 0x400c529a 0x400c5fa5 0x400c952e 0x400c9c89 0x400ca0df 0x400d304e 0x400d4438 0x400d70ca 0x400d878c 0x400da7fe 0x400e5cfe 0x400e8a65 0x400e8bde 0x400ed108 0x400efaba 0x400f145c 0x400f7ccd 0x400fa294 0x4010408c 0x401056b6 0x4010a1e9 0x4010ccf0 0x4010fa3a 0x401283a7 0x40138494 0x4013de04 0x401404d0 0x401439bd 0x4014709f 0x40152cab 0x40157690 0x40158f6e 0x40166d00 0x4016d311 0x40171bdd 0x40172a72 0x40174283 0x4017a2b6 0x4017ab78 0x401874ae 0x40189b99 0x4018b1c7 0x4018d374 0x4019b003 0x4019d323 0x401a12be 0x401aa0bd 0x401af2ba 0x401af3e2 0x401af413 0x401b0ddb 0x401b25ca 0x401b329c 0x401bc411 0x401bcb89 0x401bcd0c 0x401bf169 0x401c056b 0x401caa59 0x401cb970 0x401cee78 0x401d20a1 0x401d25a3 0x401d484b 0x401d6627 0x401d8446 0x401d88a8 0x401d9fba 0x401da25f 0x401dfd09 0x401e0d63 0x401e278d 0x401e3e86 0x401e64d4 0x401ed1ea 0x401ed9f5 0x401f35e4 0x40201ddc 0x40207909 0x40209177 0x4020b87a 0x4020c813 0x40214a07 0x40215cce 0x40215d9c 0x4021eca5 0x4022105b 0x4023820a 0x402535d6 0x40255a5a 0x402578f4 0x40259d62 0x4025bae0 0x4025cb2d 0x4025d602 0x402686ab 0x40272546 0x40275a7f 0x4027e83c 0x4027ea46 0x402844d7 0x4028f426 0x40292935 0x40297fee 0x402980ba 0x40298e5f 0x4029918f 0x4029aa3c 0x4029b163 0x4029bf8c 0x4029cf61 0x402a87f2 0x402a9d3f 0x402aa5b3 0x402abc1a 0x402abdad 0x402b4491 0x402b4b8c 0x402b4ed8 0x402b5dba 0x402b658a 0x402bf82f 0x402c148b 0x402c340f 0x402d5b4e 0x402ef09f 0x402f7b5c 0x402f8a87 0x4030a921 0x4031624a 0x40317e1e 0x4031d42e 0x4032292a 0x40326d94 0x4032ed8d 0x40330c73 0x40331ed8 0x40334d79 0x403386da 0x4033a57a 0x4033de44 0x4033ef66 0x4033fb1c 0x40341263 0x40342d23 0x4034dbfe 0x403518e3 0x40353525 0x403583d4 0x4035cb01 0x4035e4e9 0x4035eddb 0x4035f70f 0x4035ff1b 0x40366406 0x4036792e 0x4036a3ba 0x4036ace4 0x40371af2 0x40374d63 0x40377e91 0x4037ddfd 0x4037f59f 0x4037fdf7 0x40381ec4 0x40382c95 0x40387598 0x40387e8a 0x4038f535 0x403930cc 0x40393168 0x40394048 0x40394281 0x40395efc 0x40395fb6 0x40398355 0x40398b1c 0x4039a890 0x403a0d97 0x403a8849 0x403ab46e 0x403ab4ae 0x403ac403 0x403ad4a5 0x403b0df4 0x403b1590 0x403b1b1c 0x403b1be1 0x403b2104 0x403b2629 0x403b424d 0x403bc027 0x403bde05 0x403c1204 0x403c16f6 0x403c244f 0x403c3166 0x403c3ea3 0x403c3fae 0x403ccdf6 0x403cd0ef 0x403cd396 0x403d9336 0x403da1f0 0x403da501 0x403daef5 0x403dbb39 0x403dcc06 0x403e58ad 0x403e73d7 0x403e7e10 0x403e80be 0x403eff24 0x403f3e47 0x48122 0x4d95 0x5e026 0x6bff7 0x6c5cc 0x6d781 0x75e35 0x7f47a 0x80002186 0x80002273 0x80002792 0x80004d40 0x8000bc5e 0x8000c2e4 0x8000c39d 0x8001031a 0x800163c4 0x800194ea 0x8001e2b6 0x8001fd7f 0x80025907 0x80025cbf 0x80029ece 0x8002aff7 0x8002cbfd 0x80032ebf 0x80037993 0x80039854 0x8003a880 0x8003ab02 0x800540ef 0x80057935 0x800583dd 0x800590fc 0x800741b6 0x8007744c 0x80077eaa 0x8007e022 0x8007f4f9 0x800832b0 0x80087d2f 0x800897eb 0x8008be42 0x8008f111 0x80094a0b 0x8009a943 0x800a027a 0x800a86ad 0x800b99f0 0x800ba5b3 0x800bbf59 0x800c5255 0x800c97a5 0x800cb0a0 0x800cdc57 0x800ce5fe 0x800dcda3 0x800df3da 0x800df3fc 0x800e01a2 0x800e517d 0x800e64d5 0x800e89aa 0x800e8b51 0x800fb17e 0x800fe298 0x80100b99 0x80101ea8 0x801020cf 0x8010525c 0x80108759 0x8010bc00 0x801183ef 0x8011dd3e 0x80120a09 0x80133eb9 0x801423cb 0x801445f4 0x80146c4f 0x8015a72c 0x8015f185 0x8016606b 0x80166d3d 0x80168256 0x801745d4 0x8017e32d 0x80184584 0x8018a6cf 0x80195e57 0x80196e4e 0x8019a722 0x8019b1d5 0x8019e3b9 0x801ac398 0x801ae786 0x801af45c 0x801b0103 0x801b0111 0x801b6dc2 0x801b6de2 0x801b7600 0x801b84c6 0x801bb6e5 0x801bbe73 0x801bfc57 0x801c7c92 0x801c9181 0x801c9d72 0x801cdb29 0x801d023a 0x801d16cb 0x801d227c 0x801d34ac 0x801d3fb3 0x801d58ce 0x801d6569 0x801dabb7 0x801dc853 0x801e529f 0x801edbed 0x801eef76 0x801f02d3 0x801f03e3 0x801f4a0a 0x801f7d8e 0x801f9f7a 0x801fc084 0x802011b4 0x80201479 0x8020349e 0x80208832 0x8020c23b 0x8020c979 0x8020ca8d 0x802128b7 0x802138e3 0x80215e3d 0x802167cc 0x8021cb48 0x8021d6c4 0x8021f9c0 0x8021fb23 0x8022017b 0x8022080d 0x80223911 0x80223ad2 0x80226264 0x8022729d 0x80227845 0x802441b0 0x8024905b 0x8024c635 0x8024e7e8 0x802526d0 0x80254eb0 0x8025547e 0x80257d83 0x8025af98 0x8025b25e 0x8025c899 0x8025cb81 0x8025ebf5 0x8025edf4 0x80263499 0x802668cd 0x80267174 0x80268ad1 0x8026baf6 0x8026bea0 0x802761f2 0x8027c3d0 0x8027f95d 0x80280bfc 0x80281a19 0x8028386d 0x8028f03d 0x8029789d 0x8029c5e0 0x802ac083 0x802acc69 0x802b03d3 0x802b1d65 0x802b51c5 0x802b9db8 0x802c2b0b 0x802c514c 0x802d6307 0x802d8085 0x802df63a 0x802f6be4 0x802fe259 0x80302197 0x803021cc 0x803079dd 0x8030c855 0x80320d11 0x803211a2 0x803220d0 0x80323a73 0x80325a85 0x803283e1 0x80328dc9 0x8032b710 0x8033a008 0x8033a152 0x8033dad5 0x8033e4b2 0x8033ed4a 0x803422e7 0x803430e0 0x8034626e 0x80346f34 0x80347152 0x8034c659 0x8034eed8 0x80353a12 0x803541aa 0x80355bb6 0x8035628d 0x803575fb 0x80358cf4 0x8035bc35 0x8035c466 0x8035eba5 0x80362609 0x803694b1 0x8036a131 0x8036e77e 0x8036f210 0x80377f7f 0x8037a994 0x8037c4d0 0x8037fb73 0x8037fbfb 0x8038005f 0x8038332b 0x8038a13c 0x8038a216 0x8038afcb 0x8038cae0 0x80391069 0x803927b9 0x80393f3d 0x80394216 0x80396c67 0x80397a72 0x80397ad1 0x8039b68a 0x8039d7e7 0x8039dff4 0x8039e8e4 0x803a0d9c 0x803a2d3b 0x803a4501 0x803a4678 0x803a4748 0x803a596d 0x803a7b8e 0x803a7ef4 0x803acb2c 0x803acbb8 0x803ae81c 0x803ae8cf 0x803aebf0 0x803af8ee 0x803b0d68 0x803b2069 0x803b2307 0x803b242c 0x803b2fdb 0x803b38e4 0x803b4753 0x803b479f 0x803b48e1 0x803b6d24 0x803b9184 0x803b9378 0x803b9524 0x803b9b4f 0x803b9ddf 0x803b9e6a 0x803ba1db 0x803ba5a8 0x803bb201 0x803bc475 0x803bcce2 0x803bebc6 0x803c053d 0x803c111d 0x803c207c 0x803c5ebc 0x803c6e84 0x803c83b3 0x803cba41 0x803d0225 0x803d0dbe 0x803d64fd 0x803d7bb9 0x803d8440 0x803dcfb4 0x803dd166 0x803dfc06 0x803e064d 0x803e1fba 0x803e5d32 0x803e6284 0x803e63d7 0x803e7ef4 0x803e8e7d 0x812cb 0x8d82 0x99bab 0xa2616 0xb1b7a 0xb4ac4 0xb56c2 0xb5e56 0xc0001799 0xc0005733 0xc0006f85 0xc000b3e8 0xc000be95 0xc000ea4b 0xc0010b02 0xc0010b92 0xc0014f9e 0xc00171df 0xc0017947 0xc001b4d2 0xc001f8bf 0xc00217f2 0xc0022349 0xc0022e1a 0xc0026759 0xc002be8a 0xc002f869 0xc0034ace 0xc00352c4 0xc003ad93 0xc004401c 0xc004949f 0xc004a314 0xc004df62 0xc0050686 0xc0069806 0xc006bfba 0xc006dc9f 0xc006f1db 0xc007584f 0xc007d49b 0xc0080d39 0xc0083750 0xc008bd53 0xc008f0cd 0xc0091992 0xc009a50f 0xc00a0e9c 0xc00a3929 0xc00a7351 0xc00ae923 0xc00b4176 0xc00b4b33 0xc00b4bdc 0xc00b7386 0xc00b8095 0xc00b8f45 0xc00b9fd6 0xc00be393 0xc00c3ab1 0xc00c4234 0xc00c4600 0xc00ca18f 0xc00ce8e9 0xc00d1cb7 0xc00dd45b 0xc00de715 0xc00e10fa 0xc00e155c 0xc00e2da9 0xc00f3eb7 0xc00fa9e8 0xc00fb02b 0xc00fea0c 0xc00fed2e 0xc01035b9 0xc011392b 0xc01169b9 0xc011fbb3 0xc0126e35 0xc012e1a5 0xc013d10a 0xc014d605 0xc01543fd 0xc01568a6 0xc015f218 0xc015f7ed 0xc015fe5e 0xc0161932 0xc01674b8 0xc016abd4 0xc016ca7a 0xc0170cd2 0xc0173406 0xc017a3b9 0xc017bad8 0xc018000c 0xc0182f0c 0xc018b228 0xc0199993 0xc01999b7 0xc019a2ae 0xc01a4366 0xc01a84d6 0xc01ae6c7 0xc01af45f 0xc01af5a7 0xc01b0e32 0xc01c0cef 0xc01c4269 0xc01c642d 0xc01c96b7 0xc01c9c97 0xc01c9da1 0xc01ca6ac 0xc01d14e8 0xc01d679f 0xc01da790 0xc01df32e 0xc01df3cb 0xc01e1f8c 0xc01e472d 0xc01e7b51 0xc01e7b5c 0xc01e87d4 0xc01f424a 0xc01f6bef 0xc01f763c 0xc01f7bad 0xc01f8517 0xc01fab93 0xc01fccb7 0xc020246e 0xc02041a4 0xc0206234 0xc0206edb 0xc020771f 0xc0209cf7 0xc020ddca 0xc021e62d 0xc022a177 0xc022c278 0xc022f3ff 0xc02357ec 0xc0237fb3 0xc02392bf 0xc023a632 0xc023b4fa 0xc0241c1b 0xc0243087 0xc0247b93 0xc02568cf 0xc025aeed 0xc025ba41 0xc025da65 0xc025ff7d 0xc026052d 0xc0268268 0xc0273890 0xc0276b43 0xc0276b99 0xc02779cb 0xc027b0e2 0xc0287fbf 0xc028a53d 0xc028c81e 0xc028e0df 0xc02953b9 0xc029818c 0xc02a2e86 0xc02a3753 0xc02a57ba 0xc02a744e 0xc02a756e 0xc02a8883 0xc02a91f9 0xc02afe43 0xc02b032a 0xc02b3ac4 0xc02b7b92 0xc02bbeda 0xc02bd6b0 0xc02c3898 0xc02c7404 0xc02c8719 0xc02cdf1d 0xc02ce93c 0xc02cfbb7 0xc02d2819 0xc02ddac7 0xc02e83f4 0xc02e9dfb 0xc02ecaf0 0xc02ee103 0xc02f1c76 0xc03054e6 0xc030abd2 0xc030bd49 0xc0316e12 0xc031c031 0xc031cf29 0xc031e87e 0xc031f055 0xc0320324 0xc032d580 0xc0331636 0xc0333845 0xc0334480 0xc033c82f 0xc033cb91 0xc034a1aa 0xc034b685 0xc034b97f 0xc034c235 0xc034cd52 0xc0356854 0xc03588bd 0xc035895a 0xc035a126 0xc035a55e 0xc035f6a4 0xc0360477 0xc0362073 0xc03641b9 0xc0365707 0xc0368b42 0xc0368c0f 0xc03690ce 0xc036a97b 0xc036be5c 0xc036d7d2 0xc036dc81 0xc036e3bf 0xc037127f 0xc0371f06 0xc037320f 0xc0373b4c 0xc0374271 0xc0376111 0xc0377ae9 0xc037874c 0xc0378f62 0xc037c298 0xc037c86a 0xc037cd59 0xc0380e21 0xc0381c1c 0xc0381efc 0xc03860ac 0xc0388a30 0xc0389bfe 0xc038ac34 0xc038ca11 0xc038cbea 0xc038da07 0xc038da43 0xc038ef2a 0xc03933eb 0xc0395b23 0xc0397981 0xc0399e1c 0xc039a7cf 0xc039b786 0xc039b788 0xc039bfb1 0xc039c130 0xc039c287 0xc039c28b 0xc039d34a 0xc039e420 0xc039eb27 0xc039ef0b 0xc03a0adf 0xc03a0f69 0xc03a22a4 0xc03a266e 0xc03a3fbd 0xc03a5ceb 0xc03a5cfb 0xc03a7f97 0xc03a8270 0xc03a948f 0xc03ab570 0xc03aca56 0xc03ada37 0xc03b0403 0xc03b2f39 0xc03bc19b 0xc03bc502 0xc03c1a66 0xc03c2746 0xc03c2c93 0xc03c5ddd 0xc03c6ef0 0xc03c8b24 0xc03c9041 0xc03cf5a8 0xc03d1c93 0xc03d5156 0xd22e0 0xd5494 0xd867b 0xdaefb 0xdcd20 0xddc3 0xf7705 0xf7915 0xfa055 0xfab86 PASS Testing the first 0xffffffff seeds ... 4 threads starting... at 0 at 40000000 at 80000000 at c0000000 41ffffff 81ffffff 1ffffff c1ffffff 43ffffff 83ffffff 3ffffff c3ffffff 45ffffff 85ffffff 5ffffff c5ffffff 47ffffff 87ffffff 7ffffff c7ffffff 49ffffff 89ffffff 9ffffff c9ffffff 4bffffff 8bffffff bffffff cbffffff 4dffffff 8dffffff dffffff cdffffff 4fffffff 8fffffff fffffff cfffffff 51ffffff 91ffffff 11ffffff d1ffffff 53ffffff 93ffffff 13ffffff d3ffffff 55ffffff 95ffffff 15ffffff d5ffffff 57ffffff 97ffffff 17ffffff d7ffffff 59ffffff 99ffffff 19ffffff d9ffffff 5bffffff 9bffffff 1bffffff dbffffff 5dffffff 9dffffff 1dffffff ddffffff 5fffffff 9fffffff 1fffffff dfffffff 61ffffff a1ffffff 21ffffff e1ffffff 63ffffff a3ffffff 23ffffff e3ffffff 65ffffff a5ffffff 25ffffff e5ffffff 67ffffff a7ffffff 27ffffff e7ffffff 69ffffff a9ffffff 29ffffff e9ffffff 6bffffff abffffff 2bffffff ebffffff 6dffffff adffffff 2dffffff edffffff 6fffffff afffffff 2fffffff efffffff 71ffffff b1ffffff 31ffffff f1ffffff 73ffffff b3ffffff 33ffffff f3ffffff 75ffffff b5ffffff 35ffffff f5ffffff 77ffffff b7ffffff 37ffffff f7ffffff 79ffffff b9ffffff 39ffffff f9ffffff 7bffffff bbffffff 3bffffff fbffffff 7dffffff bdffffff 3dffffff fdffffff 7fffffff bfffffff 3fffffff ffffffff All 4 threads ended PASS

Input vcode 0x00000001, Output vcode 0x00000001, Result vcode 0x00000001 Verification value is 0x00000001 - Testing took 3620.925629 seconds


:)