ff(dZddlZddlmZddlmZddlmZddl m Z m Z Gddej Z d Zd Zd ZGd d ej ZifdZedkrdZejddSdS)z.Self-test suite for Crypto.Hash.KangarooTwelveN) unhexlify)list_test_cases)KangarooTwelve)bbchrc2eZdZdZdZdZdZdZdZdS)KangarooTwelveTestc|tjdd|tjdd|tjdddS)Nr s is) assertEqualK12_length_encode)selfs /builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/SelfTest/Hash/test_KangarooTwelve.pytest_length_encodez%KangarooTwelveTest.test_length_encode(sl +A..888 +B//=== +E224GHHHHHctj}tjtd}tjtd}||d|d|d||d|dtj}|d}tjtd}tjtd}|||d|||dtjtd}tjtdtd}tjtdtd}||d|d|d||d|ddS)N90data customfoo)rr)rnewrupdateassertNotEqualreadr )rxof1xof2xof3refs rtest_new_positivez$KangarooTwelveTest.test_new_positive-swyywAdGG$$$wyy$(( DIIbMM499R==999 "  2 " 666wyyiimmwaee$$$wahh''' diimm,,, C2///wahh'''wahhQtWW555wahh'''..qww77 DIIbMM499R==999 "  2 " 66666rctddztddzg}tj}||d|d|d}tj}||d|dz||d|dS)Nri,r)rrrrr r )rpieceshdigests r test_updatezKangarooTwelveTest.test_updateGsr((S.$r((S.1 GII ""6!9--- GII VAY&''' V,,,,,rcntj}|t|jddS)Nstring)rr assertRaises TypeErrorr)rr+s rtest_update_negativez'KangarooTwelveTest.test_update_negativePs- GII )QXy99999rc tj}|d}|t |t t d|t|ddS)NZr,) rrr assertTrue isinstancetyperr len)rr+r,s r test_digestzKangarooTwelveTest.test_digestTsj GII  64( +<+<==>>> Vb)))))rctj}|td|d|t |jtddS)Nrrrrr4ttt)rrrrr r0r1)rmacs rtest_update_after_readz)KangarooTwelveTest.test_update_after_read\sZgii 1V99   )SZ5:::::rN) __name__ __module__ __qualname__rr%r-r2r9r>rrr r &sqIII 7774---:::***;;;;;rr c|dddddd}t|S)N r  )replacer)txtcleans rtxt2binrJcsC KKR ( (r 2 2 : :4 D DE U  rc&t|}ddtddD}td|dz dD] }||||dz< |dz}|r|dzdz}|d|||d<t||ksJ|S)Nrc,g|]}t|SrB)r).0xs r zptn..js888AQ888rr) bytearrayjoinranger8)nrespatternbaseremains rptnrYhs A,,Chh88q$88899GaT4(((( 'D  XF &T T!WfW%DEE s88q==== Jrc#jKtdt||D]}||||zVdS)Nr)rSr8)sourcesizeis rchunkedr^usM 1c&kk4 ( (QqvXrcneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdS)KangarooTwelveTVcd}t|}tjd}|||dS)Nzl1A C2 D4 50 FC 3B 42 05 D1 9D A7 BF CA 1B 37 51 3C 08 03 57 7A C7 16 7F 06 FE 2C E1 F0 EF 39 E5 rJrrr r rtvbtvrUs r test_zero_1zKangarooTwelveTV.test_zero_1}sJ@bkkgiinnR   c"""""rcd}t|}tjd}|||dS)Nz1A C2 D4 50 FC 3B 42 05 D1 9D A7 BF CA 1B 37 51 3C 08 03 57 7A C7 16 7F 06 FE 2C E1 F0 EF 39 E5 42 69 C0 56 B8 C8 2E 48 27 60 38 B6 D2 92 96 6C C0 7A 3D 46 45 27 2E 31 FF 38 50 81 39 EB 0A 71@rcrds r test_zero_2zKangarooTwelveTV.test_zero_2sI; bkkgiinnR   c"""""rcd}t|}tjd}||dd|dS)NzgE8 DC 56 36 42 F7 22 8C 84 68 4C 89 84 05 D3 A8 34 79 91 58 C0 79 B1 28 80 27 7A 1D 28 E2 FF 6Di0'ircrds r test_zero_3zKangarooTwelveTV.test_zero_3sQ;bkkgiinnU## STTC(((((rcd}t|}tjtdd}|||dS)Nzg2B DA 92 45 0E 8B 14 7F 8A 7C B6 29 E7 84 A0 58 EF CA 7C F7 D8 21 8E 02 D3 45 DF AA 65 24 4A 1Fr)rrbrJrrrYr r rds r test_ptn_1zKangarooTwelveTV.test_ptn_1sX;bkkg3q66"""''++ c"""""rcd}t|}tjtdd}|||dS)Nzg6B F7 5F A2 23 91 98 DB 47 72 E3 64 78 F8 E1 9B 0F 37 12 05 F6 A9 A9 3A 27 3F 51 DF 37 12 28 88rrbrnrds r test_ptn_17zKangarooTwelveTV.test_ptn_17sX;bkkg3r77###((,, c"""""rcd}t|}tjtdd}|||dS)Nzg0C 31 5E BC DE DB F6 14 26 DE 7D CF 8F B7 25 D1 E7 46 75 D7 F5 32 7A 50 67 F3 67 B1 08 EC B6 7Ci!rrbrnrds r test_ptn_17_2zKangarooTwelveTV.test_ptn_17_2X;bkkg3u::&&&++B// c"""""rcd}t|}tjtdd}|||dS)NzgCB 55 2E 2E C7 7D 99 10 70 1D 57 8B 45 7D DF 77 2C 12 E3 22 E4 EE 7F E4 17 F9 2C 75 8F 0D 59 D0i1rrbrnrds r test_ptn_17_3zKangarooTwelveTV.test_ptn_17_3rurcbd}t|}td}tj|d}|||tj}|D]$}|t|%|d}|||dD]h}tj}t||D]}|||d}|||idS)Nzg87 01 04 5E 22 20 53 45 FF 4D DA 05 55 5C BB 5C 3A F1 A7 71 C2 B8 9B AE F3 7D B4 3D 99 98 B9 FEiAFrrb) rq) rJrYrrr r rrr^)rrerfrrUk12rN chunk_sizes r test_ptn_17_4zKangarooTwelveTV.test_ptn_17_4s-;bkk5zzg4   %%b)) c"""gii  A JJtAww    hhrll c"""/ ' 'J'))CT:..   1 ((2,,C   S# & & & &  ' 'rcd}t|}td}tj|d}|||tj}t |dD]}|||d}|||dS)Nzg84 4D 61 09 33 B1 B9 96 3C BD EB 5A E3 B6 B0 5C C7 CB D6 7C EE DF 88 3E B6 78 A0 A8 E0 37 16 82iQrrb )rJrYrrr r r^r)rrerfrrUr}chunks r test_ptn_17_5zKangarooTwelveTV.test_ptn_17_5s;bkk5zzg4   %%b)) c"""giiT4((  E JJu    hhrll c"""""rcd}t|}td}tj|d}|||dS)Nzg3C 39 07 82 A8 A4 E8 9F A6 36 7F 72 FE AA F1 32 55 C8 D9 58 78 48 1D 3C D8 CE 85 F5 8E 88 0A F8iaOprrbrJrYrrr r )rrerfrrUs r test_ptn_17_6zKangarooTwelveTV.test_ptn_17_6s_;bkk5zzg4   %%b)) c"""""rcd}t|}td}tj|d}|||dS)NzgFA B6 58 DB 63 E9 4A 24 61 88 BF 7A F6 9A 13 30 45 F4 6E E9 84 C5 6E 3C 33 28 CA AF 1A A1 A5 83r)rrbrrrerfrrUs r test_ptn_c_1zKangarooTwelveTV.test_ptn_c_1s_;bkkQgV$$$))"-- c"""""rcd}t|}td}tjd|d}|||dS)NzgD8 48 C5 06 8C ED 73 6F 44 62 15 9B 98 67 FD 4C 20 B8 08 AC C3 D5 BC 48 E0 B0 6B A0 A3 76 2E C4)rrrbrrs r test_ptn_c_41zKangarooTwelveTV.test_ptn_c_41sa;bkkRg7622277;; c"""""rcd}t|}td}tjd|d}|||dS)NzgC3 89 E5 00 9A E5 71 20 85 4C 2E 8C 64 67 0A C0 13 58 CF 4C 1B AF 89 44 7A 72 42 34 DC 7C ED 74isrrbrrs rtest_ptn_c_41_2z KangarooTwelveTV.test_ptn_c_41_2a;bkkUg;v666;;B?? c"""""rcd}t|}td}tjd|d}|||dS)Nzg75 D2 F8 6A 2E 64 45 66 72 6B 4F BC FC 56 57 B9 DB CF 07 0C 7B 0D CA 06 45 0A B2 91 D7 44 3B CFi9 srrbrrs rtest_ptn_c_41_3z KangarooTwelveTV.test_ptn_c_41_3rrcd}t|}tjdtdd}|||dS)N@fd608f91d81904a9916e78a18f65c157a78d63f93d8f6367db0524526a5ea2bbrdrrbrnrds rtest_1zKangarooTwelveTV.test_1sV Obkkg3s3xx00055b99 c"""""rc0d}d}d}d}d}tjddzd d }||t |tjdd zd d }||t |tjdd zd d }||t |tjdd zd d }||t |tjddzd d }||t |dS)N@5a4ec9a649f81916d4ce1553492962f7868abf8dd1ceb2f0cb3682ea95cda6a6@441688fe4fe4ae9425eb3105eb445eb2b3a6f67b66eff8e74ebfbc49371f6d4c@17269a57759af0214c84a0fd9bc851f4d95f80554cfed4e7da8a6ee1ff080131@33826990c09dc712ba7224f0d9be319e2720de95a4c1afbd2211507dae1c703a@9f4d3aba908ddc096e4d3a71da954f917b9752f05052b9d26d916a6fbc75bf3eAiBrrbiiir)rrr r rJ)rtv4tv3tv2tv1tv0rUs rtest_2zKangarooTwelveTV.test_2#spPPPPPg48,T:::??CC gcll+++g48,T:::??CC gcll+++g48,T:::??CC gcll+++g48,T:::??CC gcll+++g48,T:::??CC gcll+++++rN)r?r@rArgrjrlrorrrtrwrrrrrrrrrrBrrr`r`{s######)))############'''4###$ # # # # # # # # # # # # # # ####,,,,,rr`cfg}|ttz }|ttz }|SN)rr r`)configtestss r get_testsr:s2 E _/ 0 00E _- . ..E Lr__main__cBtjtSr)unittest TestSuiterrBrrsuiterBs!)++...rr) defaultTest)__doc__rbinasciirCrypto.SelfTest.st_commonr Crypto.HashrrCrypto.Util.py3compatrrTestCaser rJrYr^r`rr?rmainrBrrrsM654555555------)))))))):;:;:;:;:;*:;:;:;z    |,|,|,|,|,x(|,|,|,~ z///HMg&&&&&&r