################################################################################ # Initialize with a given size. # p0 : input size ################################################################################ Initialize with given size (0) mpi_init_size 0 Initialize with given size (1) mpi_init_size 1 Initialize with given size (100) mpi_init_size 100 ################################################################################ # Count bits # p0 : input value # p1 : return value (number of bits) ################################################################################ Count bits zero mpi_count_bits 0 0 Count bits one mpi_count_bits 1 1 Count bits mpi_count_bits 31 6 Count bits multi digit mpi_count_bits 2b193b746a12a389ab81 78 ################################################################################ # Count bytes # p0 : input value # p1 : return value (number of bytes) ################################################################################ Count bytes zero mpi_count_bytes 00 0 Count bytes mpi_count_bytes 1943 2 ################################################################################ # Set primitive integer value # p0 : input value (primitive base 10) ################################################################################ Set zero primitive mpi_set_int 0 Set negative primitive (-2^31) mpi_set_int -2147483648 Set positive primitive (+2^31 - 1) mpi_set_int 2147483647 ################################################################################ # Load and store string # p0 : input value as hex string # p1 : output value as hex string # p2 : return value ################################################################################ Load and store zero as string mpi_load_store_str 0 0 0 Load and store positive string with even length mpi_load_store_str 123456789abcdef00102030405060708090a0b0c0d0e0f 123456789abcdef00102030405060708090a0b0c0d0e0f 0 Load and store positive string with odd length mpi_load_store_str abc abc 0 Load and store positive string with single zero prefix mpi_load_store_str 0abc abc 0 Load and store positive string with multi zero prefix mpi_load_store_str 0000000000000000abc abc 0 Load and store negative zero as string mpi_load_store_str -0 0 0 Load and store negative string with even length mpi_load_store_str -123456789abcdef00102030405060708090a0b0c0d0e0f -123456789abcdef00102030405060708090a0b0c0d0e0f 0 Load and store negative string with odd length mpi_load_store_str -abc -abc 0 Load and store negative string with single zero prefix mpi_load_store_str -0abc -abc 0 Load and store negative string with multi zero prefix mpi_load_store_str -0000000000000000abc -abc 0 ################################################################################ # Absolute value # p0 : input value as hex string # p1 : output value as hex string ################################################################################ Absolute value positive input mpi_abs 1234 1234 Absolute value negative input mpi_abs -1234 1234 Absolute value zero mpi_abs 0 0 Absolute value negative zero mpi_abs -0 0 ################################################################################ # Comparison # p0 : first input value as hex string # p1 : second input value as hex string # p2 : result ################################################################################ Compare first = second mpi_cmp 23424a98719c87431513cc276f4238941d23db48976234 23424a98719c87431513cc276f4238941d23db48976234 0 Compare first > second and first = -second mpi_cmp 23424a98719c87431513cc276f4238941d23db48976234 -23424a98719c87431513cc276f4238941d23db48976234 1 Compare first < second and first = -second mpi_cmp -23424a98719c87431513cc276f4238941d23db48976234 23424a98719c87431513cc276f4238941d23db48976234 -1 Compare first > second mpi_cmp 23424a98719c87431513cc276f4238941d23db48976234 23424a98719c87431513cc276f4238941d23db48976233 1 Compare first < second mpi_cmp 23424a98719c87431513cc276f4238941d23db48976231 23424a98719c87431513cc276f4238941d23db48976233 -1 Compare first < second (#2) mpi_cmp -23424a98719c87431513cc276f4238941d23db48976233 -23424a98719c87431513cc276f4238941d23db48976231 -1 ################################################################################ # Left shift # p0 : input value as hex string # p1 : number of bits # p2 : output value as hex string ################################################################################ Shift left zero mpi_shl 0 123 0 Shift left no expand mpi_shl 1248 1 2490 Shift left expand mpi_shl 1248 513 249000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ################################################################################ # Shift right # p0 : input value as hex string # p1 : number of bits # p2 : output value as hex string ################################################################################ Shift right zero mpi_shr 0 123 0 Shift right mpi_shr 1248 1 924 Shift right to zero mpi_shr 1248 513 0 ################################################################################ # Addition # p0 : first input value as hex string # p1 : second input value as hex string # p2 : addition value ################################################################################ Add zero mpi_add 1234 00 1234 Addition of two positives mpi_add 23424a98719c87431513cc276f4238941d23db48976234 ab123874298346127438787138743217688787518234532d641329727398496325 ab1238742983461274389bb3830ca3b3efca9c654e5bc26f9ca746964ee0e0c559 Add two negatives mpi_add -23424a98719c87431513cc276f4238941d23db48976234 -ab123874298346127438787138743217688787518234532d641329727398496325 -ab1238742983461274389bb3830ca3b3efca9c654e5bc26f9ca746964ee0e0c559 Add positive with negative mpi_add 23424a98719c87431513cc276f4238941d23db48976234 -ab123874298346127438787138743217688787518234532d641329727398496325 -ab123874298346127438552eeddbc07ae144723db60ce3eb2b7f0c4e984fb200f1 Add negative with positive mpi_add -23424a98719c87431513cc276f4238941d23db48976234 ab123874298346127438552eeddbc07ae14472 -23424a97c68a4eceeb908614fb09e3652f481acdb61dc2 Add opposite mpi_add -23424a98719c87431513cc276f4238941d23db48976234 23424a98719c87431513cc276f4238941d23db48976234 0 ################################################################################ # Subtraction # p0 : minuend input value as hex string # p1 : subtrahend input value as hex string # p2 : subtraction value ################################################################################ Subtract zero mpi_sub 1234 00 1234 Subtract from zero (change sign) mpi_sub 00 1235 -1235 Subtract two positives with first > second mpi_sub ab123874298346127438787138743217688787518234532d641329727398496325 23424a98719c87431513cc276f4238941d23db48976234 ab123874298346127438552eeddbc07ae144723db60ce3eb2b7f0c4e984fb200f1 Subtract two positives with first < second mpi_sub 23424a98719c87431513cc276f4238941d23db48976234 ab123874298346127438787138743217688787518234532d641329727398496325 -ab123874298346127438552eeddbc07ae144723db60ce3eb2b7f0c4e984fb200f1 Subtract one negative from one positive mpi_sub ab123874298346127438787138743217688787518234532d641329727398496325 -23424a98719c87431513cc276f4238941d23db48976234 ab1238742983461274389bb3830ca3b3efca9c654e5bc26f9ca746964ee0e0c559 Subtract two equal values mpi_sub ab123874298346127438787138743217688787518234532d641329727398496325 ab123874298346127438787138743217688787518234532d641329727398496325 0 ################################################################################ # Multiplication (generic) # p0 : first input value as hex string # p1 : second input value as hex string # p2 : product value ################################################################################ Multiply positive by positive mpi_mul 4f40f41445e639a25606 74fb17 24372a67557aad1fc052a59c8a Multiply positive by negative mpi_mul 4f40f41445e639a25606 -74fb17 -24372a67557aad1fc052a59c8a Multiply negative by negative mpi_mul -4f40f41445e639a25606 -74fb17 24372a67557aad1fc052a59c8a ################################################################################ # Multiplication (baseline) # p0 : first input value as hex string # p1 : second input value as hex string # p2 : product value ################################################################################ Multiply (baseline) by zero mpi_mul_baseline 0 1 0 Multiply (baseline) max u64 mpi_mul_baseline ffffffffffffffff ffffffffffffffff fffffffffffffffe0000000000000001 ################################################################################ # Multiplication (Comba) # p0 : first input value as hex string # p1 : second input value as hex string # p2 : product value ################################################################################ Multiply (Comba) by zero mpi_mul_comba 0 1 0 Multiply (Comba) max u64 mpi_mul_comba ffffffffffffffff ffffffffffffffff fffffffffffffffe0000000000000001 ################################################################################ # Multiplication (Karatsuba) # p0 : first input value as hex string # p1 : second input value as hex string # p2 : product value ################################################################################ Multiply (Karatsuba) by zero mpi_mul_karatsuba 0 1 0 Multiply (Karatsuba) max u64 mpi_mul_karatsuba ffffffffffffffff ffffffffffffffff fffffffffffffffe0000000000000001 Multiply (Karatsuba) 6400 bits mpi_mul_karatsuba c92e20b990846a1037594736fd02ce34f1776d4c019b0d31c4b5bdb0df568ea2292223e70d6dad392d466500c8d18c1ea21b6433767cc0fa6d4ed344ae38b684c12ab8f06ee44c787e499fda204c4cbb835439ca93827b8f7449ccb624ec1b77837f6cc1d7ac8f8f607820a9bf210d38fa7af0abf8ca93bf9fbfa279246ff36aca41a2bcdf674b2e58e2bee6e1e565b279e4495980c871bc6b29eca61211ddef99c683ce43cddbd1b82a47b1d6d8aedb362acd86af6470be5f9345b4cfa744264e074a60275e81de16583688ca082b5f166b2ba8ed6fb23c88ba46c9a8ed0791628abab6bcc7291100ef301af30913f19e03f2d8c1be35972866aaf639cd7653f9944da1d1cd0174acd428b6859a7f65dfae0c2730bec684b08b8c687b0ca7b47e202c939850b0276062906dd331019190adfa8583882ee4f71584d3b2f866ad7218028eabec5a6909dfbcac7f3082da1b6c22e8fca64ee2544c52fb90a00311cd1d720aaa6bed75d056f8f289266a4e7dd45bdbe5ce97e9320ae5c8860fa2139ef621f88db43ee9d1994f431d4992d54b607db88599c5246805a0eee8b69eaf0c5fc3b92ba17605a2f11ebfea4c8c49e077f789bc5e13b9fa09e8b6b30ed0828de51be0e04af432816c0b0096575bd3d49491c73fbf1b9b2792587b8571086e23f2f68a5bfd8341b2f607c68700a27dcd610f9ae972dcb34a014b46cda68bb8b32790eb7ac476bde9c7edc2be5f2ff1f940c743bcc8a56fe71558ad93e1951555b4d6f2e0d46eaad63f40bf6b92d234fa74e1a7cb2eb760abdd2c6db1eaeea51519dd972f8c589cfbe36e33c1f2ea96c6d72b5faf0e3752848259fec37843220130c4a7c122684d4c10c0eb75514c601db8a27b9715d143c29e305a5a13f621686290467b313ad68d5e249b40d48a883d38240c52c740411d514a30f17640fbcfd5bb824ba578ffa607ee12cb99c43f11e647585aec12da7fa5e87a5003e8c7639d573f8a44526c4f18a5c582364122c0e10d02803beb1c1caa0a446c56e722ee933e7d262c49a6c35e5f8ad43784d21ace6c2cecff5dddb9cf87750c9301ef49eaffc6d4fdc1703836becc4002a91c6ee9a9a402b0a20273f410e9a408f905 2b6cc14a427b833f583b1f5fab69855ed61a0ae3518a7e51743d9568f05a90797edafaeae6fdd2c6eb401b743b8c5ad434bf4189e2de8dedabdcdf9379ab71692d0f3f9658e92dfe07d4a05f11224c35c14bc83b0344b8fe352943a082ee06ce888489bf6fc0256dcbec020b717c369e6ea872562fa8736dee1413d6c6dd9531c7364b994c27b26480a4328a9bb9a4404fbe7726c854068e108f86338bd5f1a4534fadd1d15972effccb0b90e575fd8153480d1991395f490c01e8b6dad9f69a17d1a310170b15f75759a3d21c209b15c390478e053987323ee022d7804852e17bb1a6798d21976c3c5ee4312644b28b6f974eac6ff1d1db834426d0aa8618ac95054c1c1b085769a8c298d1e0abb499e761d11e56ff07bad43c4ae78c53a95a8dc2a730dfc7bbb9d7c759170c83b831b1640737081badc6f66874842d21858b412b05d62e3ac566d37bd8770195e34826fb4c351fd1075472f4e743255c4b1b9ec1c9d3d6aedfbd25c3fb7772592c3d2935e41c2807913ca9575c9c9c155de2c70debf1166cc6b06cadfbbe707d7ea3eb804359db08d78be557c5bbffe75c084be5a019bb282acdaa201ab8f44bed03da090bf83e39fa0567331d0afe0d31aa1ccf22fb407fc229584f81442b56fc83181af65a1488a5d6a232b4777f0203100385e7236d5e3cc456cee6397ca6420636a9848b33ba6092a2f2a45f68b88b8ffb4c9db8baa12dc53018aa74eacf61c8266bfb9433fe31be22c21caa6a16583c1dc15de08e82e4b73413794ee950b93938063e502641243e0bf794c5d2c4690c3ff78b295dc2dd40a446a74671b093b110f18e6eb5d2a40b545c6a5a5a60494e93ecde73d63730b1b34d534c9ab0aaa25c58a07a138bae78849b8edcb1ac360e544ae5c0880b5fc8adda26255862fc0365dd676affd379cb0b46a01550270010b611affd035d775cf81165c05edae63379dc0b4dbd25a7a4a1820e3ee18199051273c8fa17ab85301013d6b7354f34eccbe49b94174530aad38d59066bebbde95786e6266e574f38d077e162e5d36a20e99b34fbc60e4f3bfb0861a23d68d4386a8b988c56a4e727e10ad6c84774adc76d6ba6cde16032ccd30b24ec6baaa628 222036db1bcf8603053a222926586ff562cf5759e1d165383ee41b505fc2998a6731dd7cb8ac391040026bf0e8178540ddb9ec30cb988da176cd33b2eeb5c61006b535a488e88948d0b845166fdff383073b11d68c529dc89a06a250f4b3bc7119b05f4cd5c95e19fbb04ee7ce1ae003743a428897b5c5768617ddf2662e198984167c669a32474e14964c1c75b034d007a978a4ea4518c52657408a142b60aa52fe3ed21636701485e82e8753337f942ff060c42429c6a8ab3a9fcdea6a27f7ef76f2d1809a18bfd43b1f5da74a273f51c06507f5945d6fa9a273db883a8636f5feb52e353db15f4418bf94c2ae733999e7edf4ef5ea7d9b8f00cc67574e9d9860412cd6b5ca85ee1bc00ffda5c2d2f74aec2e0363b7509cbf22594e008120599d7f8d4a938e5fbc6d813fde2b650278c439aa8556fd5d6560a274c976e2b79bca16fab4d1ca96a6cbbd8d6cf67ca0a79a1280f1471da2e3ee8b7e63b61babec83493ff4425c1c434cd3926e18baf03962d446d440507c6a49f17cebabb5774a833588991ead6ed9da9645fafd8d70bac704ddfbfc4133310c8a6eedbe89b8fcd1ec518c73dc2262f0a6f6bc5f6d1d04fa350aad1f0d92accdcf1464732060a6a4ac7c920bf5f73dbb843eeb829904b9e46977d0fc54923747cc0debb7000f0b0c1c679bf92a80e441b4bf4a0ae21a64b60d3b7f44f607413e5b30833a5b75c9ebc014c7b981c1acff1b0bafcc16bd0c590c09f245cab89c625bc03fb4843a597d25b878613f575853fc4c58ce68a8d3041306d717952df3fbb3bd2e23c604ddfc5afe632ba39bcda0f322555d84806c52c35831909901b0642897e8ab71267304e78be30bb60e32ea16645f7a04f2dc0e6cd6a98b4dfa4103d26c4248c458f4db9f6a015c5bc784b667b6eb473ae232e3174879d17f66e5fccfac905b262810ce49602a7c07851938fd500f1d8376b0ea537d643460129aba2b0fb8de862428b0c6cc49129118673e0cb57e9ef685326d5e4b31498599446b1653ffa4726964b56861e2c561f7184343ba353c4673d92a85c6fa5201fcb60be6d4c5fc8d60c8ab75fb49183e81fee77df86fd7a3d68bdeea1f210b2cf8c278de2704205218744caaaa580343856579bbe93a2235281bf9998e9fd45117dc25f2b33b89cc36ea2a6143c0b16a5a71055dd8e942913429b20facebfde81102caa232410ef52c4c23b79c9292862adf3e2810dfae324e65334ca74f7fe569893af2e91aa8c512788f2ad985e5e6b7ef5932c389b7f72ee5a75dd6f9756437fd00ee6b29b3f93dc4898190591abf65ac1557e71019e37c5dfa8f6d60378c941ab2427d9c2a7a3355dd808ba41ff861bdba0308f1f7932d67fd2ce1784b6b2b777e8226688ac607c11f97097a90ce50239d1c43b69c2cbabb0083624f63e4848e295eb49e6a4d2442b849ce53984a8274bce38d22ff544e02f5da0d03c42f3591003f8c1536204350b829ec06602351e95d74a20d416e766a07d7a31b7c75c12cabf74be61fac0ae21d97052a61d034ad372a58b0ad8bfeb9c24f03a3cb4e59741c42c951b6bf3c1fe4c212b0959b095d62794560a4d754ea8b57789bc791a20b2d5f8b6915f3b83166eb8e66400a3e28ab679c256899f821016e8701851cd0095aa625dcf0a4ef028035d095c6f75f7dc7f60f06974cb57091b706ef28da05646f4eba1c1df4fee4e0c0585a2024c11288c7acd19e38bd78dd7692b9fb826e992042efbd7faba78084d18d83f81ac86bd4907ca1a4574ae9456f19d6a5a8845e15bf7cfefe7a92b20eb8d666c4e1a18e809e6d9f7fc611678ed67f84ff7aac987522aaf76a947ca6745133c5fa1e86b183c83ca7aeff86e854c78e36d960b3a0ad1390d47b92d3b16e08b36e7ed35160dbfbf44f1bbcc583405fdffcf0f59cea599b31adbd5eccdb74e8753290cd7adea2d1716031dcebecc32db55c6a47e2c926ef3848e3d8c72beb03c9096d35470f9610fb4e4a0293b7f99af165967c90bc7372032c2edb133a19fa97c05b3368c3c302058fc059706d0c3e17ab338a53b10606972307ef8401da23ad1672b4e4d596bf45728ed12eb8268d4f297e78416ba394ad3aff037dd510769caf4bd501be168d1fdf1457cbc7b84b69329c0da70e60dfcdbd85d32d6500f67ce1b9947b29c6cfa75794303eab5a7c9ff0629036aa3e745857ca5769e4f093f41b77aa6fdfb83e2438080483f7f2b79d4530638c991521785e73226c8 ################################################################################ # Multiplication (Toom-3) # p0 : first input value as hex string # p1 : second input value as hex string # p2 : product value ################################################################################ Multiply (Toom-3) by zero mpi_mul_toom3 0 1 0 Multiply (Toom-3) max u64 mpi_mul_toom3 ffffffffffffffff ffffffffffffffff fffffffffffffffe0000000000000001 Multiply (Toom-3) 6400 bits mpi_mul_toom3 c92e20b990846a1037594736fd02ce34f1776d4c019b0d31c4b5bdb0df568ea2292223e70d6dad392d466500c8d18c1ea21b6433767cc0fa6d4ed344ae38b684c12ab8f06ee44c787e499fda204c4cbb835439ca93827b8f7449ccb624ec1b77837f6cc1d7ac8f8f607820a9bf210d38fa7af0abf8ca93bf9fbfa279246ff36aca41a2bcdf674b2e58e2bee6e1e565b279e4495980c871bc6b29eca61211ddef99c683ce43cddbd1b82a47b1d6d8aedb362acd86af6470be5f9345b4cfa744264e074a60275e81de16583688ca082b5f166b2ba8ed6fb23c88ba46c9a8ed0791628abab6bcc7291100ef301af30913f19e03f2d8c1be35972866aaf639cd7653f9944da1d1cd0174acd428b6859a7f65dfae0c2730bec684b08b8c687b0ca7b47e202c939850b0276062906dd331019190adfa8583882ee4f71584d3b2f866ad7218028eabec5a6909dfbcac7f3082da1b6c22e8fca64ee2544c52fb90a00311cd1d720aaa6bed75d056f8f289266a4e7dd45bdbe5ce97e9320ae5c8860fa2139ef621f88db43ee9d1994f431d4992d54b607db88599c5246805a0eee8b69eaf0c5fc3b92ba17605a2f11ebfea4c8c49e077f789bc5e13b9fa09e8b6b30ed0828de51be0e04af432816c0b0096575bd3d49491c73fbf1b9b2792587b8571086e23f2f68a5bfd8341b2f607c68700a27dcd610f9ae972dcb34a014b46cda68bb8b32790eb7ac476bde9c7edc2be5f2ff1f940c743bcc8a56fe71558ad93e1951555b4d6f2e0d46eaad63f40bf6b92d234fa74e1a7cb2eb760abdd2c6db1eaeea51519dd972f8c589cfbe36e33c1f2ea96c6d72b5faf0e3752848259fec37843220130c4a7c122684d4c10c0eb75514c601db8a27b9715d143c29e305a5a13f621686290467b313ad68d5e249b40d48a883d38240c52c740411d514a30f17640fbcfd5bb824ba578ffa607ee12cb99c43f11e647585aec12da7fa5e87a5003e8c7639d573f8a44526c4f18a5c582364122c0e10d02803beb1c1caa0a446c56e722ee933e7d262c49a6c35e5f8ad43784d21ace6c2cecff5dddb9cf87750c9301ef49eaffc6d4fdc1703836becc4002a91c6ee9a9a402b0a20273f410e9a408f905 2b6cc14a427b833f583b1f5fab69855ed61a0ae3518a7e51743d9568f05a90797edafaeae6fdd2c6eb401b743b8c5ad434bf4189e2de8dedabdcdf9379ab71692d0f3f9658e92dfe07d4a05f11224c35c14bc83b0344b8fe352943a082ee06ce888489bf6fc0256dcbec020b717c369e6ea872562fa8736dee1413d6c6dd9531c7364b994c27b26480a4328a9bb9a4404fbe7726c854068e108f86338bd5f1a4534fadd1d15972effccb0b90e575fd8153480d1991395f490c01e8b6dad9f69a17d1a310170b15f75759a3d21c209b15c390478e053987323ee022d7804852e17bb1a6798d21976c3c5ee4312644b28b6f974eac6ff1d1db834426d0aa8618ac95054c1c1b085769a8c298d1e0abb499e761d11e56ff07bad43c4ae78c53a95a8dc2a730dfc7bbb9d7c759170c83b831b1640737081badc6f66874842d21858b412b05d62e3ac566d37bd8770195e34826fb4c351fd1075472f4e743255c4b1b9ec1c9d3d6aedfbd25c3fb7772592c3d2935e41c2807913ca9575c9c9c155de2c70debf1166cc6b06cadfbbe707d7ea3eb804359db08d78be557c5bbffe75c084be5a019bb282acdaa201ab8f44bed03da090bf83e39fa0567331d0afe0d31aa1ccf22fb407fc229584f81442b56fc83181af65a1488a5d6a232b4777f0203100385e7236d5e3cc456cee6397ca6420636a9848b33ba6092a2f2a45f68b88b8ffb4c9db8baa12dc53018aa74eacf61c8266bfb9433fe31be22c21caa6a16583c1dc15de08e82e4b73413794ee950b93938063e502641243e0bf794c5d2c4690c3ff78b295dc2dd40a446a74671b093b110f18e6eb5d2a40b545c6a5a5a60494e93ecde73d63730b1b34d534c9ab0aaa25c58a07a138bae78849b8edcb1ac360e544ae5c0880b5fc8adda26255862fc0365dd676affd379cb0b46a01550270010b611affd035d775cf81165c05edae63379dc0b4dbd25a7a4a1820e3ee18199051273c8fa17ab85301013d6b7354f34eccbe49b94174530aad38d59066bebbde95786e6266e574f38d077e162e5d36a20e99b34fbc60e4f3bfb0861a23d68d4386a8b988c56a4e727e10ad6c84774adc76d6ba6cde16032ccd30b24ec6baaa628 222036db1bcf8603053a222926586ff562cf5759e1d165383ee41b505fc2998a6731dd7cb8ac391040026bf0e8178540ddb9ec30cb988da176cd33b2eeb5c61006b535a488e88948d0b845166fdff383073b11d68c529dc89a06a250f4b3bc7119b05f4cd5c95e19fbb04ee7ce1ae003743a428897b5c5768617ddf2662e198984167c669a32474e14964c1c75b034d007a978a4ea4518c52657408a142b60aa52fe3ed21636701485e82e8753337f942ff060c42429c6a8ab3a9fcdea6a27f7ef76f2d1809a18bfd43b1f5da74a273f51c06507f5945d6fa9a273db883a8636f5feb52e353db15f4418bf94c2ae733999e7edf4ef5ea7d9b8f00cc67574e9d9860412cd6b5ca85ee1bc00ffda5c2d2f74aec2e0363b7509cbf22594e008120599d7f8d4a938e5fbc6d813fde2b650278c439aa8556fd5d6560a274c976e2b79bca16fab4d1ca96a6cbbd8d6cf67ca0a79a1280f1471da2e3ee8b7e63b61babec83493ff4425c1c434cd3926e18baf03962d446d440507c6a49f17cebabb5774a833588991ead6ed9da9645fafd8d70bac704ddfbfc4133310c8a6eedbe89b8fcd1ec518c73dc2262f0a6f6bc5f6d1d04fa350aad1f0d92accdcf1464732060a6a4ac7c920bf5f73dbb843eeb829904b9e46977d0fc54923747cc0debb7000f0b0c1c679bf92a80e441b4bf4a0ae21a64b60d3b7f44f607413e5b30833a5b75c9ebc014c7b981c1acff1b0bafcc16bd0c590c09f245cab89c625bc03fb4843a597d25b878613f575853fc4c58ce68a8d3041306d717952df3fbb3bd2e23c604ddfc5afe632ba39bcda0f322555d84806c52c35831909901b0642897e8ab71267304e78be30bb60e32ea16645f7a04f2dc0e6cd6a98b4dfa4103d26c4248c458f4db9f6a015c5bc784b667b6eb473ae232e3174879d17f66e5fccfac905b262810ce49602a7c07851938fd500f1d8376b0ea537d643460129aba2b0fb8de862428b0c6cc49129118673e0cb57e9ef685326d5e4b31498599446b1653ffa4726964b56861e2c561f7184343ba353c4673d92a85c6fa5201fcb60be6d4c5fc8d60c8ab75fb49183e81fee77df86fd7a3d68bdeea1f210b2cf8c278de2704205218744caaaa580343856579bbe93a2235281bf9998e9fd45117dc25f2b33b89cc36ea2a6143c0b16a5a71055dd8e942913429b20facebfde81102caa232410ef52c4c23b79c9292862adf3e2810dfae324e65334ca74f7fe569893af2e91aa8c512788f2ad985e5e6b7ef5932c389b7f72ee5a75dd6f9756437fd00ee6b29b3f93dc4898190591abf65ac1557e71019e37c5dfa8f6d60378c941ab2427d9c2a7a3355dd808ba41ff861bdba0308f1f7932d67fd2ce1784b6b2b777e8226688ac607c11f97097a90ce50239d1c43b69c2cbabb0083624f63e4848e295eb49e6a4d2442b849ce53984a8274bce38d22ff544e02f5da0d03c42f3591003f8c1536204350b829ec06602351e95d74a20d416e766a07d7a31b7c75c12cabf74be61fac0ae21d97052a61d034ad372a58b0ad8bfeb9c24f03a3cb4e59741c42c951b6bf3c1fe4c212b0959b095d62794560a4d754ea8b57789bc791a20b2d5f8b6915f3b83166eb8e66400a3e28ab679c256899f821016e8701851cd0095aa625dcf0a4ef028035d095c6f75f7dc7f60f06974cb57091b706ef28da05646f4eba1c1df4fee4e0c0585a2024c11288c7acd19e38bd78dd7692b9fb826e992042efbd7faba78084d18d83f81ac86bd4907ca1a4574ae9456f19d6a5a8845e15bf7cfefe7a92b20eb8d666c4e1a18e809e6d9f7fc611678ed67f84ff7aac987522aaf76a947ca6745133c5fa1e86b183c83ca7aeff86e854c78e36d960b3a0ad1390d47b92d3b16e08b36e7ed35160dbfbf44f1bbcc583405fdffcf0f59cea599b31adbd5eccdb74e8753290cd7adea2d1716031dcebecc32db55c6a47e2c926ef3848e3d8c72beb03c9096d35470f9610fb4e4a0293b7f99af165967c90bc7372032c2edb133a19fa97c05b3368c3c302058fc059706d0c3e17ab338a53b10606972307ef8401da23ad1672b4e4d596bf45728ed12eb8268d4f297e78416ba394ad3aff037dd510769caf4bd501be168d1fdf1457cbc7b84b69329c0da70e60dfcdbd85d32d6500f67ce1b9947b29c6cfa75794303eab5a7c9ff0629036aa3e745857ca5769e4f093f41b77aa6fdfb83e2438080483f7f2b79d4530638c991521785e73226c8 ################################################################################ # Division # p0 : Dividend as hex string # p1 : Divisor as hex string # p2 : Quotient as hex string # p3 : Remainder as hex string ################################################################################ Divide by zero mpi_div ffffffffffffffff 0 0 Z-1 Divide by one mpi_div ffffffffffffffff 1 ffffffffffffffff 0 Divide by bigger number mpi_div ffffffffffffffff 10000000000000000 0 ffffffffffffffff Divide positive by positive mpi_div 4f40f41445e639a25606 74fb17 ad7033d4afe923 6312e1 Divide negative by negative mpi_div 4f40f41445e639a25606 74fb17 ad7033d4afe923 6312e1 Divide negative by positive mpi_div -4f40f41445e639a25606 74fb17 -ad7033d4afe924 11e836 Divide positive by negative mpi_div 4f40f41445e639a25606 -74fb17 -ad7033d4afe924 11e836 ################################################################################ # Square (generic) # p0 : input value as hex string # p2 : square value ################################################################################ Square zero mpi_sqr 0 0 Square negative value mpi_sqr -ffffffffffffffff fffffffffffffffe0000000000000001 Square test #1 mpi_sqr 24652d5a2646a8fd9b92c281708d3ddb 52c9cbe2beee47c72af113101cb4adb7bf95ad3ddd78ce8716026c2d2301959 ################################################################################ # Square (baseline) # p0 : input value as hex string # p2 : square value ################################################################################ Square (baseline) zero mpi_sqr_baseline 0 0 Square (baseline) negative value mpi_sqr_baseline -ffffffffffffffff fffffffffffffffe0000000000000001 Square (baseline) test #1 mpi_sqr_baseline 24652d5a2646a8fd9b92c281708d3ddb 52c9cbe2beee47c72af113101cb4adb7bf95ad3ddd78ce8716026c2d2301959 ################################################################################ # Square (Comba) # p0 : input value as hex string # p2 : square value ################################################################################ Square (comba) zero mpi_sqr_comba 0 0 Square (comba) negative value mpi_sqr_comba -ffffffffffffffff fffffffffffffffe0000000000000001 Square (comba) test #1 mpi_sqr_comba 24652d5a2646a8fd9b92c281708d3ddb 52c9cbe2beee47c72af113101cb4adb7bf95ad3ddd78ce8716026c2d2301959 Square (comba) test #2 mpi_sqr_comba 4b607db88599c5246805a0eee8b69eaf0c5fc3b92ba17605a2f11ebfea4c8c49e077f789bc5e13b9fa09e8b6b30ed0828de51be0e04af432816c0b0096575bd3d49491c73fbf1b9b2792587b8571086e23f2f68a5bfd8341b2f607c68700a27dcd610f9ae972dcb34a014b46cda68bb8b32790eb7ac476bde9c7edc2be5f2ff1f940c743bcc8a56fe71558ad93e1951555b4d6f2e0d46eaad63f40bf6b92d234fa74e1a7cb2eb760abdd2c6db1eaeea51519dd972f8c589cfbe36e33c1f2ea96c6d72b5faf0e3752848259fec37843220130c4a7c122684d4c10c0eb75514c601db8a27b9715d143c29e305a5a13f621686290467b313ad68d5e249b40d48a883d38240c52c740411d514a30f17640fbcfd5bb824ba578ffa607ee12cb99c43f11e647585aec12da7fa5e87a5003e8c7639d573f8a44526c4f18a5c582364122c0e10d02803beb1c1caa0a446c56e722ee933e7d262c49a6c35e5f8ad43784d21ace6c2cecff5dddb9cf87750c9301ef49eaffc6d4fdc1703836becc4002a91c6ee9a9a402b0a20273f410e9a408f905 1631ae08a66a044fad8b65a4c8356ddb22ede5a07880d311aa3e448b020b5bbf57cecd830a6b72542fbe6d1396fbba60200177ceae5b33e152750800fd8b68e2f8773c487fc6aee757a224f8e591dabf57be3b5dc2a9e593bbbe06f5030a5b01c72bff6e01cdb71d6d996b024ec153fc7c9206cc24d577d39c521069df6a1406bc621d1631f875783e3633699adfc857b37e8f6ea4f6b61d2fb1748754ce757e9521a462d8f12babe256d05bec95f1968830eeb6b34790a1c1d0e5809e2c5eff2dbc51c074f289fa3b414225808286c92f355eed78e6503d7047f8a11f7dc42a886cea13b8b16fd2918fbf6b75a1d804a5cacca534c542dc982ae9f431a439f9fbd1db5051eaa8971a26482f7e113299f9b1b8dc6649cffe38f43655344dea03fd5ca46f37d70fe10acad498cec869d1b4a37e2789dd06843085b1dca7b9c8f918da4f21bf4e00ac9fad25ad8785d9aad8808758c6d70bd5a7ff88644e6efa4c1ae2d1ac467750b7ed8ef958159c7057970bd8ddcbcb916fec2d83dc25cf060add8a2b4bb7363bade362ec847305000498b66e04529f626d0836db490542aee397eface90108a1d1270c78b6002ca4b731d8e069d22222a44def7023a17552199081824360b75f00bfe800890591789db6ec0e053ad3a0f86913fc21136371238750faa2b79bc4a2ec6179957cf67545ac919ae0189ea63ab6549c4ae91f5ab5ee94aae2a5fb6a57a8de71d26c083c1452969182e53b0c9928b984a8a3919729a97ca6770a72029e3c3e5ffe6015ea81948871ec1758f9060319fb70f368acbf4c4dc0b7a6eb658d4dbd1a0573743a23d314ecf6a49acf7ea747126993ddf948ff44413f33c5258554686ce52f4ed5ea86703bcce7fb1589b5321e6890b1fef54bc6da3407c6b3e6365bfd7c35d4dc81e61c92861c434fe487af9bdbe1ee4f1498d7a70e150db3efc05564eacace5a7ea43f07d4aa15fe14c6163bb99d3d88a5f3d014a07925dbc62b0c68dbd25176f7f3918896922f25864038c5aebbe426fb1bbf64964b2404f7d9128dfd1742ad8c08d6d5e6af5a235ed3bbdcb9c245d83714788652b9757e3e5bca63c1b3d7e1fd6cf07fc68e0d02a650196a78ea8aba19 ################################################################################ # Square (Karatsuba) # p0 : input value as hex string # p2 : square value ################################################################################ Square (karatsuba) zero mpi_sqr_karatsuba 0 0 Square (karatsuba) negative value mpi_sqr_karatsuba -ffffffffffffffff fffffffffffffffe0000000000000001 Square (karatsuba) test #1 mpi_sqr_karatsuba 24652d5a2646a8fd9b92c281708d3ddb 52c9cbe2beee47c72af113101cb4adb7bf95ad3ddd78ce8716026c2d2301959 Square (karatsuba) 6400 bits mpi_sqr_karatsuba c92e20b990846a1037594736fd02ce34f1776d4c019b0d31c4b5bdb0df568ea2292223e70d6dad392d466500c8d18c1ea21b6433767cc0fa6d4ed344ae38b684c12ab8f06ee44c787e499fda204c4cbb835439ca93827b8f7449ccb624ec1b77837f6cc1d7ac8f8f607820a9bf210d38fa7af0abf8ca93bf9fbfa279246ff36aca41a2bcdf674b2e58e2bee6e1e565b279e4495980c871bc6b29eca61211ddef99c683ce43cddbd1b82a47b1d6d8aedb362acd86af6470be5f9345b4cfa744264e074a60275e81de16583688ca082b5f166b2ba8ed6fb23c88ba46c9a8ed0791628abab6bcc7291100ef301af30913f19e03f2d8c1be35972866aaf639cd7653f9944da1d1cd0174acd428b6859a7f65dfae0c2730bec684b08b8c687b0ca7b47e202c939850b0276062906dd331019190adfa8583882ee4f71584d3b2f866ad7218028eabec5a6909dfbcac7f3082da1b6c22e8fca64ee2544c52fb90a00311cd1d720aaa6bed75d056f8f289266a4e7dd45bdbe5ce97e9320ae5c8860fa2139ef621f88db43ee9d1994f431d4992d54b607db88599c5246805a0eee8b69eaf0c5fc3b92ba17605a2f11ebfea4c8c49e077f789bc5e13b9fa09e8b6b30ed0828de51be0e04af432816c0b0096575bd3d49491c73fbf1b9b2792587b8571086e23f2f68a5bfd8341b2f607c68700a27dcd610f9ae972dcb34a014b46cda68bb8b32790eb7ac476bde9c7edc2be5f2ff1f940c743bcc8a56fe71558ad93e1951555b4d6f2e0d46eaad63f40bf6b92d234fa74e1a7cb2eb760abdd2c6db1eaeea51519dd972f8c589cfbe36e33c1f2ea96c6d72b5faf0e3752848259fec37843220130c4a7c122684d4c10c0eb75514c601db8a27b9715d143c29e305a5a13f621686290467b313ad68d5e249b40d48a883d38240c52c740411d514a30f17640fbcfd5bb824ba578ffa607ee12cb99c43f11e647585aec12da7fa5e87a5003e8c7639d573f8a44526c4f18a5c582364122c0e10d02803beb1c1caa0a446c56e722ee933e7d262c49a6c35e5f8ad43784d21ace6c2cecff5dddb9cf87750c9301ef49eaffc6d4fdc1703836becc4002a91c6ee9a9a402b0a20273f410e9a408f905 9e1977b32bcec8c6e038ab000cd6f497d3419471dde4b01aadfe67c1240bd464657c4b892fe14222402c11fda5d6ac2b2ef94dbcc18f32c5ca8ae32a24210bd842a1c3e1821d5e0ad68e5f7ad6fd8009454dca6ede906455620cd6a8e8434b50403f115671cd667fb736971c42c9b0b843010f68276c267f34f10fc2c891d5854e34aa00703d5d87e81f56efafcc1ec6029c69cea20b61faa409c085653ce9464d1aebf1a462c4b7385ab13ca44f92715866ce0d64fbb9ced45efab94ee976acc29158268e9e4b95e3134fad1405432d793ac014d2b94c6679c4a9845ba243622a756c4698571210fe846d91920f86ef8c564d0207d77c512883db0f26f272fc13864cdda0d587a88e026776f31f61927aea7db2e0b57236a4403f6503cde7042f83828c5dec82c4aca9ea53666bf2598b5aac267edb3edf78a623617b4746d2f093f5edf90885259ec29bdf9f18d63d1550822671c3c8c0feec66a048cf5016aec73e08d09c9d0dbbcedc4fb62cc5221d6998924e28fd11a74321916a5188fda7660785c512043b96a068223c904ddff6655be46b7cd95547e8d867e127689e468485e779271921ce5e21edc0d73d1b02b28795aa9c9dd1de1ea29b449571255c850be3fdde25bc71ff1497024162fecf731d1bcd396d9083b8b480b5440b577b23713a81036294d76f088380ba9dd5d9d7b5b2c7e9e896085c146ef062a9def9f934765180e6ee3f3426b2cd53f3bca5e077273fd70b7ae648698d7a4c6cb78c3923107e4906d5a84cc157ef31612af265e05812f33d9c743be150c22c34138380bf5ba8d14cd75fbc4fbb886089afae2ba1c113b04ad0e9b721354a7f7e49c15e0a8db2ba1ec6dafcbf04124bff0c9e924b1d494384d0e56c5d722cee5797e2885fe8899a90a2657132a21e63d7a83bf83a818f7287dabbc791694553fd177b9e03eb7518231414e09497ea568b96f24784fb16909ea793903881f62fa19e6bd66424da61aeb6f51622aafbcaa10f04b8b11506ae3d9ffde66bc29b7e65f1b6ee04eda1cf234656d443b34601a71cdf1477947b91a006f2bf87491174fb3dfd6ef1764063cad433e8265433bec347fd84c1a3193449f3fd58f58609a0b265eeefb85df63ed811724f74792f6bb0845329dd160e340361ea38aa24bab94886d3b89253356e76b21ceebbf8099369423d0e06a4effbe28e4c3f5f8444834d560279cc9d8602c99fc8e26c5de2c8f4effab6974a4d847b0049eb9fa305bdb805f5a31dab955ce2e3d1a081d0bde90d619a004270aff3a683804b4e240fb6e92a4809e4726ba08bec2f2cb227b3c3123b31bc2ca41a43dcc31bd128f85277173d2351926f5b4d252f54090f6d53d0e76d5db15c4e868b13793eae792989c38c81093a17b1a37f39ade2f126fad568398312c655e8e30c1ba47519a7f7ce845895a0216df70889e94e7ed5baf3cb7ae22698a9aa7b3d726df14fccec390bced9488223739bbaab2e11529606e87e6b1cfd6adbec010f162016c135d2b717ccb43d901679890c64b827d27cb2dd77b5e9d033dea5817b86aabe0417bab93dd7253ae96139393e8cb1ac66e90f8390f89268a0ffb88d50f9da3e31ab1f8022f5a75515449cbb83cfeafe088817f87a70d1c53ce010f18d70085a9a5b5f5b04ed578d45a2cc4c48e38b0307989490ccd7165698b66e04529f626d0836db490542aee397eface90108a1d1270c78b6002ca4b731d8e069d22222a44def7023a17552199081824360b75f00bfe800890591789db6ec0e053ad3a0f86913fc21136371238750faa2b79bc4a2ec6179957cf67545ac919ae0189ea63ab6549c4ae91f5ab5ee94aae2a5fb6a57a8de71d26c083c1452969182e53b0c9928b984a8a3919729a97ca6770a72029e3c3e5ffe6015ea81948871ec1758f9060319fb70f368acbf4c4dc0b7a6eb658d4dbd1a0573743a23d314ecf6a49acf7ea747126993ddf948ff44413f33c5258554686ce52f4ed5ea86703bcce7fb1589b5321e6890b1fef54bc6da3407c6b3e6365bfd7c35d4dc81e61c92861c434fe487af9bdbe1ee4f1498d7a70e150db3efc05564eacace5a7ea43f07d4aa15fe14c6163bb99d3d88a5f3d014a07925dbc62b0c68dbd25176f7f3918896922f25864038c5aebbe426fb1bbf64964b2404f7d9128dfd1742ad8c08d6d5e6af5a235ed3bbdcb9c245d83714788652b9757e3e5bca63c1b3d7e1fd6cf07fc68e0d02a650196a78ea8aba19 ################################################################################ # Exponentiation (Binary) # p0 : base # p1 : exponent # p2 : result ################################################################################ Exp 0^0 mpi_exp 0 0 1 Exp 0^3 mpi_exp 0 3 0 Exp 1^0 mpi_exp 1 0 1 Exp negative exponent mpi_exp aa -bb Z-1 Exp test negative base (even pow) mpi_exp -a229253d93c944fc43566ac26a1986 4 293738e921395f1204f786c8e86f03fad2b6bf6bc61101234fd3e26154abee5a1d1808711603c9c44cd65ecebe43eb9aeef6f7251b74fce32bbc1510 Exp test negative base (odd pow) mpi_exp -a229253d93c944fc43566ac26a1986 3 -411102b83b971ddfd122b9130ba8d96c89237b8355d3572affead9633d22b36321cc6203f57db0c7b693db42d8 Exp test huge mpi_exp a229253d93c944fc43566ac26a1986 30 14d7bb1fdade0b6777acca09ce7a6c8eb05712d6d5095f32a72e676c74457a9505b6edffa669aa76dd44e9cc0227ff05e7a4deca7373e6f0277c433779953d9601600789abb903d348546908216ffee0ef49bd009869746314a8938510b8dd0ff577d9f2328736d063ef2db26efc2ba08fea3a3dc7420234f0eee96aca616c8f32c70739a62f8acdd124988185cd2a8cfc676a77283d91fe224ac2ba210b9be462f965bd31de90da961da4e76f493d65623e53245a06ed05a879376551eb891cb94c7b2d1b0f204c3fd24edae77151e09e66079e4692038b18feffe37fb0690d4589703e2e904c431d4e6310aa4131e31ec1835435c900d8e4e6c7b68b61b9ada4af220bb27c68e07ad6bb738d1c40f50ee21cf9b170699fc5324ca78c00d0bcf0d3b96fca607ea3d860d4c5a1d36ae31bf1576638c40b07924aa434400d296e1d15eb757f0459a25d704e7d1fe310f26f1e87f41fed31ef29974ebf68b1324a8f3dea7ff596bd7b5cd68bfc9a802fb2e88eced504195822078167e1abd29818b8af6b5a2ec79b29060b14a57acc3223f0855608f0cadc138aafc347253cb9efded0f79cfe4e1254b4ea7c5029b81318315d49bd31b132a6d919721e5015c389471d377b15bedf10288f978bdc0c49318420c1ed3c75b6e69aa3099c947be90d6b0a491a97f8f3baec64c75bdac33f89291b56cde1d033a6b4305ba739d534818d37daae5d38a63bc9983774da903c20b45bd4443599f6e05c43aa62e474194f0b1802cb0a6400682c2cd8fc204f21dfdeb81d44bcd818b85a87ed3c9e1b17ea7a88531f77eb3a2a693679ab8b93688fc362798380540c3efe50a82aa7a5d62e401e9944b6641f8f3e644446873cc477182670ec282e9c824377c9d8e02f8150a75f2eaf2fbbf14b60b4f66b62798d59b55ae2cd4f4c7ddf87a737ff05c9f531e1445388fc18400346074704bf136ba6ffc9e857f6fc9aa398c92d3bc77754565d0e3681881c1000000000000 ################################################################################ # Modular Exponentiation (Binary) # p0 : base # p1 : exponent # p2 : modulo # p3 : result ################################################################################ Mod-Exp negative exponent mpi_mod_exp aa -bb cc Z-1 Mod-Exp negative modulo mpi_mod_exp aa bb -cc Z-1 Mod-Exp zero modulo mpi_mod_exp aa bb 0 Z-1 Exp test positive base, even exponent, mod 1 mpi_mod_exp a229253d93c944fc43566ac26a1986 4 1 0 Exp test positive base, odd exponent, mod 1 mpi_mod_exp a229253d93c944fc43566ac26a1986 3 1 0 Exp test positive base, even exponent mpi_mod_exp a229253d93c944fc43566ac26a1986 4320 e61e910917b59098227918ca1da479df17683dd2 bfbc68970341b41013377a7077f0dcaa8f843aa8 Exp test positive base, odd exponent mpi_mod_exp a229253d93c944fc43566ac26a1986 4321 e61e910917b59098227918ca1da479df17683dd2 52afc7d51a54654397ab299411758b6de8d14390 Exp test negative base, even exponent, mod 1 mpi_mod_exp -a229253d93c944fc43566ac26a1986 4 1 0 Exp test negative base, odd exponent, mod 1 mpi_mod_exp -a229253d93c944fc43566ac26a1986 3 1 0 Exp test negative base, even exponent mpi_mod_exp -a229253d93c944fc43566ac26a1986 4320 e61e910917b59098227918ca1da479df17683dd2 bfbc68970341b41013377a7077f0dcaa8f843aa8 Exp test negative base, odd exponent mpi_mod_exp -a229253d93c944fc43566ac26a1986 4321 e61e910917b59098227918ca1da479df17683dd2 936ec933fd612b548acdef360c2eee712e96fa42