#[cfg(feature = "ml-dsa-44")] use fips204::ml_dsa_44; #[cfg(feature = "ml-dsa-44")] use fips204::traits::{KeyGen, SerDes, Signer, Verifier}; #[cfg(feature = "ml-dsa-44")] use rand_chacha::rand_core::SeedableRng; #[cfg(feature = "ml-dsa-44")] #[test] fn test_browser_message() { let msg = b"asdf"; let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(123); let (pk, sk) = ml_dsa_44::KG::try_keygen_with_rng(&mut rng).unwrap(); let sig = sk.try_sign_with_rng(&mut rng, msg, &[]).unwrap(); assert!(pk.verify(msg, &sig, &[])); assert_eq!(sk.into_bytes(), *hex::decode("e1d8a883b4f9cadb6ec2878ab505a80fae74f653c865fd8f65e81b04567282d26b85c2fd1770043e69815d5a620973e506eee815fdb9afc57a74cfb9a1a7f4eec10f3d210c89f83d3ef743eb932cbb7599b88a9e0666efb469e3e280a3951ca7fb71af23f45421955b4b7f1924a3516736b717d85072e7669393f62ff8856af1191966a208725436920183648b206a23a100103811c834240a2402d8b2904196500912240b480ce18440d2220ec1244561c84c93188d54c051dc121213a2052419055b3880e02285dc2406e20249c948401c0009901040019389dc806c111662cb142e0c18651935321b324d18138284b82518018514304ec3b62c9a0869121304ca3842122951424201dc1650c140319cb00cc3084813098ac0b88998a6109c046d0c27298c948d20408ee3b825d8004164422084408052420d18a90562066a9b144681108064926c00289053a049242045a314129a2628d216610921820cc245a202658418081a07265b906cc944028828268488690cc18599c00c4436600b432ce12211e2a6299c18520398714ab88d1c49840a836d59040c8cc62d18498d24104520360dda08500210401c340991086e4b3805a330811831125b362014074a14a2248a128e0188508a14501805840ac55162342e80264a41848882262c01c5895302801bc329044264da242e82380504186849a8898c402aca8430e0048a8a2849e138294a1004c39070d3c641c8003142906d5a0285cc22491c22849402925ac65153268103a480642448dbb0812203321028299c12201c8501e0062283c82961b805e1b44442c00c14112591441119384642488a00032ed2040954924518118e0c90600cc98413324010319124059009214e09116500948904174cda22859c844003380d61888881b280022708a4c68801342410380102928cd1c431ca187143c651c0106a0a2701c0244d89068d8396294c106119982cd902424494910ca30511c101d3424900b2089c8050c4a2118a2228c4a08808938c020572621064c33220c4a60d19980150a22952880109a32801350cca280dca80018b0028249528da98055bb08d100110043866cc444e1a496c203205cc42651a8725e2221050a291c4a46d99020219044021a06813b01099b28c24172e01437211b94019a04153845190426414268680482d03814c91224a4a30889314201c080491b20da3b22908a468144790da4608d0043124c84c4210214b382cc98491912462439060d028bf6be7c4cb98214522bfb7d9b6f4aaca9db9f5682be7786727a240d486b92fb5f4003af9427278df44da48c0875d6b3846126d77d973953fcbdd5a6cd1d17fc5d9fb598f469fb651123322127b2ed518dbfc5417f79461e4c21fde0adcba247d09f695256f27a6d77b6e11386439fb5a0da6bce036f3fcd013e3f6e71f1d5718c5eaf41d5633eb66bfb0ecc227c8a07c2c13047e697b5252eb2799247a4595a281d741ee66a1a60f21b381d06d21940b53fa7015306e9646c553516f11df805d97d95eb689e7851e4e16e2282e2394269d69555e9380fe2fb884acab64f3dfb5b50f4a1d0667bb6082e920b99afb76e2b625551c11d8f813c8a1ddd320305ba4c4f257aa9fef04d3986280064e44b6937e2eb3f6e61ee742b5e6d607937b3d04c1ec4f2ec8df640fe5ab5200517547d44b01c6cf9d0e234dd14d3c8abe059cd6020b575ca6355f7ae84be7c3e66fd891c6cc6a2f8b77cc047e3aed7a784186cc3f42af7ba42c2159f9bdd03e2de9c95428ad1a1dc73b7ab95bee1f01c255f5611b63e7ea8492e1cf6e5c66e490e69cde65578c24d8f0d6b78b79066322304f985759d28948ac6ebe94da50ac7b95813af76e855268b154fbd268d566c9ae63c6c6be4f7a6dddf70049acc8cb2563b29c1ece13c380e41575f8952154d6447b3ae0a19f088f28edb565b8290672ac079cae9bf0142e203550b1776b7d6c2f44c5f3dc6354be0d0230c481a65c73b087eac2f216cef47fda8c57dc6aa4af210abcecb3c6ecae5f76e4fdb8a7cfbe22437158d299afb5387b243cbdf2f1e079cb136dab1dfc5b0406e3d654ef5f2ee7ae3f5647d5f87e573247f9076b92a94b102fb9c8320ff23b38f65e05be147d88657e461c7171ff4c67ea6889e52f86fb1fdcf03dafdd6c7faa09033ae0ae274853c261b9bdbf20c2848d587a8d7b34526c46bb376edc5d0a7b01aeab68bff4fccb9002bc6d8da4c53b8668c12564905b95548a5a1abb1d804c74e14631b7cf4346d0a0876fa55f9dbeefa4da683c4421d6772447cf00da695769fe99651cb30bb28b6a100b1c26a684fef88cd116b8b6383e587d500af4dc9b2f65c23ebcb9dee5888af2df0562929c6c1a89edf822bad37814d311e70021d8d21bd3f6d4fa2ad8d84593256c92c166b71d85bb5ecf4d035b9727fba1d860fec05673ac616a2392001fb38b805a3eb5486bc430c8084edddd24d0eb3a8233859920d88830c6cc285b6536e8dc9b4e0a612fba15e86f4a495aba17c23f22b82bde486ce613eacfd01ad3ecb9b8c80f11e21cef05c7cfa3d9da5504d7d123333950db6ab1e8783002ee4744c4e7e30e370f30e9c310b97c4a49d8ef636ea16371a69270e8b42a03a351cc5f2369384a393d63ffb752ef47fa0c6f28365012beedad1fd9da4e0a9d03b55b7130e893b5a4bb6594dafc9e5283d26c603fa193c20b002ae5eb3288ba37e42e2418a5dc4548a2b8a9cc2e0b53e165df5a46b237752ff7c9912312fd9b3220bf89ddf42522ee2cfe12a505a5bc6e08c87597c37f21444254ffcb639147c489c6df6d87a4d018bf7dcbc21132b87c43f4b9835f46f6172dfac4e6987e6d35920ce548291867370c5fc9a87a844b4186df1ba0964e9dd79f16a6db45c78fca3a7a1e0779ee030ccc2f87d1d982454cdc8290b27344f98ad815dd93a4039b37f19de816e2308094bc3dfa566ed5918cc0301e34836a7006ab34b9bee5a7b74b7fa6ebbd141db81d3825bc8721217425ffe88f9661abc0e642f9ee12fead70359a908583ce09764b7ff0239e2c544c4b671022bfb0fb019fc380ecad8308930984bfc24537278583406258d6977f3e06b556af703c488aadb9bedb43a6aae2d8a61e611b2f810c8007c8bf75e97b4f24d8e612afabb04f2da1a7129d4f88d13883da47af7200a97a30a421a7492abe64d039d68056b0268d08eb16b2432186230bb6df8429d26c76ca20a7810d1c6812c4abce516d349ab41039313225490af48efb8d9266329cd2863c6cec87e82a6c6cf3b9f75c026d6c444e11a0d7dd29b5024af29099c6883c86134a34b05fab04bac76d00b3067323948fbf4bcc6f16159fd1ae8818c975346388d2d7341f8dea37e0dc27fbb9ff6b1f353b8dbe08b230e4efd010ec13a32a3856f5b2a16706d5e62b0fae27ee67880e4a0240d64716436036c4ef4716af27e8114e3e59c68938bd095baf5f9db71d7c5f5c12c97a7ab2171be79b5d9154a37c799d4fdd9c5391655fd605e51f4a3aab06a91443fe697d421310e621b12040daeee392e30fc36040f1acd43eea3e2abe7b2cf5b21c3963a70e86e93320cba25093e33e94dfdc").unwrap(), "sk not correct"); assert_eq!(sig, *hex::decode("8205ab20fbafe5ba3032ac9b5922d10e5a0364ed6181f4148f9005c3598990db75b773dc1002cf8c3d2608eb250abdf7615a2334d36581c9a366395d713d0d3d37dde879eeb82694b6bb1f42123ea0b8d37415e7aca9233db7478d7500359546ca8b05432c6f4e113051e0a08084b001ed81497d0616404238e0716b1975bd0b8a52351f161cb8acb67014d0a776241912e881adeff1900588edd1669adada713023f4ab7c0390814b71b97f735270683eab2567e49843de68098710f486b839ea53e5c9b235666ed753cfbb79d1a6ed977043b8859e89a7b55bc02700b3cf02798a3567fb44488e0e96f92362f2187818bdc58600fa374d129aa7dee11554bc4482206c4f2badf6946bab08ece72f6d603c158d8b80619d00c97185d7e2d79f085cb12bc15101bb24e3b667a52fa9f0748be67f483fceff66c3fcac4a7962bf291a1ab3755dbf1d346da0aea95e458361d0a552131cf22958659afcdc9da4f66633ab1bd1217b8f29e3b96a870afa225ef2e4b1e56760e45951d016f1be4b8bf2745573d63aaefab2cc8ca159445de71d6033ecd5b5f0226e894f4425e6ecdcf5511a0a5f57944880d7c918f8751e1e58c13d5dcda9a5e161a4912080e48fcb7f7427f260c2040bbc5b6b5bfd69e221aeefca0667a83f63977d781784018e712993303e1741e705e85382f065908655ea570d24e4337c35c2c9a2a39d01c7e0ce9e4d4ab5453bfe7e1109b100ccf79d1e78f00e136bc9f5a2bf9ed79d585d9a486e5c6f9ec2d2a2253a6b5abfa012b394449b430ef79b6d136a29057e643a89f651aa3c615a1b06eb4037b2e02c5e6900acb6502ba96959caf02edaf5c889e7b46775f6712672eb7369eff45b972e892176214ef3665102b99e1a1ebbd7aa2ca7989255dd114939b9f47bcc8e77140a69cce800fdc26e1e7620de0b5dff277a5b0cf0103340a377b40afeea139d22ee79b826c9eddf98433f186011204494def86be84787190eb57762c618c0a2de1d8b23fdd54fc3365d24c1eee9bce996b974db749ed5c3ff94e24124e408c0427c9a9a389ce6dbaa7e4dde3c0f108ac13f86db9cdbbf3f4cab5ad9ec5017c89e07f76f5e2af51112dd8e5de40a39068e47dc9192ee6078eb54990fc1025353082315aa6f8d339c578db694de8e2e0f92dbcbc44d2d1da8b75c50ba88a8fc050388bc067dc7c3a9c709c4f00d37b1bf22e0b0641a2b086af4b58e59863cbdb5c365765d779de0ea385b38d3840b22b5b989c35f9103631e851b8c66504235ccc711d86c240c8c60823ea0b31c41a065ad22e59887a8609c9fc9ec227802fddec6ef83c5ce7da63a85bc1bee62c18d0694be098839c91f0ab4fb723983867687b1c6c070e49a247cd48a04be39df2af40272eb8f621d5a520075fd05bf8ed5fb66f76e75e74cea3490be2a8e2cd430a300a14e90d7a84a58b5f395dc0e45122c0a3f37efa1c811fad7efeb43baaadb1a2d609d076ddb430ab0e18b5572686f22c8ca4d743b0de07cd737a555a907cc7477c525711f0db13e60f86dbbda17e0d2e8c6cf9951a5857fbaad4e6a165cec3ff81f69ce4d988196dcdafeb2878d329fcb6b10cc335aabd122a2017534ebc8039636a66d2bb209d29d9480a7a651a99d8ef1a125955f363d9274b507772636671e1fd77afa761db1923b7b8de675bf30cf782d7943a2979250913230b507c6f734e57fa0c917238e0ec02d11fadca4f0725662c83e3b21b47958cf1ff41e73d87de0d211dad13f5621b0f84301432affba0f1933ecdebd97487dccd3c0a258b03439f8942be8ef4800f5ffc6dc36b2bc043f992e673c0822459f181310833a1243f0bae3ad408b6800198dd06ea39364071968e22a30b579ecba74a1e901728f24631724febbe7d68c788ca019d9271927d0f8043670f210d7f37da2886d23e91bcd0db107f5e7a95b69cff2dda5329e29e3923d3d3f19dac89b179ec90d638ef97e2523903055aedb3a1773c49d17407a71cb326c7b5b28a3ee3d23d36e63b0a9e74819a1870000128d081cbf412c3cef96fda35a7eeadf34a03d3e1fdfa335dc8f1f4739a4262630c30fadf394104081122eab22fdb57fe4ad24a6c3516260557e28546405ac7cff361f38b5bc07ab5b81377e9e34d5500d3816fe002d19262579a0fbd058f8a2cf0c9984d6c3bef99403c0a286a86ec01809346a9e3d48a5c2029bbb7e756c1187f9e9ec72e8f37c01bbec3c75435bad088c21d8b93f210c7a0c3a3607f4e2267d31fa0a74302daede73f1d304d79bcd4e9b91a1223806dde9b73405fd67ff8e1b76702cab55b669c8a4ecd5ef57147324bd9c207638d4261bf123165d45ac6b4974ae7cf13fe3868327d903c9c9a79b8004520855ec9cd05dbf2d9b56fe7f83ab87c94e15b297de13e2b66b56d8d952dd665e70b3a2d07f5a1fe1467e30f7b1f574e1376f4fc9c5bec6af9cd72e0b485800b34112811aa28cd3ea11fc6136941584c1488105513c100679472f8e1f5cc111d82c66c1c5242e471459f6bd7ca80a2152c64d46752d92ab37fa4f0c3b85a7238714b1ca7962506e3c42ca9233118728477441f9fe2bc2dfe5e9a709231b6417ac3de9cebf42acc26a607d003d890c3fff482baac070a98e78d47042e04d70b75b629daa38c1c9d826feb8ed377febb2d418ab1d81fd1811003476e39a27badc32275aa028d74a7de5791cd72b0eb4ca6b84f12f18ffdaba0baede94038c99ca7f65b1c1c7d6cbcd3fd7829f5a3dc0181e6f0116aea1f028adace2721d7366840849a41fa37051ac935e8385a90cb6f10a1fe08ad13452e6d96649c61fafa22e99272a1a24bcf57f26409cffc663b0db0277d3911f33aabff791b09bc4af8264e6a070c30d96808c2360681e5b67d79a99745ca63469f9bc9870f7e86a1ea695092e9f0c054787baeee5b9251495e1eae391490b44e5132bdd5b84291cc100ea7061f72de07fe5e4c6ac18dbbcf50a2fe0b2a10b54566e7ac29d94d9ba4d7a69596ecfcfe9f3b73ecddc71396207b7c42b1aa4555ac1855ee444ee10cfb570b86842e3cc30eb9a3a4e3284921b9c506566627743f83bd80798dd3725a3c079768e715223b5f5fca913df9c57def810a26ec17c30371dbe22f312da22e63085f28f93fffd520b30e60d0d9ead7a9f7e03e9e2c099fd3a6438d8bfdad3311a0631cb724e53ccd13fb558cbeaa7893f324dc4d0e65699c528dc5255d58f686e1d1f3a2255921cce965c48fea41aaf627d343679ef59b7d47ea1bac2745767fac686681742b9352cdc3c19222c3c405053555862696b99b8ceddf4f7345e73768fa2b0b2d7f5f8ff3d4d5567686e7ca0a7bcc1c5d7dde901050a141d2d3e44484c59626c6d9093a8becaedf5fd00000000000000000000000000121e2d43").unwrap(), "sig not correct"); assert_eq!(pk.into_bytes(), *hex::decode("e1d8a883b4f9cadb6ec2878ab505a80fae74f653c865fd8f65e81b04567282d2a0a386744fbbf0eae28e0f6116f0fba5fb006b0456c3bc401cf431fe72e2585dd15ff0cd11840efa6ffcda2eb33c1fcc698f6082b2d5902e8c760ab51414432035aa2aef3c5d1821175c6f52552b15957bfd37f17caf123cdb2bee49e5fa1009415ff25b3924c80244ec92999d75bbcda6695d12689038d1562a7367b83f4d1bfc115f9ea6b5312019b42cb35f14c4cbc42c4426ba214d659f5b0438da21dc50302654f3b5c6fe8765da736d25f9c3051e8b2be62f4f7dc78f55376f674f468bad69a063058f9b3a602d40d9042d9c554a813a673c5902d5c4f5a6f5844b8d2ea7373dbdba2f6000d561fb960e50883741c96b74667fb50aeae4bfa9b68322d57fbe83ea1257f9d927e8b491c24b4f4d4314d32bbb42446198158650ea2e35d20f71bc27c5dc30f30893596740e6668912a8ad0e2046e18cd79b3232d140954c4ed7921fd693efc554aa52011cb5a1e9cd510f724c8fc3fd6589d2effa5d962d0658c37ab1634990a8599baeff5962dbce6688904fbe64b61e86c3f96b7943ab33d618dc53590e7fdf97055f152c41f27bdf16564b9e21b686cbbdd4b02e37da65929c800cc586f0f087e059f7ff1c8062d66be9f6c52d5a9316a985cc33adddb13b31791681af833ac0c4c86cee5e89ccfbb2957f7b15beb4c99aca440d1f19119a613a87d899d558fadfef4b3abd6884c3295d753e4559131e1e7a518b0a75c393b1b11fc8b19f39be979d21f15e094bb36173630bb5e4697458b18a0f8d9c8bac8213ba32ca515464cfd41c8c1e67a097600dcb5d38cfb0f8bb52dc9d4c1919537dc0b4ee0af9f8fcf7d9c225bb16b7e4b5decd2606213b58a2f012fd5d414bcc8311847f8fd48520e4a7d934b1262f4ae9d8a233088b7e08707a1d80e6c8ea42a8096f88c6cd4f9eb75aae2751e0a31b0ac6dfa57605ac4b1da0b18338e69742852137d3b04e164f31dbc817f86c31f651716ee521b595a5c9536c91e12e80a4cd5c57769b2eb77469fcb79aeceae8e997b2e9ad98b5cacf310257280d61e764cd8e2baf7f67b6c0f8e7affc92ea3464d185beef7e5fb4f4d8a8da70640e94f76942f1b39dd8e72567439d92a95173ebeec3b9dc0d0ea8e7be42b24564bd1a3b618372ff012302ad06e279def6ae64f0081d095b8b32cf1608a8b5c84bc81a4e4eea00360536efb5803fd0a861c791588ead9256d486d5518660748e9d64262f7f87a742e23c534fe9c2ac6cba5621a8c8e9cd95bff3eb893d043076c09992aa87a4fadca5765b3142e88ac9693960b6a91b2b97ed11d99231345451eac326316cb8236c715f41b89c65198b7fe0cd38f006531d551a7bd8b7575af4d9839878db8c034ddd73e5ac25792c45123236ed86c37b829e6dec5c945e20a3c08f9f25375771429c28ebfe182c3de6dfdef77640e54004eaeda663ee84643e39b0401b10fa57fff31b8ed0a61f64d1b96b7b95c7e65bcf01ad1be783a3d901588663785a1b52ca2f993eaa5144d36fa93feb0fa3012c835312e32e4669b12a15d37ebd68f6c3c9be5b3364a86a5d77afa27ae68022b32c74d2d878fcb0634e506a27d1ed26c53c0e678e9023a4d20d53ee344bef98c3a94fc384df75c9c55d67238e2143bba44414818a167580af88504218680bee310b13ed0409e155e941c59c056ef4334ef255aed2dd29c5cc74d2e4db0c4cbfd7bcb0d65d2a7eac360f878a159220d35e4c1a069eb8d5caa13974729f28c60d0ef183fc1f5e13dc28e98b98f82baa610a957441af4a055027080856a816e796f42d04eadb0f490ac89af03e").unwrap(), "pk not correct"); }