Added Python port of the NuHash algorithm.

This commit is contained in:
LoRd_MuldeR 2023-07-19 23:12:51 +02:00
parent 23c906d2f1
commit 3ff888517c
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
7 changed files with 603 additions and 1 deletions

7
.gitignore vendored
View File

@ -1,11 +1,16 @@
/_release
*.lock *.lock
*.o *.o
*.pyd
*.user *.user
/_release
/**/.settings /**/.settings
/**/.vs /**/.vs
/**/TestResults /**/TestResults
/**/__pycache__
/**/bin /**/bin
/**/build
/**/node_modules
/**/obj /**/obj
/**/out /**/out
/**/package-lock.*
/**/target /**/target

1
libnuhash/python/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.c

View File

@ -0,0 +1,20 @@
NuHash Python module
====================
Requires Python 3.11 or later, Python 2.x is *not* supported.
Instructions
------------
1. Install the Cython package:
$ pip3 install Cython
2. Build the module:
$ python3 setup.py build_ext
3. Run unit tests:
$ python3 test_nuhash.py

458
libnuhash/python/nuhash.pyx Normal file
View File

@ -0,0 +1,458 @@
#!/usr/bin/env python3
"""NuHash, by LoRd_MuldeR <MuldeR2@GMX.de>
This work has been released under the CC0 1.0 Universal license!"""
import cython
from libc.stdint cimport uint8_t as u8, uint16_t as u16, uint64_t as u64
cdef size_t NUHASH_WORDS = 6
cdef size_t NUHASH_BYTES = NUHASH_WORDS * 8
cdef u16 VERSION_MAJOR = 1
cdef u16 VERSION_MINOR = 0
cdef u16 VERSION_PATCH = 0
# ------------------------------------------------------------------------
# Const tables
# ------------------------------------------------------------------------
cdef u64[6] _NUHASH_INI = [
0x243F6A8885A308D3, 0x13198A2E03707344, 0xA4093822299F31D0,
0x082EFA98EC4E6C89, 0x452821E638D01377, 0xBE5466CF34E90C6C
]
cdef u64[257][6] _NUHASH_XOR = [
[ 0x01DCDF00414B3037, 0xB1B3AF661B8E96F8, 0x944D2873DB393121, 0x73DA9A36662AE755, 0x1F4F318C4ECB56B1, 0xF09743D99C2AA5BC ], #00
[ 0xA81FBBC6CBBFC954, 0x39DE43648959EDDB, 0x1A641A0BDA01822F, 0xB52E607266932658, 0x2C5B1731AC802084, 0xC2EF10671FC79DD4 ], #01
[ 0xCF2A8D8E08810046, 0x8B7E9B2089E268F6, 0x930461652C5D2DEC, 0xF096E42223BFC8B9, 0x8DD338964CFE0970, 0x269C342F7CEC60BD ], #02
[ 0xB970A920D2ED0552, 0x010F894A254DA7E1, 0x8D5F205F9D1A40D8, 0x50C33DCCC3FD5F58, 0xB49F31BDE7D82C57, 0x7CDE04F62A959033 ], #03
[ 0x49FAB2822B9C84AC, 0x34B8648CD68CBEF1, 0xE5121147BB4126DE, 0xC0B31F54B2FFE00F, 0x2F193DA38E8CC632, 0x058C984B429B8AFC ], #04
[ 0xE07F9DA44D8C9942, 0xBE2AF9B39ACA65F2, 0x5D3D8FB1466DC295, 0xC0051E3EC3F962C7, 0xF8FDC3CCD4CE2BB6, 0x9024C0EFC6199937 ], #05
[ 0xA3111377EF01F5EF, 0x31F59B366C02A3FF, 0x61B82949760D16DC, 0xF6B958AF92BD3BDF, 0x7297AAEFEC69C0B2, 0xFE8A50AD9E8684CD ], #06
[ 0x3D3DD0C829EA9AA0, 0x3E77597EEC96C7A3, 0x8FD038231E7F1684, 0x64617B131FB7EDE0, 0x85C99CE4C5405874, 0xA58735D41F19C5E3 ], #07
[ 0x8028628ACAF91B9A, 0x194A640538C97064, 0x04A15E018A4F1680, 0xF4BE1B04C2360955, 0xDFB24D4CEF581A20, 0x3C59D0A0FD15879D ], #08
[ 0x88F8E2ECE78AF1BC, 0xB46B6E22297364C2, 0x9339F17F926B99F3, 0x31293489B3B8F07C, 0x3909CE1649C9BCF1, 0x0C46103BFA31BCE9 ], #09
[ 0x4D1A0B8CC7EFE2A9, 0xAFD7878CAD55E871, 0xC89CFBC858CF4153, 0xC4739486C74F75D6, 0x0BF7192C130AC9F2, 0x0084F2BC5E81BD9A ], #0A
[ 0x4AFBE975014FCACF, 0x41DEAF8CFACC41E4, 0x3C1EC23B53ED16E9, 0x78B06EB30F1C3248, 0xDD11165D04285C72, 0x6546D9B5609491E4 ], #0B
[ 0xFFD1E2E04DC8D260, 0x07B186948A74ECCE, 0xB5120E45121AC531, 0xBD0BC86330810C85, 0xDE93AFDDDB487730, 0x78DEB0DE6EB99196 ], #0C
[ 0x79BAA2AC3FDEBA55, 0xB1B7E3E1C92A567E, 0xA53F69AB4A5B0794, 0xF0DA7499954F6DDD, 0x58117C89E1132248, 0xD95DF5F794C51A6E ], #0D
[ 0x89BC8A0C65091C33, 0xB04EEAEE063135C2, 0xF53267E04AB6E689, 0xB4C579B7207E8BF2, 0x3FD31E51343CD2DF, 0x119E523E2F8197FE ], #0E
[ 0x2E10CB1C6060F32D, 0xBC92E732A94E6B63, 0xF3220D831FD04267, 0x502C5F7414BCE87F, 0x89E0651DE91D2457, 0x759E56B04482D915 ], #0F
[ 0x43AEE32C6A84E803, 0x0C5007202C0BD7E3, 0xB4F464474205D32A, 0x7D17FC95DE386C06, 0xE8DFBF64567AA545, 0x55BD889D5853046F ], #10
[ 0x687ABE14EAB8DA27, 0x397B3AB50D72C344, 0x505EAA6D1FDE618D, 0x61BE79865DA13F69, 0x17BBAB29B5E90E2D, 0x010C921972FA8B2F ], #11
[ 0x8B7223A4F56FF453, 0x291B7B5CB98B6FE1, 0xFD421625786FBF7D, 0xE33D1020D0E8CDC8, 0xCA530C708B739E87, 0x878AF1F304B8A12F ], #12
[ 0x7ECE1F24E56DD711, 0x2E0869241B2FA6DF, 0x84B834DCC459B2FD, 0xE022EDA6319E7D3B, 0x59839D8CA03C9928, 0x644790F491BBC774 ], #13
[ 0xCBDC6F49E6B0DD0D, 0x44BA2F8D00346732, 0x86BCC821586AE61C, 0xC7B7491285CEE55B, 0xED3912FFD97F3851, 0xF4AF0186BEBEBCBF ], #14
[ 0xCA8A48E54ECCE516, 0xBEDF1864B7F8F506, 0xD56A1F60A4B36AA4, 0x49B25AB5FE0DD9D9, 0x21377DBB5E49FCE1, 0x708F64F5D59D99E7 ], #15
[ 0xE9F873A569AFE02C, 0xDA66BC05CA997390, 0x8C88174756D35385, 0xEAAAF16CF4FDA730, 0xB39F7A55653A3512, 0xF10AB727BC23E852 ], #16
[ 0x93E96FF8C5BBE2AF, 0xA47785420253E97C, 0x704B25D1F77D074C, 0xC0B2093F1470559C, 0x8D5BFDD4E364AACF, 0x550518673F5B1BF7 ], #17
[ 0x8DAC832E5BE81ACB, 0x588BFB202B7583D8, 0xA34D8A70DFD1D7E4, 0xD03B0627B687033E, 0xE3D0BE7EDBDC75CF, 0x818EE8C5B09F8BEA ], #18
[ 0x8E3B02E1489D7D31, 0x5336752B64E3B532, 0xE4D4CC795C580A65, 0x6DAB08F313ED767E, 0x8E567E88FDBA36BF, 0x259490F1D8E933D0 ], #19
[ 0xEAB437D0D62CAA62, 0xC090AD28B982B003, 0xE255D768D25704EC, 0xA048511AF6256A43, 0xE79F078F4D498B5F, 0xC41735FB75B357FE ], #1A
[ 0x70DA9FC3504FF29D, 0xB9AB1F388673FF25, 0x36922F4CD17357BA, 0xF09C3AB292E7E04A, 0x90CE0BC3D9BA13EC, 0x647C4CA63C918DE3 ], #1B
[ 0xD834A38DD1ECD688, 0xA97A0020DE46AB6A, 0x9CDEC7F6E62EA71F, 0x288A5A6FD74DC47E, 0xD44A2E2765CE50F1, 0xBB9B50B5DB9E4F3C ], #1C
[ 0xC66DA90E41DDF2E6, 0x5A3FE86F160C5C09, 0x6F6AF0405108CCBE, 0xF938382EB627FC7F, 0x163DD634617F006C, 0x5184B1FEDC908497 ], #1D
[ 0xC95719ED07FCB21C, 0x5112DF043F6EE7EB, 0x50F9FD60012334CE, 0x589FA85104D96579, 0xB7129E44D71905A7, 0x3314766E0733528D ], #1E
[ 0xDC6C8014C5457CB8, 0xD635FDCD286A69B6, 0xD66F232CE27D01BF, 0x56AF4AC0F682EC0F, 0x57DF1D55B64328F5, 0x651ED4C52A87CACA ], #1F
[ 0x26D9D1CC79EEC502, 0x69BF340A34B1EBFE, 0xFAA5AAAC8E397174, 0xD0A8F9BD426BCF6F, 0x5B131F464D6D2452, 0x122DD15660D0D6DA ], #20
[ 0x6E389AEC5F51A22F, 0x7EF68F1C54C127FB, 0x986D4D46E0485C30, 0xF0A47B39E7CF8A31, 0x1D398DFDB7F2A78F, 0x2FC651D1FBB10D2E ], #21
[ 0xA44E4E8D1B49DCB0, 0x07A4822049C2F343, 0xC40AC04A8D6505BA, 0xD9B91D3F0729B16C, 0xAAF39951B50F9015, 0x966EF5D3AD3F9076 ], #22
[ 0xEA78CBAC0EB6D009, 0xA0FEA6725A23DEAB, 0xCE729C7444CB94D9, 0x40A994626627AA0D, 0x37F738CDE3D018D5, 0x4C29491C01CDB3C5 ], #23
[ 0x7C9792AEA745C87A, 0xD1FF5620C5BD8FD4, 0x9ECA84E3004B56B9, 0x5AFD3923C228B1D6, 0xE5DBF79EB3FD283B, 0x441712E354084B9F ], #24
[ 0xE35D288BD8E249BC, 0x91776C1453A366E5, 0xF5D1E1684E95EFEC, 0x9108E117D7DDF606, 0x81B30F9DA2CE7C8C, 0x6497DBD786818C0D ], #25
[ 0xC2F891FF45044BE0, 0x75A1A76D2B87E2EB, 0x85CE65798AF3C2BF, 0x213F532B4EFD09DC, 0x0DAA1DF5A53A6C88, 0x3028606A50D826B2 ], #26
[ 0x609A62616379F33A, 0xA339A3BC53E4516D, 0xD7AD92616A5ADBEC, 0xD043726D86E924AA, 0x8555B564F4C29865, 0x56AA12AB31C1D6B0 ], #27
[ 0xCED9ED85C1C17BFF, 0xEB522325ACBAFFC2, 0x04D3D8F4B2D15394, 0xD271504C04756EEA, 0x2DDBA4A91AF827F1, 0x1F67D5C28F8002E4 ], #28
[ 0x8B9C08AD432DC08F, 0x5A7543E29796BBC7, 0x34A6DB5B3C1967DE, 0x016E3BC2A2804EE4, 0x5B9BCACCE5172F75, 0x7549598B80ADBDBA ], #29
[ 0x6F3FB117C5CDD155, 0x16C3B0A59CD6EEC5, 0xD9A1A411DE538769, 0x938C54979F4AC37C, 0x3737BCC1D55284DB, 0x6CAD9F8AF9156BB7 ], #2A
[ 0xEBBF284F9C75EBDF, 0xB383EBB406753DE8, 0xAA86127AEE7C403C, 0x10BFDD10523DE027, 0x138BF6C4EB4A8A13, 0xB1EFF67DDB78B067 ], #2B
[ 0xF6D1138D7AA3DA5E, 0xBAA8098D8FB66371, 0xDAE76D1B8B6CAAF2, 0x400F1034368D1EDC, 0x7C937F5172E8D277, 0x7D05BBF83CADE6EF ], #2C
[ 0x0E9C2EA6CF34B081, 0x9036B30D58F60BA0, 0xDB3A2C5848F08BCA, 0xC87AD1B94250D564, 0x7C892E09EEF96166, 0x26DB85CF571085F3 ], #2D
[ 0x251EE3F58718C12A, 0xF9438D81178A2AE4, 0xF0929A889039A8A8, 0xF06B65225EBDCCFD, 0x2E4D14EDF7BF73C6, 0xA9369895BC1DFACF ], #2E
[ 0xCAE302B41D6979CB, 0xBBFA5A58B51EE623, 0x5113B99DC81AB52F, 0x6093795BEC17A056, 0x8F71FB4D2E5E355E, 0x762F92EDBA34A2F2 ], #2F
[ 0xD130015265A4D9FF, 0x09BEA253D71F26C8, 0x81B6EAEDC46521E6, 0xFAE268165682B8A9, 0xA89C3EC4774AB623, 0x0D2E45E055219DB2 ], #30
[ 0x2B560284C3A692AB, 0x37008AD0B379A7B8, 0xAF11CD2C30F90BFC, 0x7FE87A250F2762ED, 0xC3FBD711647242C3, 0x74ED8264F6B322BD ], #31
[ 0x28195CC8A7AD3943, 0x53CBE808464C4FC4, 0xD58E3D7A765F8726, 0xD83052F60185AA4F, 0xEFCB0D85223BB4E7, 0x5A31305E787FAC28 ], #32
[ 0x725D0EE230F19543, 0x9091D2C6BDDF34E0, 0xE3BE49C6C2754601, 0x61BE300BA4AD566B, 0x02D79D7551FA7CC1, 0x6543910F5F1CDA58 ], #33
[ 0x4099ADC44481B43F, 0xFE1361922FD9EB81, 0xA989C09E441FCEAC, 0x449B3A13D3CB9019, 0x45A9BE396F201134, 0xDC1AD05A046633FE ], #34
[ 0x1A563A6D522F3E69, 0xBE589E079F475A9E, 0x75A2A9638E4C0038, 0xDA3B6202577A0362, 0x211D3F1E0D727AF6, 0x5E1FFC529AD99233 ], #35
[ 0x47B61E86C6D6D01B, 0x437D6F83ADADC318, 0xD5A361028DED738C, 0xA00D4C630425164B, 0x1A69AFA5AF4C9DD2, 0xF99E1C67F951B582 ], #36
[ 0xA66A7740B6BDEA79, 0xFEF7FF1496AF80A3, 0x05AFD43EEACD898C, 0xB00C78ED31AD7134, 0x0ED31A1AD7846673, 0x74B96844161499BE ], #37
[ 0x46FA8D6CCBF6D12E, 0x31C2FC147F303956, 0x707F4401DE5F067F, 0x3AE5FEC7E33594E9, 0x28E39F8A63531714, 0xB7B329EA1E9FCAB2 ], #38
[ 0xEFD8F755825C7804, 0x1F5A93870BD30CD1, 0xEFBF894671FF8716, 0x28ED617FF22BDA58, 0x411289CCAE5CB62E, 0x95DD42F41801F2F9 ], #39
[ 0xA8525B8645FC59E1, 0x75E62DC00A5F7F0C, 0x09C56785210416AC, 0x50EF76E9B30D7626, 0x2B3B2CDC19F5D665, 0xA41297CD11D8F4FF ], #3A
[ 0xEAC99A649EEE5039, 0xA593C92F143C0065, 0xB314735203071206, 0xEA2761A0C764A4EC, 0x02AA7FD46CAC25B3, 0xC68CC182A96D03BF ], #3B
[ 0xB2873F024EC83CA8, 0x97470AB8FD8853EB, 0x18FE15C159B305BD, 0xB0AB08F687EAEAFD, 0x510A3FDE73602E43, 0x03E1B84DCCF0FCF0 ], #3C
[ 0xD85BBBDC8033C0D8, 0x9223D9C39CA9F34F, 0x7D3BCB6D5B63C3FD, 0x1C30F974DA0C0FB5, 0x8B24BC9EBEFB5143, 0xC58954925B7B84FC ], #3D
[ 0x6ABD7C2E0844D7A7, 0xCCF2EA456CDF530D, 0xE8938CF52B3921B8, 0xBA023CA2F281657C, 0xEC635DA675D1EDAE, 0xB4AA52F22EE1BE6C ], #3E
[ 0x981C3AC677CB5904, 0x6A92B54C84877B49, 0x745BA6BB40C55815, 0xB7AF550D22A371ED, 0xD5E8BD87C65F5374, 0x67874A37F0F538F5 ], #3F
[ 0xC23BBA2A9DECC021, 0x4E610E930B0E3450, 0x1A681AA91477577E, 0x38A3209714EDC376, 0x0FD15563EEEB4AB6, 0x7D57668A01D42178 ], #40
[ 0x6AF88CE145A098B5, 0x1AEB858CD88B8B46, 0xE8B733AFB8E2D6E8, 0x313FAA8C10A7EBFA, 0x127D375E77557CEA, 0x96BDA2F70B2F2155 ], #41
[ 0xEC8903978FAFB636, 0xC7213C425C079763, 0x760384036AB6D17C, 0xE0C63A26385F1F49, 0x299877D6811A6DF5, 0x876F90FC5304B88D ], #42
[ 0xA6FABBC2D6E0BA16, 0x9B70C9640080E6BC, 0x29B2D5265598B27B, 0x4A9657C726E4397E, 0xA801CCC6766678D5, 0x800EF7CC72619998 ], #43
[ 0x235931A8CF5490BF, 0xE798F98E0E8F879F, 0xC6EEE29C38F30CA7, 0x929A79F2D53E0024, 0x88F2E12749587A45, 0x0B85B28F38891965 ], #44
[ 0x165E0303E4A4D827, 0x67994F42D1E8436A, 0xE6CC8BCF6E130D1B, 0x50101711709DDEFC, 0x373BDEC40CD05328, 0x40B274A4AA5109F6 ], #45
[ 0xA9F88BA008FDF8C8, 0xECC897E3476EE05A, 0xBCE290AB69D57A74, 0xFA44DB1811E3115D, 0x6267AEFD64480C88, 0x2697D04A2D3AECEB ], #46
[ 0xC0782AF2ABCD3313, 0x02BA1290F2F96273, 0x63C82F1A56ADC2B9, 0x10F8E8C03EFE51C4, 0xE3EB348625CCAFFD, 0x93D607969CB8E7AE ], #47
[ 0xCC6E179443E58FBC, 0xD21C93C655A7B8EE, 0x2B9834A31F2B8BA4, 0xC83B69516025ECEE, 0x9176EB7B427AAE94, 0x8CB65B9E30B7A76E ], #48
[ 0xC1A33A0AD6EDD989, 0x18B3C5D95813B5F7, 0xB024BD263B359A8B, 0xC8C17C2216A99B50, 0x71F9A11D58237729, 0x3AA67C7618284290 ], #49
[ 0x99B7465E09201C7B, 0x9AF89FA01CA4FA81, 0xFC2EC63E761AD123, 0xE2A9A39585B17D14, 0x08394DE529F94E81, 0x479448E69794FAA4 ], #4A
[ 0x23CA3D1C4CBDCABB, 0xE3265436CE1A37E4, 0x1BBF10F69E8A4CC9, 0x05A66708048F5C4D, 0xE259DCDD9C5BFEFE, 0x439E65FAFD936EFD ], #4B
[ 0xA24D73B6978F719C, 0x3F53F343CCB0BB8E, 0xBE3C72769EE07C6A, 0xFACB9E539CF558DD, 0x67B91D4E30DE986A, 0x1DB913D11698913A ], #4C
[ 0x98BD4E140DC3C3C6, 0x142B1592BF3263E8, 0xCDBEAC59ED095B0E, 0x900763F0F625896A, 0xE213550F30324E39, 0x8A13A4417A803195 ], #4D
[ 0x2ACD98ED8C626073, 0x1CAAA6B4C4CF3238, 0x04DCB41EB677EB5D, 0xF88B5844A8105B68, 0x981D9E951A061A4D, 0xBC9471894C878EDB ], #4E
[ 0x4959FEAD5D6C2DBD, 0x6ABD59E28C503049, 0x06D2C5494CAF8B34, 0x70E4541304A4293C, 0x520F3416CAF2F503, 0xB23D09D92613DB85 ], #4F
[ 0x26B5A815C32D1791, 0x2C99E7555BB033C6, 0x09CE9D6A0002514F, 0xD485282B2B8D7997, 0x9C5B792F4A4A14C6, 0x851D9D02DC0BB4E7 ], #50
[ 0x62FEB6CACFB060EC, 0x9D977D69D5C661EA, 0xBF08EFD806D81556, 0x25F1EEA460EA5718, 0xA25346B51F5A9665, 0xD92F9ADC358CA274 ], #51
[ 0x27E63DFC63E8FFA6, 0xCDB9CCE2CE99FDA3, 0x979D5B754974830D, 0x3298C8407D6693BE, 0x629D5FADA39B42B7, 0x2654D31271CD84E1 ], #52
[ 0xAB1FA4DAF66E583C, 0xEEB6B7A236D24766, 0xA90738CDFDF5C6B3, 0x28CBA9E5648E2D4C, 0xFDE5BF6C0CFE0DA3, 0x9D00B863D7D78485 ], #53
[ 0x75FBBF094EEA16AA, 0x48931F027CD729F2, 0x5D360679009B2E7F, 0xDDFCD148BD3DE21A, 0x4DBFF544B094D0E1, 0x9C0E5C6294352C22 ], #54
[ 0x283A27FF968853D2, 0xB0960C6CEA0D03F2, 0x172BBA07A473DB38, 0x688C87D296E6F4BB, 0x5CB7E9BC5D68CF0F, 0x57A5D71B0E47BFB4 ], #55
[ 0xDE0108AAC1E4FF2F, 0xD346CFABEAC62B99, 0xB72E203F98B5F608, 0x81853D8CA54B29BE, 0xA6AED7C89FAA1680, 0xD2093B155C39D7ED ], #56
[ 0x0BAEAC99D4974B84, 0xC7F258A699C9B4DA, 0x6F622C5E4ACCF5C1, 0x58AB397D9781BEAA, 0xBF811F67E101FFE3, 0xAFBCC2881C3C0EF3 ], #57
[ 0x26B211FB518D6C3E, 0x64BADAD51A10784A, 0xE6BE4E06A587186C, 0xD471F5C61343CD5C, 0x8389BB0DD6AAED5D, 0xC88112678914A17D ], #58
[ 0x2B2D0BC3BB88D27D, 0xC5A7D1FAFF517AD2, 0x96F39056A09F82AD, 0xFB38A61A6CED4D4E, 0x9D308E4EA6F9B264, 0x9097CE294AECC6B3 ], #59
[ 0x8FCA2B950690B1A2, 0x293EFCBF03D422DF, 0x8C9125B3E76353AB, 0x3D402092A1A70173, 0x9BAB974CAB9BF676, 0x5EA8FCC55D8C586E ], #5A
[ 0x408C92E8C2E1EC8C, 0x4AF4C914B71B4350, 0x5186AEE0CDFB1069, 0x2385EAFAB9657C67, 0xF708E4D3C898CA80, 0x1EC8B9F89884907E ], #5B
[ 0x46E8958B6A2C1878, 0x2172FD410F78A647, 0x9D8E9DD83A299004, 0x390913C3265AD025, 0xD231F1E23077CBF1, 0xE7EE3E574E80D7F3 ], #5C
[ 0x5A8567A3D85E40B2, 0x16ECF161133FCF73, 0x52DA5C6FBA3C0DD7, 0x56E57983DEB34BFB, 0x83254FDCB768D153, 0x9A14F95F35C6B82D ], #5D
[ 0x498A29C6E19D4AE6, 0x2EF4AAF46027BA11, 0xBDBA7DAA84F39505, 0x940B2A04F6DC944D, 0x4E7ED35610FC0D53, 0xBADD94C2907E59E1 ], #5E
[ 0x14DF0FC43F475F80, 0x17E2AA8D264BF82F, 0x92625BDFE58B934D, 0x8384F415A4ACEA81, 0x8E9C5EAEC5D8642B, 0x4D8EF55F1C826687 ], #5F
[ 0x4A2335C4F77128D9, 0x544E1476D29ABA94, 0x654EC86321785044, 0xB04AD9B02F80445A, 0xB0E01B6480C8D020, 0x596E325E88A3CBBF ], #60
[ 0x896955157448D062, 0x0DB08C4C0F236D68, 0x3BA8FC5B3CD1C4A2, 0x04F57C53E144535B, 0xB7D04DCC7BE46840, 0x4BBE993192334646 ], #61
[ 0x1D7837E6AB02CE27, 0x3EA35BAED4493EA4, 0xD1CAFDB5DF94FABE, 0x98B580BB62170C4F, 0xC3C57A6CA9421C43, 0x68D65FC2C1201634 ], #62
[ 0xFAEABABC48717536, 0x454251E8F62F7315, 0xB318E8A7FDCDC523, 0x7C2E832013C91344, 0x4D9E5DAFD1699052, 0x12262E8C870537A7 ], #63
[ 0x8A3E5D0BEF8402A2, 0xA33BC5FAFA019909, 0x63CBE8ACD00762F5, 0xEA26A3F181984178, 0x6EEB78D1BB4AF6BB, 0x7ECF9671300E845F ], #64
[ 0x0811B67CCCF5D0FC, 0x9F8CAB3F3496BD6B, 0x57CB7D24F1355C2D, 0x58218594165BDE80, 0xFAF3368A653A78F8, 0xC04CD80176267762 ], #65
[ 0xE6417CE75AAA23B0, 0x34A7BFE3CBA61761, 0x8C13E396F8C9B6ED, 0x5C9066464B09ED63, 0x76CB6A642C5CE283, 0x498E082A3EB449C6 ], #66
[ 0x6F2ADEA6357B5AA0, 0x54DA382B15557B69, 0x302BD81946237AAE, 0x8F0CBB82111EFEDC, 0x45DD2DADCE20F2D3, 0x8A77A5E9E8A2D1D8 ], #67
[ 0xE1EC332735862A28, 0x92B68B1A7E9C7C44, 0xF45618DC99E963E3, 0x7CAC984502DD1A73, 0xC8650598CD70840D, 0x9A5DA584A26D4EFD ], #68
[ 0x16B19B010740C15C, 0xB4544AC01016439A, 0x221F749C9E2F99A5, 0xA63E8A279A65570F, 0xC7231669ADD072AD, 0xC5BC35BA740BC801 ], #69
[ 0x6C44E75A4F378694, 0xD27ACE108A577647, 0x17C487FAFA7E15D6, 0x6A3654D5C8E29EDF, 0x0CE35EEDCC611FFA, 0xD88A8C03C0095093 ], #6A
[ 0xCF106948BC4B1F2C, 0x91C0DC9990B99712, 0x193B21E3E109AB32, 0x3340DE0608DD1666, 0x8A5BB677BF602828, 0x402C410B1197B771 ], #6B
[ 0xEB080FF49CA5543E, 0xB4B9429542D6CA27, 0x5999D45DC1533205, 0xF7EA9E398A1BEF3E, 0xBE8817775476DEC6, 0x17064D7790C84100 ], #6C
[ 0xF3328E9150A7F8D6, 0x52E3E61B04ACFDF8, 0x51D82010F3CEB015, 0x59D673336676D5D8, 0x4CB3BCEF1D91C342, 0x0C589AB58033BE49 ], #6D
[ 0x54B8E70EDCE03855, 0x7BB590E99687FD57, 0x6CFF08688D2B1FDD, 0xFD0F6D068BFE994F, 0xEB9BCE302489AE44, 0x66B21F200661E3E4 ], #6E
[ 0x2F5E0060189669AD, 0x473AF1D03C00CAE4, 0x0278299268D1F3B4, 0x888714BC3A7EC9D2, 0x9FF9C7F071EBD2D9, 0x875A5DC25DFFDB10 ], #6F
[ 0xE2A97A3E468399D8, 0x3BF7EACA32C80DA1, 0x13DCAC8EB6C2231D, 0x227EC90E1102EE97, 0xB2344832F0381434, 0x8613888303B190EB ], #70
[ 0x3A3D3B6CE026BFFE, 0x18D4953B9A68ED59, 0x24BB7B574AB777A0, 0xE0CB7DD64983DCB1, 0xCF768C439869AC97, 0x8062BC7A900E6033 ], #71
[ 0x39D4C3B78A7A33C7, 0x43D72EF22AB0B4EB, 0x54AE8184DDA50394, 0x0C2A7DA083C38536, 0x9DBC6F921D4AD822, 0x2CBB61FE182EAA42 ], #72
[ 0xD8CE9A806C0BD24D, 0xF69D65A65845727C, 0xC3FF81CC76F2B048, 0x76B1FDC3CA67CE58, 0xCED0970AFBCBE78A, 0x57502941B726F5F3 ], #73
[ 0xE006AEC17FCEFCF9, 0x05CAA1629E003591, 0xB7050CC99F585312, 0x669260401E159490, 0x8442D25AA757CC5A, 0x228655CD4038770C ], #74
[ 0x93EE8D67D3F1F3A1, 0xBEA46D48DBF8D7F4, 0x3C91F02B8646453C, 0x6C3D7C1F04188A58, 0xEFA97287F89CEF84, 0xCB40364E108BFF4B ], #75
[ 0xC6DCE3730D4FF825, 0x02AF54F87D972790, 0x7D69D20F6F4F788F, 0x90C255C64C166E8F, 0xA3529FBF4BF9C9A2, 0x3ECEC41136694F6B ], #76
[ 0x3DE10A5EC6CA7B3F, 0x7E196081D085ACAA, 0xDF5F0DE3705D60F7, 0x393E7C83DCC57075, 0xA5F33BC2DCB98F97, 0x0AEB7F050D1204C0 ], #77
[ 0x6F3B3B3D11A8BC05, 0xB52269AB2B95B8DC, 0x12EDE24EB1385F13, 0x202BBA6B5836B5E1, 0xEE3636C5925ACC49, 0x42224CF6EEB509BF ], #78
[ 0x5F0CC3BBC4BE9A92, 0x584313FCCC54DD2E, 0xC11FE90F00394036, 0x3371667C72FC9723, 0x9611990B62AC8D9F, 0x4CFCB9EB3C317FAD ], #79
[ 0xCA8E520A894A3FBA, 0xBD9ED1B80098CC40, 0xBDF24507DFF3757C, 0x47AEC572E68D35EC, 0xF3D4523D27B373E4, 0x1AB11E16973A05AB ], #7A
[ 0xFFC293A6C26B817D, 0x2C9E9D134959D828, 0x7FA5216408199BBF, 0xA6F002DE0DCCD861, 0xBE8F9DC57F2CF35D, 0x1352E2DF86A47647 ], #7B
[ 0x84B55BE101708E74, 0x3ADEC53721209F3E, 0xB18F9A1E68DFADBD, 0x09A050819774CF2D, 0xE4AB295D380A8762, 0xA3605B0C689C239F ], #7C
[ 0xDDC7031FBFDFFE8F, 0x0B175DE65B832F0A, 0x31162ABC65719685, 0x51215E534BBC36B1, 0x9F2F7D3B5D01AE44, 0xCF43A2426E83B61B ], #7D
[ 0x7E32DB672B16F04A, 0xCE6F45DE0E6AB788, 0x25718548B8E70B41, 0xD7368BCF39A0FAC4, 0x956863EC49880C47, 0x720E335796341674 ], #7E
[ 0x06707A8E33D9D6C6, 0xB684BFE26CD576C6, 0x44F47E5ECD5FC46C, 0xAF1B23A856D844B7, 0x98A627916AC5657E, 0x040C3964A1127E19 ], #7F
[ 0xA5DAEC3134C0A39B, 0x0CA04160BD5ADB1F, 0xB50EC5A9F29E1ACB, 0xBE2FA1126AF7BFAF, 0xBEFC0AC4C9C5A4B3, 0x994739C71FB1EB29 ], #80
[ 0x6FEC2D343E83A763, 0x5BDBA5715757F50C, 0xD6F6282EE46A11B3, 0xA8B501F5922A5524, 0xA782A21006B605CA, 0xA10BD2E896975C81 ], #81
[ 0xB8AAE0532226D0ED, 0x891831C0470E84B7, 0x74C824D648E8FF28, 0xB5E4E02EAD3906EB, 0x5ABB086ADA60A713, 0xA80C57666A9E29F1 ], #82
[ 0x529E3E52B1E7230A, 0x0C148861C9F08E26, 0x0CFC8A131BAD803D, 0x8C09F324902FAA9F, 0x0231EE4987999848, 0x3B0688492E2B5457 ], #83
[ 0xEFA6EAC5036814CD, 0x02773C1F8DAA5DF5, 0x0E4EEDBD0702DE31, 0xBA7FD757D0D740EF, 0xA8805F0C74005F8B, 0x1448467BFF3E1EF8 ], #84
[ 0x2A07B766016AC70D, 0x64215C35364219E9, 0xCD6F7EFE35FCF6F1, 0xF05CC06084C29267, 0xAB3BF2F32579A444, 0xAC75F42D9A25B9C9 ], #85
[ 0xEF3A14B5EDDB8464, 0x2314E0802D2DD0E9, 0x14DEAEA9F928762A, 0x5763EBB480E15A02, 0x25F7CA14E8CDF5E6, 0x8E594510DC61E6BC ], #86
[ 0xE62C38DCFD21000B, 0x7BB32AE917EE3DA7, 0xE49F15E24CC9B656, 0x56E28259DCA361D8, 0xB43B8008A9285F48, 0x0DC6B4AF7E4AE61B ], #87
[ 0x703C64241142DCAE, 0x732D33342C45063A, 0x37877EA1624567CB, 0x2871D534614DD114, 0xE748092A1D94F5D1, 0x4524056F0C6D1CB7 ], #88
[ 0xE325B1823A595DF9, 0x742D0DD5C96F397C, 0x44361C9540A9F451, 0x02382F9BF6331FB9, 0x8ECBAFBBE91A0467, 0x528EBF3811F904A8 ], #89
[ 0xFD2BC6534631FB0D, 0x27A5F036FEEB9A6C, 0xD0F876D7911D0775, 0x12EFB3A29C6E0B72, 0xDC4BCA3D5E871DA1, 0x028FB6E6E608F46F ], #8A
[ 0xEF17ECC8930A7B4A, 0x9D97B34672FB273D, 0xC6AE835F35A25D8F, 0x6C27469530C21F5B, 0x2FBC16A26150E795, 0x02AD93AAE0B5C71A ], #8B
[ 0x6D24BE43CF07DD56, 0x63681D62A38D2A2F, 0x9872C9B411724AA0, 0xB882B4857C19690A, 0x87B1BA8D2804C6F4, 0xD7B199CC36F40B49 ], #8C
[ 0xEEFB8D8573FD9E0F, 0x933403199B91560A, 0xFF0DB41665D5248C, 0x322EE105EA984196, 0xDB8CE0F83890D89B, 0x3A32F8983C901F80 ], #8D
[ 0x082CDAF93F215BAC, 0x67C118A1B9274FAC, 0xAF74501CFB93198A, 0x53525CABA0E812D3, 0xC9AF3A005EFE8A6E, 0xF242DCB60DA7B2FE ], #8E
[ 0xD3887FBFBB7314DF, 0xDDDCCCF0F720C342, 0xB2C4331C33C8C415, 0x1666010767F4785B, 0x8455B7C1FD5DE487, 0xA821C5EA181875F2 ], #8F
[ 0x7E289831418562F0, 0x2AD12E3042B185C3, 0x7C20D0D735A6AE96, 0xA68BEF98E22CBD41, 0xA1411D22F8D93243, 0xD813FB404F3D2F38 ], #90
[ 0xE13FC0A76F664294, 0x7E21C9D9F7FDDDCB, 0x161E68B366D6B1F8, 0x55BF957EB5743874, 0xB23213EF8364D766, 0x529BB98AF96643D4 ], #91
[ 0x036D7ADDAADB5C33, 0x0525835F802D032E, 0x7DF7D0D8D7A2BEF2, 0x84927644B27696B7, 0x215E21E4D1F9B5B9, 0x77743669C40EB7FD ], #92
[ 0xA9B3534BE8897784, 0x5BFD4283541A5090, 0x97AFFCCD121C9778, 0xC146C4C9637989C7, 0x0820E72FCBDA59C7, 0x5526E2F4A0AE4F4F ], #93
[ 0xA4739E20FD72BDC2, 0x6D6EE5A5C1A54CA6, 0x70A97A6FCB884E5C, 0x2B6108339E979C48, 0x93A63730D6BB23A7, 0x5B1DCEAB00045EE5 ], #94
[ 0x427C14E4F88C8BDB, 0x1D8630868E039BC2, 0x33DB40A251502D1B, 0xE043C9CCB45D2B3D, 0x292B67B6EE077B2D, 0x1C3A2FBDE24C742A ], #95
[ 0x3DED69F37016D86A, 0x9A947B13AC66D7C3, 0x822D8645DF4CB39C, 0x2BA20F98F19E10DA, 0x6703138D422AC4C4, 0x8D34D6138FA04A1D ], #96
[ 0x28E59C8B257D112C, 0x8747068CC5499FCF, 0xD6C16EB780F9191A, 0xB416151633F7AF08, 0xA230E00D6BA1A1C3, 0xFD066FB9965B83D2 ], #97
[ 0x70F4BC1B7F8FFC37, 0x38DC0331E56B0FDC, 0xA9AB7290AD2B0BBD, 0xB307973C3D0783C6, 0xBDC455F6CDCA111F, 0x23F0E08317B8F0DC ], #98
[ 0x0AEEC24E9285C50F, 0x3BCDA47833B61ACE, 0x839986F959EE0723, 0xC959034A8D7F5EB9, 0xD4AD7E05B05C4FB5, 0x6C37A3D39F7A0EC4 ], #99
[ 0x0227B7230FBF2D07, 0x28D7D2AD632BED47, 0x07BD8F8B5012EFD0, 0x48A0D43AE0403442, 0x9B8939207F1449A1, 0x351EAD01B9FDF219 ], #9A
[ 0xA7119D2E311CEF25, 0x1E532CD0C4ED0479, 0x2272F878D8D30A0B, 0x769C412CED9C4C42, 0x262FFBFA65CBDDF5, 0xDB73D86721EA368E ], #9B
[ 0x4BDBE90B3FBADCB2, 0x1324EC3A8D6FEA57, 0x6D9EFBE530850D00, 0x401A88AFF8A4C8F4, 0x655CB76B8A2E271C, 0x35505B6DBDE16F43 ], #9C
[ 0x6E15E57E23F57037, 0x4962737362C1FA26, 0xC962372D1829B80B, 0xA1FE6832EA4D6211, 0x6726E307F96E7763, 0x04C761081677505B ], #9D
[ 0x42E2FF3A8A6FC164, 0xFB85B2BC9D28B268, 0xC559CFF024533A28, 0x2EC83F3911DAB3CE, 0xAE0FC74A9D736A27, 0xDB9CDD048BAB4CCF ], #9E
[ 0xD79C52221D20E765, 0x499EDD73903CE704, 0x9B016D987DF48349, 0xFCFAB44AD12FC5C1, 0x811293F3B800FDF9, 0x511DC619CA53CEBE ], #9F
[ 0xA059EE78B826EDDF, 0x4673AF294D17C85A, 0x5E527D4E4DF282B5, 0xDB5B9A2693F95CE3, 0x6551D304FB54F296, 0xAB3EB70D65912FCC ], #A0
[ 0x7D0C4F67B6C78135, 0x390CAEA7DE304D37, 0x49E19FABC8D494FE, 0x1A9E1B6437A04516, 0x886CC4BDAB6AF35A, 0x0529217344F502FE ], #A1
[ 0x3CEDF34141B52CEE, 0x8133BA924753573F, 0xCB32BE22BC66025A, 0x0C480183DE403CB3, 0xBF5B84B427DFCF31, 0x7251428DB0232156 ], #A2
[ 0x86FCE831C58E25CB, 0x5CC43FFE45CBFC75, 0x33877CC042F199BE, 0x1212FA7F0CC22E1C, 0x448EAB4B7D1F9823, 0xA7B1363A9FA7599E ], #A3
[ 0x2D8C2FEDA0E5106D, 0x192E366838BBEB3F, 0x36226AA60ACEA0AF, 0xE7E1285DC1F3926A, 0x900371FA1883D9EC, 0xBAC33B1AF360EB66 ], #A4
[ 0xD4A2A11612BDE0E3, 0x82AB0DA614CB4CB8, 0x189A4D50AC01F4C6, 0xE36A5DA1D9F6A647, 0xE43120D6B16B11B6, 0x7D395F4236E75378 ], #A5
[ 0xC0C155CD47F3877F, 0x4B03BFE5C334CA71, 0x77710F1F4B844FF7, 0x3443BBAB720E8DC5, 0xF03F8868C5863406, 0x0FD60511C872EB50 ], #A6
[ 0x8C253DAAB5286306, 0x9AA438F54A6196AC, 0x181D08C723A22C5E, 0x633C49C88E3910A1, 0xC9F54A67992675B0, 0x1FDD98ACBD38D976 ], #A7
[ 0xA10893DA7575A9F7, 0x8F5F4A025AB2A018, 0xD80538F0336BFFC0, 0x0F9751D33889626F, 0x30383EB925BF911A, 0xE6149F68CE19CC60 ], #A8
[ 0xB9081DBAC6BE0598, 0x785DD9BC69C71492, 0x8B035A0CA56E172B, 0x8946783500724888, 0xAF1E57C958650569, 0xE1DE4E944FF22261 ], #A9
[ 0xEA5EDC4D2718C0D2, 0xCB1C5D4DA15A8AE4, 0xC6272382F8163015, 0x94A934E5057B54CE, 0x658E481A3D68D10D, 0xE8F24929E50A46A0 ], #AA
[ 0x7DF146281AF482CD, 0x014B68E726407B06, 0x6CE564938C70DDBC, 0x36DAD2DE72A5DAA2, 0x6D573BF69C0B2980, 0x684DAB14B4AA0329 ], #AB
[ 0x9C69DC064E738B5F, 0x83CC16BD5A1C36F5, 0xA99B365E6E141B12, 0x2748FA5AD0FACCE8, 0x26D073A047D99C49, 0xB005B182505B0C0C ], #AC
[ 0x15B6A2A20ED0FD1C, 0x9333AF729BD65A25, 0x22CC333293BD2C1B, 0xD724D949B15E8BE1, 0x69D0DB0512B97117, 0x85ACA8980DD7653C ], #AD
[ 0x230EC629D77BB3F2, 0x43115B991D297CB2, 0xA2F955792C53C76F, 0x48A76728EBE25BA7, 0x7CE662A405384400, 0xDDC06B7E6BF49D66 ], #AE
[ 0x20DDB9BD7644410B, 0x056391B1FA2E8C06, 0xCA4EDE51CF167C00, 0x46602B550536F870, 0x5040672597C21FF4, 0x0AF8EC6E8AFB844B ], #AF
[ 0x0023C5749251B883, 0x335A4F86D66B7E00, 0xAE353DED3EFACE8F, 0x3FC80526D67B35DE, 0x0D9078FBDA80BC53, 0x467900DFF3FE4C14 ], #B0
[ 0x0F9CB2BE6A448113, 0xE38D541B6A9A5829, 0x673953DAF354FC0E, 0x3C818A277F8569E9, 0x8D16EA77DB122A3B, 0xE40A860318B6EA84 ], #B1
[ 0x78CE11F42D7D5E50, 0x84F76DFF199C998D, 0x999B578E3AE935CB, 0xD9FD092C1BE63212, 0x31F33C63ACD316D8, 0x5AA08030B8D65C0C ], #B2
[ 0x0098DBE19CA84FE9, 0xE2426617D1142137, 0x63C3C4166A78E21B, 0x74B145353E03B0E4, 0xF43C0824EAE508C4, 0x58C1E6622528602A ], #B3
[ 0x9E27EBE6D1426A6F, 0x2A6A600A6B5FA342, 0x8FF7E2306BA90370, 0xDF83D91A683EDDDD, 0x29572442F0225388, 0xE9CC0F1B6437320A ], #B4
[ 0x054DF380E896064E, 0xFAB81A4AA3AD88A4, 0xF87426486CCA156F, 0xBB1B3C8237472960, 0x7EC0B87CF73F960A, 0x5C57D7E6470F7808 ], #B5
[ 0x5758E103AC614A1A, 0x766AEE86F81358DF, 0x203FBA51DC74396A, 0x78C93DF969C5721F, 0xE69E32E230196597, 0xE287C6CECD8AB95B ], #B6
[ 0x2A06A7C10C0DCC97, 0x99D5298268A6745F, 0xF2D818BB774858B3, 0xD52A820D4F64D886, 0x2F808EF87A263981, 0xBB91206E6347C676 ], #B7
[ 0x0847C6D71CE0C746, 0x86FD451B447C1E11, 0xC20623B0E2856FCC, 0x3ADDFA2D0398181E, 0x6736A0A06B336B46, 0xD1C70AEEB2B1257D ], #B8
[ 0x5633260D141A9776, 0xD530805F596CA3DB, 0x8CE33EF69437CE46, 0xF62D54E97E747088, 0xDF5C9318489B45EA, 0xA4AAD29F0BA850CA ], #B9
[ 0xBDBD7B16767F6D9F, 0xF7968427F1B7B6DD, 0x58C76599B35276EE, 0x286F4C7F6CADD791, 0x8188C0401742117B, 0xCEC4F1964266D163 ], #BA
[ 0x97E4E8A6B5135B24, 0x8A8BD785E5297977, 0x4545C1A0975BC5BB, 0x13FAE3BD9F59E37D, 0xAFD5627C0E91DE2B, 0xA223AC778474E1A9 ], #BB
[ 0xDE1BF1EAF86C6B3B, 0xA246A3ACD50035FE, 0x6F80179DD96A21CD, 0x3F8DB7CB17300D03, 0x497A798B5D94506C, 0xAD52DCC6F61AE841 ], #BC
[ 0xF4A4E1D08E1F440B, 0x5E27633CD56422E0, 0x1465C14F1DB41420, 0x9A939043988D37C2, 0xCBE65CFA245DB368, 0x6340AEDE28DDA855 ], #BD
[ 0x1F7AB65A3F892454, 0xD70AB4167EBEB5A1, 0x9B2631E824C2028D, 0xD5D97BDEE31519BC, 0xEA2DC77449E4058C, 0xEB204F2D6D2FBAFF ], #BE
[ 0x6537E69171A2665D, 0x3FD2F835435A3F23, 0xADD5DD3E622D6C8A, 0xC522CDD5E5E243F8, 0x5AEC27F3DBFDA8A2, 0x477A65ED570E1445 ], #BF
[ 0x3BA7CB01D32E9D63, 0x9E335734E7B5416B, 0x0ED96A84F94539F6, 0x45CEE2E46DF5A70D, 0xDE142EE1E9AFEC1C, 0x78D6121C4FDC72DD ], #C0
[ 0x7BB30AF653390B77, 0x2D394F2B7F8F7BB6, 0x0277A3C213AF3489, 0x7DF6E674DD56D084, 0x5643CD3073C42451, 0xFAB15F8BD1A1DC18 ], #C1
[ 0x42B453ABF5150D8B, 0x913F109C1188E18C, 0xC27BB7631FB43BF9, 0xEBDDE685EF108419, 0x76D67C87C56D33EA, 0x95EC73C0AF40F084 ], #C2
[ 0xBCE43D59A1F50BFB, 0xBA7027CA04D84600, 0xFB6FDB98A2BE644B, 0xD5DE777E993DED4A, 0xFCA39F1EDF710F3A, 0xA5E5893C858D8841 ], #C3
[ 0xC68AC776E6AEACFC, 0x538067C7866106EB, 0xD27B4A352F4EFDE3, 0x847DA2B3BF01E378, 0x3C79E3C136926D58, 0xF957BC8726AA1610 ], #C4
[ 0x95492C4203C7C612, 0x0DD60DB1EE8321FC, 0xE1D9EBA902F62B42, 0xEA2DBF7D0E37A4F2, 0xE11FB9098BF5DA48, 0xDBFE213F818EA338 ], #C5
[ 0x17CB21316D4756DD, 0xB88952498140146A, 0x648112F580844288, 0x4947ADC3F7D58F35, 0x651CCE28E26A5377, 0x0B3803DAF337F89B ], #C6
[ 0xBEAB16E2DCE6B6E3, 0x8F39ECC8E39172DF, 0x607CC9553FF29C0E, 0x4BFD15154F4F0BA7, 0xEE6230B6BD408CE4, 0x35B654110D164E99 ], #C7
[ 0xADDDFF1BD2C11CD4, 0x2A1A262CBA6E1AA0, 0x0BF2291D09475A46, 0x4C93A0ABADF4DE32, 0x73EE8E1327333E63, 0xF3AE2031F5D13B28 ], #C8
[ 0x246C7CABB2D9A55C, 0x50E9C7282C1EE0F6, 0x2FBDA09565A0D3D7, 0x196552679C04A4EB, 0x137C66DA29A6DD82, 0x08A76B6B4BDA56BF ], #C9
[ 0x7CA3C59BE3E28610, 0x6ADD75CF1F7AE248, 0x01747450737A6435, 0xA1F2259CB2B4923B, 0xE0C8F55E8ECE7210, 0xD7964398F350B69B ], #CA
[ 0xE045864ED1825101, 0xAC54969193E1A1C5, 0x23D85A934D0794C7, 0xB4FA88CB734A4213, 0x7C5CBFD6BDA3D5F9, 0x66607FE938748825 ], #CB
[ 0xBAF36FD2A180D481, 0xEAC440AC1B9598F7, 0x9AA24D80FFB7B06C, 0x79601F517358F163, 0xD1071831418BB63B, 0x819609A6AE7D3A03 ], #CC
[ 0x3E9152D8CDBAE551, 0x86AD793F203DD016, 0xBE3AEB778AD4A891, 0x2810254DD76B6618, 0x9B5DCDE36636C327, 0x0A8AAD65868BC58C ], #CD
[ 0x6D0672780D93152A, 0xEEE705247B828091, 0x9EBDB976F137463F, 0xA7DE3E73A2D0C1BF, 0xF871A00BA0046AC7, 0x484C96A803F23486 ], #CE
[ 0x0FC7BCDABB06BFFB, 0xF75C3FFB3D6309B3, 0xECA305D103109162, 0x373F503B204FFF61, 0xCE332C9F54963FA2, 0x9A4420A52242CDB4 ], #CF
[ 0xC71D481179D198C1, 0x505A2845CEE92569, 0xF339BFF6DD6755B5, 0x8BEAD52B8DE89245, 0x4B686E65920DCA2B, 0x99593FA43EE68A37 ], #D0
[ 0xD90A68D717E61501, 0x9BB920AEA19161A6, 0x2F3D6F96D90EB1E4, 0xDF15ECBA10513D7D, 0xE6E5D539B4F01831, 0xC7D17A7528FECE36 ], #D1
[ 0xA04FF0BEB4EBFBAF, 0xE5E90A5B3DDAA3CA, 0x8453542209F4A145, 0x80A6FFD72BB5A707, 0x14E0C4705A1ABF6A, 0xD699EC1FC18A677D ], #D2
[ 0x7021A124E3181575, 0xDC7AAE2817AD945F, 0x8BB5521E7F0D565A, 0x6671D3792F0805EE, 0xD3888EA394413A1A, 0xCE4D7E47B55BF9CC ], #D3
[ 0x22F440263CAADE68, 0xE77BB287772EAC7B, 0x29493775962A40E9, 0x1E06A27FA68CB91B, 0xDDEF02932ABDB9C7, 0x79F03B88DC175233 ], #D4
[ 0x65F6D517B53E2391, 0x97DB65A2F00B1C39, 0x1D77AE9B85AA4855, 0x19133B9B3E9B0771, 0x6376D9F11A7DB3D4, 0x949AD02F5AE16184 ], #D5
[ 0xFE4434CDE09D923B, 0x03B0FCFD713B7052, 0x2D713290D4A67238, 0x2B56946FF629EE96, 0x60A15D01B2B3C428, 0x0B1D5EAF793933A0 ], #D6
[ 0xBC40FCFB0E0D494B, 0xA31C4648C7B3D1DE, 0xF1113C219A07EC8D, 0x2378BEB1A5C2BD1C, 0x190CC3478070A194, 0x63DAB6E1CCF56329 ], #D7
[ 0x901B6B9E82BABF91, 0x872A234C45D61001, 0x6CA46A95C1CC6D6C, 0x22779315E0F02295, 0x60A59396346BE6AC, 0xFB67A503CB488846 ], #D8
[ 0x50D440F74C97660B, 0xE71ECABF64EDFE0C, 0x80201B895718CE22, 0xA05D89804D35D306, 0x8F700402A2B0D086, 0x326FCB334CA4DFC0 ], #D9
[ 0xBCFBD02EA005CDD5, 0xF0225A4675553115, 0x08E18B3692A7AF62, 0x05D34A820C8CED0A, 0x51A8D7CEC33E80EA, 0x0AC007503FAE879C ], #DA
[ 0xF43EEFB5C83C521A, 0xE5E9B05FC48841AC, 0x79C52C38BF85B5F9, 0x26CD0818AE3BF7A9, 0x4F385C32CA8F5F74, 0xF17B22107B954752 ], #DB
[ 0x1A48FC969198A4B0, 0xD9A78940BB0C4E1C, 0x42781D9BE60E7691, 0x87D1CAF3680F8A30, 0xD09FF193606AAF29, 0x4518DABC60048793 ], #DC
[ 0xF05D48134A56A034, 0x89A65EEB91DC69B9, 0x8FC7F43960E63C62, 0xFA1C6B9FF9415E92, 0x7E219D4E56347935, 0x2B6A48D6DE0AEF85 ], #DD
[ 0x1A7FF9C54B045FFD, 0x44A0A9562E9468B2, 0xF11425A22D1EBF92, 0x208D33120BD28E0E, 0xF2D74197AF80E162, 0xCEEDCA73DFE66C93 ], #DE
[ 0xD57190439D29C9A4, 0x44C007DC2B5EAF9D, 0xEF6DDF48A780CEDC, 0x61B205E4A96024B1, 0x1885B6CE84C3FE5D, 0xB8B56986B6E2CE21 ], #DF
[ 0xF36DACFA34237E99, 0xBE45EB5253BCFED0, 0x402C6946B8B21AC0, 0x2460A6FCE7E9CD67, 0xF89A6D5B162629FC, 0xF66CCEA374DB821E ], #E0
[ 0x16E06074DCC31A1D, 0xF172017AC3FA38C3, 0xBBC1CE4BB784ED60, 0xDA89A8BCE82AE671, 0xA6DACFFB8D26C0BB, 0x185181AE9609F6D6 ], #E1
[ 0xF110DBDD94D17661, 0xF59FBB4CBA69F393, 0x463B60FB3F3C5E00, 0x1C60B896FE8E78AC, 0x5EB3E26795DE5AB6, 0x997328D4654D6219 ], #E2
[ 0x21069118ABE24B61, 0x811CB8C48FCEFC6A, 0x483B032CFB56F902, 0xFB32E848198CC057, 0xA620815462A04F70, 0x900038D1894959E2 ], #E3
[ 0x5AD509789BFFECD0, 0xDDCD5E8325F69CA0, 0x154D8F1ACD9B8C82, 0xAC7DF75E94CE3CAF, 0x6D6554D1B38754BE, 0xB5DB64AF738486E7 ], #E4
[ 0x35A308A1AC9A43BF, 0x2647805AB3E6E492, 0x4BB74A616F61588F, 0xFA4602EE5BDBF54E, 0x3FDD62470A7174DB, 0x5795433CA808FAAC ], #E5
[ 0x51A094B8774CA605, 0x5F07974C74EEF225, 0x022AFEF7AD81A953, 0x0967C44BBA336FD6, 0x8AA327918AECBA3D, 0xF70B8436573C3F0A ], #E6
[ 0xCF374F83420766C3, 0x71F31901A13EF07C, 0x63AD56C7DEF9DC0F, 0x9E5BB5E859F5A231, 0xD0BF453BB9893E4C, 0xA1E14B66C2719760 ], #E7
[ 0xB41861CC73FD3E48, 0x461D79A138B04BE1, 0x4010D37D37FBA817, 0x7D9622AA693225A4, 0x2204454B8126799A, 0x33A5D487DCCD6EB6 ], #E8
[ 0xD291D0317A053320, 0xE27678F1E50D1F76, 0x9A3D663A63159FC7, 0xAD7B4D3F67BAB452, 0x269CC05E2B33CE1C, 0x0FB8261CD734BCC3 ], #E9
[ 0xF3D0546D3D4A25EE, 0xB42874AD28C9B7F2, 0x73EC788B29962D28, 0x4AE73A48132B8553, 0x756C99D7A0910B66, 0xECA7E2C2712D555C ], #EA
[ 0x559FA5BF24911FDD, 0xA1DDF5DE3770554B, 0xC7C3FD139366B946, 0x6E7ECC0C881D2BA4, 0x14E76D6A27E54B87, 0x7352D5FBC4FAB878 ], #EB
[ 0xF19A622BED8DAC0A, 0x35548E5D7EFC5A2E, 0xCAC84974B4F057B2, 0xAB317ED03D0335AE, 0x710FC138F2C51738, 0x9C90CC495A403416 ], #EC
[ 0x9FA7DEB936F10461, 0xA1529B0B58462F9D, 0x9F109111C8B9EC65, 0x23A3EB28444E33EA, 0x554084CA75118937, 0x599D58A7C946EAC2 ], #ED
[ 0x6EC3AABB7856AC4E, 0x980E6907C1CBCCAF, 0x1F8557ADC700CBF5, 0x7DCB1CE0AF48D9F4, 0x7FB3DADF8199AB8A, 0xE6B36DB8FADBF312 ], #EE
[ 0xC00F0D3F7A101660, 0x605B94B12DB6C697, 0x79944F7BA2B65F38, 0x40858ADEDD47E2BC, 0x1E044BDB0E9FB02B, 0x86C79D01A3109539 ], #EF
[ 0x9731893D5B98482A, 0xFB8DE267F9790326, 0x8780F407143A505D, 0xA41CAEFCCCD3A8E3, 0xA042F0B3D7B7A7FE, 0x3E3151FEBB19A1AC ], #F0
[ 0xE7EDF679003A6950, 0xBAFC97D4A8C6AB12, 0x13C096B49C79559A, 0xC3052501434B5019, 0x1280FB23E7ADFB09, 0x1959905D31BD2FC0 ], #F1
[ 0x575C0C46FCFCC65B, 0xFE625E873F34B419, 0x1696FDCC7F51B8A3, 0xC79C56F30E5AE7C0, 0x14E3461CD27FAD15, 0x1B7BCCB9CB472859 ], #F2
[ 0x3806FE58E5CC8F16, 0xF8244ED76734C1BF, 0x4E04940E0F5DDB56, 0x5BD0AFDDC4158B7B, 0xA4C6BA949911C5C9, 0xFF6E2AC155AE9726 ], #F3
[ 0x49C7C844B8114144, 0xB450E41BCA35CB00, 0x302450EC67BEF97C, 0xA8662049DB1E0D8B, 0xDA69C022528EB8FA, 0x6ABBF16585C1A2F7 ], #F4
[ 0x37BB420DF67F044E, 0xDCC0E9F3E2EF07B3, 0x4D10088618777841, 0x0492E5379305DAAE, 0x3DA4791C37E4128F, 0x80688445CBA4EA17 ], #F5
[ 0x51398A7CE4CF8D9D, 0x49A5FCD891A69CA5, 0x3D72A60EC2392DA5, 0x0E8296B879AB5539, 0x6BCB00AF2EDC0BDE, 0xBEB93848E54B3E90 ], #F6
[ 0x7AD7C52A18922E19, 0x29292C57C4F5B8F5, 0xF0CF1F98A577C10B, 0x072B9F293BB660CD, 0x09B8604F5575B6FB, 0xDECB396A81B9FCDB ], #F7
[ 0x254AD7ADB4C220DE, 0x6C62E20F95A0070D, 0xADEB89F339309BD8, 0xA2F685CC178B289F, 0x9343905B5DEE95A5, 0xE0C30F34A2977C86 ], #F8
[ 0x669CD51AF7CFBFAA, 0xE3E0806F6880271D, 0x6934C259E098BF90, 0x5DFEEAF0FBCA7249, 0x89F74B948B4118B6, 0x53640AEAFB6807C3 ], #F9
[ 0xDD3BACDCC04BE120, 0x6D4949BD64198E51, 0x31FDB39666598A74, 0xBBBC6DE9C0C15A81, 0xF27F201C61C06279, 0x2738AFE3E84E5CDD ], #FA
[ 0xCDD71FD35A6411DE, 0x3CC012793E87523F, 0xB0CFF8720FCA36F3, 0x93E85FE07300F012, 0xE894A085263F090B, 0x2DF60A01DAFA90EC ], #FB
[ 0x9DA50DB1EEB4FADD, 0xE524E49C9974799A, 0xDE09FFF26A24CBB9, 0xAF9D71E9F3ACE7CD, 0xEB62B1A62566EC9D, 0x06D02AB1217D3553 ], #FC
[ 0xDD31E6391AE03522, 0x93ACD1065B35E915, 0xF4EB56CC03E79218, 0x0717815C850C97F1, 0xBF4F6A8AC0540A6F, 0xFCF8AE5DE9507FF0 ], #FD
[ 0xAB45B413DC50B207, 0x40B417369551D8D5, 0xCA32286A108E7210, 0x03225E54D8D093AF, 0x4B6CA5591EA576E9, 0x4E12AB774DC4E062 ], #FE
[ 0xD9F4F850DF6CB96C, 0x8ABAD81B1667335D, 0xCB4079CFE79C72E5, 0xE5542F763E316996, 0x303E4B79B9D397C4, 0xE46933038B945111 ], #FF
[ 0x75B15CC53B0D2502, 0xDA1BCA6BA0524358, 0x9EDA977556C06B7E, 0x6C57727ECF0A1325, 0xDC613D5A78E5C3F8, 0xCE062D94A3B4945A ] #ZZ
]
cdef u64[5][6] _NUHASH_RND = [
[ 0x6A09E667F3BCC908, 0xB2FB1366EA957D3E, 0x3ADEC17512775099, 0xDA2F590B0667322A, 0x95F9060875714587, 0x5163FCDFB907B672 ], #R1
[ 0x1EE950BC8738F694, 0xF0090E6C7BF44ED1, 0xA4405D0E855E3E9C, 0xA60B38C0237866F7, 0x956379222D108B14, 0x8C1578E45EF89C67 ], #R2
[ 0x8DAB5147176FD3B9, 0x9654C68663E7909B, 0xEA5E241F06DCB05D, 0xD549411320819495, 0x0272956DB1FA1DFB, 0xE9A74059D7927C18 ], #R3
[ 0x84C9B579AA516CA3, 0x719E6836DF046D8E, 0x0209B803FC646A5E, 0x6654BD3EF7B43D7F, 0xED437C7F9444260F, 0xBD40C483EF550385 ], #R4
[ 0x83F97BBD45EFB866, 0x3107145D5FEBE765, 0xA49E94EC7F597105, 0xFBFC2E1FA763EF01, 0xF3599C82F2FE500B, 0x848CF0BD252AE046 ] #R5
]
cdef u8[256] _NUHASH_SBX = [
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
]
cdef u8[256] _NUHASH_FIN = [
0xB4, 0x98, 0x0C, 0x84, 0x24, 0xF3, 0x27, 0x8F, 0xA6, 0x5E, 0xF0, 0x65, 0x86, 0xBC, 0x09, 0x92,
0x75, 0x21, 0xB9, 0x95, 0x66, 0x8A, 0x2F, 0x13, 0xB5, 0xB7, 0x6B, 0x33, 0x2A, 0xBF, 0xF7, 0x0F,
0x0A, 0xE7, 0x16, 0x30, 0x77, 0x61, 0x48, 0x90, 0xDF, 0xAF, 0x72, 0x79, 0xF6, 0xA5, 0x58, 0xD1,
0xF2, 0x40, 0x9F, 0x41, 0xE8, 0x03, 0xA1, 0x05, 0xC5, 0x35, 0xC7, 0x97, 0x54, 0x7B, 0xB3, 0xF5,
0xB8, 0xA8, 0xD8, 0x68, 0x51, 0xAD, 0xE3, 0xC2, 0x5D, 0xCF, 0xEA, 0x89, 0x37, 0xF1, 0x55, 0x60,
0xA4, 0x26, 0xAC, 0x32, 0x0E, 0xD2, 0x85, 0x6F, 0xC8, 0xDC, 0x36, 0x6D, 0xA3, 0x22, 0x5A, 0xC9,
0x5C, 0x91, 0x1B, 0x5B, 0xE9, 0x78, 0xD7, 0x44, 0xEB, 0x1A, 0xC0, 0xCA, 0x94, 0x53, 0xC4, 0x11,
0x12, 0xCC, 0xFF, 0x88, 0x0D, 0x4E, 0xB2, 0xB1, 0x4A, 0x3A, 0xE1, 0x2E, 0x0B, 0x4C, 0x5F, 0x06,
0x81, 0x31, 0xD9, 0x3D, 0xFD, 0x43, 0x67, 0x62, 0x00, 0x9C, 0x50, 0xCE, 0x6E, 0x15, 0x82, 0x29,
0x96, 0xDA, 0x87, 0xEF, 0x6C, 0xC1, 0x8B, 0x07, 0x8E, 0x17, 0xEC, 0x9A, 0xBA, 0x46, 0x04, 0x73,
0x39, 0xE4, 0x63, 0xBE, 0x64, 0x47, 0xE6, 0x3F, 0x25, 0x52, 0x59, 0xA7, 0x42, 0x38, 0x99, 0x01,
0xE5, 0x1D, 0x28, 0x7A, 0xB0, 0x7C, 0x9D, 0x56, 0xE2, 0xD6, 0xA0, 0xF4, 0x1E, 0xE0, 0xD3, 0x83,
0x6A, 0xBB, 0x18, 0x20, 0xAE, 0x57, 0xAA, 0x8D, 0x71, 0x1F, 0x34, 0x4D, 0x2D, 0x3C, 0x2B, 0xF8,
0x10, 0x7E, 0xCB, 0xFB, 0x49, 0xA2, 0x45, 0x7F, 0x3E, 0xBD, 0xC3, 0xFC, 0x14, 0x74, 0x23, 0x4F,
0x7D, 0x69, 0x93, 0x19, 0xD0, 0x1C, 0x08, 0xF9, 0xDD, 0xC6, 0x2C, 0x9E, 0xA9, 0x4B, 0xFE, 0xED,
0x76, 0xDB, 0xAB, 0xD4, 0x80, 0xCD, 0xB6, 0x8C, 0xDE, 0x70, 0x9B, 0xD5, 0xFA, 0xEE, 0x02, 0x3B
]
# ------------------------------------------------------------------------ */
# Mix functions
# ------------------------------------------------------------------------ */
cdef inline u64 _mix_function1(u64 key):
key = (key ^ (key >> 31)) * <u64>0x7FB5D329728EA185
key = (key ^ (key >> 27)) * <u64>0x81DADEF4BC2DD44D
return <u64>(key ^ (key >> 33))
cdef inline u64 _mix_function2(u64 key):
key = (key ^ (key >> 31)) * <u64>0x99BCF6822B23CA35
key = (key ^ (key >> 30)) * <u64>0x14020A57ACCED8B7
return <u64>(key ^ (key >> 33))
cdef inline u64 _mix_function3(u64 key):
key = (key ^ (key >> 31)) * <u64>0x69B0BC90BD9A8C49
key = (key ^ (key >> 27)) * <u64>0x3D5E661A2A77868D
return <u64>(key ^ (key >> 30))
cdef inline u64 _mix_function4(u64 key):
key = (key ^ (key >> 30)) * <u64>0x16A6AC37883AF045
key = (key ^ (key >> 26)) * <u64>0xCC9C31A4274686A5
return <u64>(key ^ (key >> 32))
cdef inline u64 _mix_function5(u64 key):
key = (key ^ (key >> 30)) * <u64>0xBF58476D1CE4E5B9
key = (key ^ (key >> 27)) * <u64>0x94D049BB133111EB
return <u64>(key ^ (key >> 31))
cdef inline u64 _mix_function6(u64 key):
key = (key ^ (key >> 30)) * <u64>0x4BE98134A5976FD3
key = (key ^ (key >> 29)) * <u64>0x3BC0993A5AD19A13
return <u64>(key ^ (key >> 31))
# ------------------------------------------------------------------------
# Substitute bytes
# ------------------------------------------------------------------------
cdef inline void _substitute_bytes(u64 *const hash):
cdef u8 *byte_ptr = <u8*>hash
for i in range(48):
byte_ptr[i] = _NUHASH_SBX[byte_ptr[i]]
# ------------------------------------------------------------------------
# Update function
# ------------------------------------------------------------------------
cdef inline void _update(u64 *const hash, const size_t index):
cdef u64 *row_addr = _NUHASH_XOR[index]
cdef u64 *rnd_keys
for rnd_keys in _NUHASH_RND:
initial = hash[0]
hash[0] = _mix_function1(<u64>(<u64>(hash[0] << 32) | <u64>(hash[1] >> 32)) ^ row_addr[0] ^ rnd_keys[0])
hash[1] = _mix_function2(<u64>(<u64>(hash[1] << 32) | <u64>(hash[2] >> 32)) ^ row_addr[1] ^ rnd_keys[1])
hash[2] = _mix_function3(<u64>(<u64>(hash[2] << 32) | <u64>(hash[3] >> 32)) ^ row_addr[2] ^ rnd_keys[2])
hash[3] = _mix_function4(<u64>(<u64>(hash[3] << 32) | <u64>(hash[4] >> 32)) ^ row_addr[3] ^ rnd_keys[3])
hash[4] = _mix_function5(<u64>(<u64>(hash[4] << 32) | <u64>(hash[5] >> 32)) ^ row_addr[4] ^ rnd_keys[4])
hash[5] = _mix_function6(<u64>(<u64>(hash[5] << 32) | <u64>(initial >> 32)) ^ row_addr[5] ^ rnd_keys[5])
_substitute_bytes(hash)
# ------------------------------------------------------------------------
# Utilities
# ------------------------------------------------------------------------
cdef inline bytes _store_words(const u64 *const hash):
result = b''
for i in range(6):
result += hash[i].to_bytes(8, byteorder='big')
return result
# ------------------------------------------------------------------------
# Stream API
# ------------------------------------------------------------------------
cdef class NuHash:
_hash: cython.ulonglong[6]
_finished: cython.bint
def __init__(self):
self._hash = _NUHASH_INI[:]
self._finished = False
cpdef NuHash reset(self):
self._hash[:] = _NUHASH_INI
self._finished = False
return self
cpdef NuHash update(self, src):
if not isinstance(src, (bytes, str)):
raise TypeError('input data must be of type bytes or string!')
if isinstance(src, str):
src = src.encode(encoding='UTF-8', errors='strict')
self._check_state()
cdef u8 *byte_ptr = <u8*>src
for i in range(len(src)):
_update(self._hash, byte_ptr[i])
return self
cpdef bytes do_final(self):
self._check_state(True)
_update(self._hash, 0x100)
for i in range(0x100):
_update(self._hash, _NUHASH_FIN[i])
return _store_words(self._hash)
cpdef void _check_state(self, finished = False):
if self._finished:
raise RuntimeError('the hash computation is already finished!')
if finished:
self._finished = True
# ------------------------------------------------------------------------
# Simple API
# ------------------------------------------------------------------------
cpdef bytes compute(cls, src):
return cls().update(src).do_final()
# ------------------------------------------------------------------------
# Version info
# ------------------------------------------------------------------------
cpdef (u16, u16, u16) version():
return (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
cpdef size_t digest_bytes():
return NUHASH_BYTES

View File

@ -0,0 +1,2 @@
[build_ext]
inplace=1

13
libnuhash/python/setup.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from setuptools import setup
try:
from Cython.Build import cythonize
except ImportError:
sys.exit("Cython is required!")
setup(
name='NuHash',
ext_modules=cythonize("nuhash.pyx"),
zip_safe=False
)

View File

@ -0,0 +1,103 @@
#!/usr/bin/env python3
"""NuHash, by LoRd_MuldeR <MuldeR2@GMX.de>
This work has been released under the CC0 1.0 Universal license!"""
from nuhash import NuHash
import ctypes
import sys
import unittest
# ========================================================================
# TEST FUNCTIONS
# ========================================================================
class NuHashTests(unittest.TestCase):
@staticmethod
def set_term_title(text):
if sys.platform.lower().startswith(('win32', 'msys', 'cygwin')):
ctypes.windll.kernel32.SetConsoleTitleW(text)
elif sys.platform.lower().startswith(('linux', 'freebsd', 'openbsd', 'netbsd', 'darwin', 'aix')):
sys.stdout.write("\33]0;{}\a".format(text))
sys.stdout.flush()
def run_testcase(self, iterations, expected, input):
if isinstance(input, str):
input = input.encode(encoding='UTF-8', errors='strict')
nuhash = NuHash()
for _iter in range(iterations):
nuhash.update(input)
if _iter & 0xFFFF == 0:
self.set_term_title("{:.2f}%".format(_iter / iterations * 100.0))
digest = nuhash.do_final().hex()
self.set_term_title("100%")
print("{} - ".format(digest), end = '', sep = '', flush = True)
self.assertEqual(expected.lower(), digest.lower())
# ------------------------------------------------------------------------
# Test cases
# ------------------------------------------------------------------------
def test_function1(self):
self.run_testcase(
0x0000001,
"d7964fe1bec2b5ecf21ecc88c86ce4f1e89fb1ef3669d52e34eb049d7fd6c42d4b2bbeeeb70d12c3fcaf43dd2229abc9",
"")
def test_function2(self):
self.run_testcase(
0x0000001,
"b3f13f534034ae8d645d410e8828673761fe2d697218879f9ea528d976ba2e15a3f7485105e612b9a46cb3988635a70f",
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
def test_function3(self):
self.run_testcase(
0x0000001,
"63703476f4ffce4a8c758d0d3b91a857b9a2e3433ee864f931ba328fa7247b1b0ac9c2e0279243b83051aafac6a7e710",
"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu")
def test_function4(self):
self.run_testcase(
0x00F4240,
"c6808aeb911c8837cee2e6867e589ab28526a8153494cf35a40c4bd6e20312da33cac4a390cd3b51a2eb4226e60b53e1",
"a")
def test_function5(self):
self.run_testcase(
0x1000000,
"bcca6bc8d113dd3fc171d743ac7ad2d3e63163ea7107d3c78517cf5b53ee0b2f4a0fe079e6a74df350c667b7cfe3cf09",
"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno")
def test_function6(self):
self.run_testcase(
0x1000000,
"56770e133b9eb4205f11824ad7280f5c31bc04dd333d1844b3589ab8b94ab95dc09b77be9a8128d7f155fa73de617597",
"g4tB,=[TU%/|8lv_c5Y?F9Sqs1PnV#bNO6DW\\0em~p<ifJhM(2&Qo}`!-*:jrZ{KGX]$zkuLd+)xwC^.\"@AIHR;y'a>3E7")
def test_function7(self):
self.run_testcase(
0x1000000,
"9a8579bb88112b2f3285781a61348d7b04a5632fec12a73a7e0e367a556794a24a32ca7bb14da68eaed83e99c2f8f4c0",
b'\xa4,U\xa5\xb0^\xd83\xf3\x18\xfb\xa7 \xc74\xd7\x1d-F\x8d\xca\x8a\xe7\xfch[T\xda\xf9\xc3vb\xa9=9\xbf\x17\xb7\xb2\x8c\x10\xa2\x1f\xe3tjJlz\x92\xd1R\xea\x88\xbak\xd6d\x96\x9e\xe6LGB\xc5Q\xf2P\xf4{O\xe9\x87m\x94K#\xf0E\x1a\x9a\xe4\x91\x0f;\xb4q\x82\x99\xc9I\xe5\xbe(\x93\x98*\xd9seX\xc0\x83H\x8f\x03\x14@\x1b$\x1e\xa6?\xf7g\xab7\x06\xac\xf6f\xb6\xdd\x1c\n5\x9fV\x15\xec\xf1+|W]\x02\xed\xa8c\x16u\xdc\x9b\\}\r_\xfd\x05\xa0n\x90\x95\x85\xd2\x13a\x08\xa3\x01\xc8\xd3\x84\xaa\t\xf5po\xde\xb9\x04\xb5\xdb0\xbc\x07\x8e\xfe\x89`&NY\xcb6\x86\x11r\xe2\xc6\xaf:\x8b\x7f\xfaA8\xdf\xee/2\xa1\'i1)C\xc4\x9cw!D\xb8y\xd0\xad\x97\xe0\xe1\x0e\x19."\xbd\x80\xe8\xb1\xf8M>\xc2~\x0c\xb3\x81\x12\xcc\xc1S\xcfx\xce<\xd5Z\xbb\x9d\xeb\xef\xcd\xff\x0b%\xae\xd4')
def test_function8(self):
self.run_testcase(
0x1000000,
"fbf4444b0329f508bfc6cf44920b311a718e5f4c4c1af978e78223ec3579365ff5d15c16bb5a33d69cb36f3d40564757",
b'\xb5\xc8\x9b\xd1\xbaf)\x19\xd20\xed&[\xc4\x91M\x14\xf7\x165Zi\xfe\x99\xa5I\xf1\x94+\xbc\xdcL\xddO\xca\x1b\x88\x9c\xa9\xf6s/\xfd?@9\x13\xda\xb3q\xf4\xde\x7f\x02=dxz\x17\n\x93\xdf\xeb\x9f\x07\x04y\x8c\x98\xb8(\x80\xad\x1f\xf2\x96k\xbdE\xd9\xfa,V\xce\xf0\x87#"\xea\xc5\'\xd3c\xaf$\xc7\xb7\x06\xe4u\x83{\xbf.\xa4\xef\xf5\x12]`\x95\xa7S\x11t\xb4\xa0\x9e\xe3\xae\xbbUrY\xa6\x9d\xd5\x89m\x8fJ\x0c\x1d\xcd*\xfb\xee\xd7\xc3\xf3%b\x8e\xb0\xb2\xc28<joN;\x08\xd4\x866\x18\\\xe0\x1e\x81w\xf8h\xdbXT\xff\x97~a\xc0Q\xc9l\xe5\x82\xbe\xcf2C\x01:^PG\xa14\xcc\rp\xac\xc6D\x9a>\x10\x0e\xec\x03\xe2n\xaa\xfc}71K\xe6\xb6\xc1\x15\x8b\x05\x85\x8ag\xf9\xab\x8d\xe1\xa2H\x1c\xcbRev\x0f\x1a!\xa8\xa3BA\x90\x92\xd0\x84\t-3_\xd8|\xb1\xb9W\xe8\xd6\x0b \xe7F\xe9')
# ========================================================================
# MAIN()
# ========================================================================
if __name__ == '__main__':
if sys.hexversion < 0x3000000:
print("Python version 3.0 or newer is required !!!")
sys.exit(1)
test_suite = unittest.TestSuite()
for name in filter(lambda s: s.startswith('test_function'), dir(NuHashTests)):
test_suite.addTest(NuHashTests(name))
runner = unittest.TextTestRunner(verbosity = 2)
runner.run(test_suite)