@@ -79,7 +79,7 @@ class Test_GenSalt(unittest.TestCase):
7979 "$md5,rounds=4294911250$3HtkHq/x$" ,
8080 "$md5,rounds=4294942764$p.5e9AQf$" ]
8181 }
82- # Rounds and expected output for sunmd5
82+ # Rounds and expected output for sm3crypt
8383 sm3_rounds_expected = {0 : ["$sm3$MJHnaAkegEVYHsFK" ,
8484 "$sm3$PKXc3hCOSyMqdaEQ" ,
8585 "$sm3$ZAFlICwYRETzIzIj" ,
@@ -97,6 +97,23 @@ class Test_GenSalt(unittest.TestCase):
9797 "$sm3$rounds=999999999$ZAFlICwYRETzIzIj" ,
9898 "$sm3$rounds=999999999$UqGBkVu01rurVZqg" ]
9999 }
100+ # Rounds and expected output for sm3_yescrypt
101+ sm3_yescrypt_rounds_expected = {0 : [
102+ "$sm3y$j9T$MJHnaAkegEVYHsFKkmfzJ1" ,
103+ "$sm3y$j9T$PKXc3hCOSyMqdaEQArI62/" ,
104+ "$sm3y$j9T$ZAFlICwYRETzIzIjEIC86." ,
105+ "$sm3y$j9T$UqGBkVu01rurVZqgNchTB0" ],
106+ 1 : [
107+ "$sm3y$j75$MJHnaAkegEVYHsFKkmfzJ1" ,
108+ "$sm3y$j75$PKXc3hCOSyMqdaEQArI62/" ,
109+ "$sm3y$j75$ZAFlICwYRETzIzIjEIC86." ,
110+ "$sm3y$j75$UqGBkVu01rurVZqgNchTB0" ],
111+ 11 : [
112+ "$sm3y$jFT$MJHnaAkegEVYHsFKkmfzJ1" ,
113+ "$sm3y$jFT$PKXc3hCOSyMqdaEQArI62/" ,
114+ "$sm3y$jFT$ZAFlICwYRETzIzIjEIC86." ,
115+ "$sm3y$jFT$UqGBkVu01rurVZqgNchTB0" ]
116+ }
100117 # Rounds and expected output for sha1crypt
101118 sha1_rounds_expected = {0 : ["$sha1$248488$ggu.H673kaZ5$" ,
102119 "$sha1$248421$SWqudaxXA5L0$" ,
@@ -271,6 +288,11 @@ def test_sunmd5crypt(self):
271288 def test_sm3crypt (self ):
272289 self ._test_prefix (self .sm3_rounds_expected , "$sm3$" )
273290
291+ @unittest .skipIf ("sm3_yescrypt" not in pyxcrypt .get_provided_prefixes (),
292+ "sm3_yescrypt is not supported by the current libcrypt build" )
293+ def test_sm3_yescrypt (self ):
294+ self ._test_prefix (self .sm3_yescrypt_rounds_expected , "$sm3y$" )
295+
274296 @unittest .skipIf ("sha1crypt" not in pyxcrypt .get_provided_prefixes (),
275297 "sha1crypt is not supported by the current libcrypt build" )
276298 def test_sha1crypt (self ):
@@ -349,6 +371,11 @@ def test_sunmd5crypt(self):
349371 def test_sm3crypt (self ):
350372 self ._test_prefix (self .sm3_rounds_expected , "sm3crypt" , pyxcrypt .crypt_gensalt )
351373
374+ @unittest .skipIf ("sm3_yescrypt" not in pyxcrypt .get_provided_prefixes (),
375+ "sm3_yescrypt is not supported by the current libcrypt build" )
376+ def test_sm3_yescrypt (self ):
377+ self ._test_prefix (self .sm3_yescrypt_rounds_expected , "sm3_yescrypt" , pyxcrypt .crypt_gensalt )
378+
352379 @unittest .skipIf ("sha1crypt" not in pyxcrypt .get_provided_prefixes (),
353380 "sha1crypt is not supported by the current libcrypt build" )
354381 def test_sha1crypt (self ):
0 commit comments