{"id":2309,"date":"2024-11-26T22:48:22","date_gmt":"2024-11-26T14:48:22","guid":{"rendered":"https:\/\/pjq.me\/?p=2309"},"modified":"2025-11-13T13:26:01","modified_gmt":"2025-11-13T05:26:01","slug":"square-and-multiply","status":"publish","type":"post","link":"https:\/\/pjq.me\/?p=2309","title":{"rendered":"Square and Multiply"},"content":{"rendered":"\n<p>\u5728\u5bc6\u7801\u5b66\u4e2d\u7ecf\u5e38\u770b\u5230a^b mod n\u8fd0\u7b97\uff0c\u5f53b\u5f88\u5927\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u80fd\u591f\u6309\u7167\u7b80\u5355\u7684\u6570\u5b66\u8fd0\u7b97\u8fdb\u884c\u4e86\u3002<\/p>\n\n\n\n<p>&#8220;Square and Multiply&#8221;\u5c31\u662f\u4e00\u79cd\u7a8d\u95e8\u3002<\/p>\n\n\n\n<p>\u628a\u6307\u6570\u8f6c\u6362\u62102\u8fdb\u5236\uff0c\u4ece\u5de6\u5230\u53f3\u5f00\u59cb\u8ba1\u7b97<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5f53\u6307\u6570\u4e8c\u8fdb\u5236\u4e3a1\u65f6 z^2*a mod n<\/li>\n\n\n\n<li>\u5f53\u6307\u6570\u4e8c\u8fdb\u5236\u4e3a0\u65f6 z^2 mod n<\/li>\n<\/ul>\n\n\n\n<p>\u5176\u4e2dz\u4e3a\u4e0a\u4e00\u4e2a\u6307\u6570\u4e8c\u8fdb\u5236\u8ba1\u7b97\u7ed3\u679c(\u4ece\u5de6\u5230\u53f3)\uff0c\u521d\u59cb\u4e3a1<\/p>\n\n\n\n<p>\u4e3e\u4f8ba^b mod 21 = 3^11 mod 21 = 3^1011 mod 21<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>z = 1<\/li>\n\n\n\n<li>z = z^2*a = 1^2 * 3 mod 21 = 3<\/li>\n\n\n\n<li>z = z^2 mod n = 3^2 mod 21 = 9<\/li>\n\n\n\n<li>z = z^2 mod n = 9^2 * 3 mod 21 = 12<\/li>\n\n\n\n<li>z= z^2 *a mod n = 12^2 * 3 mod 21 = 12<\/li>\n<\/ul>\n\n\n\n<p>\u6240\u4ee5\u6700\u7ec8\u7ed3\u679c:3^11 mod 21 = 12<\/p>\n\n\n\n<p>\u5f53\u7136\u8fd9\u79cd\u65b9\u5f0f\u4e5f\u5b58\u5728\u4e00\u4e9b\u5b89\u5168\u95ee\u9898 &#8211; Power consumption of an RSA decryption<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.chegg.com\/homework-help\/questions-and-answers\/716-let-us-investigate-side-channel-attacks-rsa-simple-imple-mentation-rsa-without-counter-q74047610#question-transcript\">https:\/\/www.chegg.com\/homework-help\/questions-and-answers\/716-let-us-investigate-side-channel-attacks-rsa-simple-imple-mentation-rsa-without-counter-q74047610#question-transcript<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p>Reference<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>https:\/\/scientia-potentia-est.com\/zh\/square-multiply-algorithm\/<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5bc6\u7801\u5b66\u4e2d\u7ecf\u5e38\u770b\u5230a^b mod n\u8fd0\u7b97\uff0c\u5f53b\u5f88\u5927\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u80fd\u591f\u6309\u7167\u7b80\u5355\u7684\u6570\u5b66\u8fd0\u7b97\u8fdb\u884c\u4e86\u3002 &#8220;Square and Multiply&#8221;\u5c31\u662f\u4e00\u79cd\u7a8d\u95e8\u3002 \u628a\u6307\u6570\u8f6c\u6362\u62102\u8fdb\u5236\uff0c\u4ece\u5de6\u5230\u53f3\u5f00\u59cb\u8ba1\u7b97 \u5176\u4e2dz\u4e3a\u4e0a\u4e00\u4e2a\u6307\u6570\u4e8c\u8fdb\u5236\u8ba1\u7b97\u7ed3\u679c(\u4ece\u5de6\u5230\u53f3)\uff0c\u521d\u59cb\u4e3a1 \u4e3e\u4f8ba^b mod 21 = 3^11 mod 21 = 3^1011 mod 21 \u6240\u4ee5\u6700\u7ec8\u7ed3\u679c:3^11 mod 21 = 12 \u5f53\u7136\u8fd9\u79cd\u65b9\u5f0f\u4e5f\u5b58\u5728\u4e00\u4e9b\u5b89\u5168\u95ee\u9898 &#8211; Power consumption of an RSA decryption Reference<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[270,169],"tags":[268,228,264],"class_list":["post-2309","post","type-post","status-publish","format-standard","hentry","category-cryptography","category-tech","tag-asymmetric-encryption","tag-cryptography","tag-rsa"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Square and Multiply - Jianqing&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pjq.me\/?p=2309\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Square and Multiply - Jianqing&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u5728\u5bc6\u7801\u5b66\u4e2d\u7ecf\u5e38\u770b\u5230a^b mod n\u8fd0\u7b97\uff0c\u5f53b\u5f88\u5927\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u80fd\u591f\u6309\u7167\u7b80\u5355\u7684\u6570\u5b66\u8fd0\u7b97\u8fdb\u884c\u4e86\u3002 &#8220;Square and Multiply&#8221;\u5c31\u662f\u4e00\u79cd\u7a8d\u95e8\u3002 \u628a\u6307\u6570\u8f6c\u6362\u62102\u8fdb\u5236\uff0c\u4ece\u5de6\u5230\u53f3\u5f00\u59cb\u8ba1\u7b97 \u5176\u4e2dz\u4e3a\u4e0a\u4e00\u4e2a\u6307\u6570\u4e8c\u8fdb\u5236\u8ba1\u7b97\u7ed3\u679c(\u4ece\u5de6\u5230\u53f3)\uff0c\u521d\u59cb\u4e3a1 \u4e3e\u4f8ba^b mod 21 = 3^11 mod 21 = 3^1011 mod 21 \u6240\u4ee5\u6700\u7ec8\u7ed3\u679c:3^11 mod 21 = 12 \u5f53\u7136\u8fd9\u79cd\u65b9\u5f0f\u4e5f\u5b58\u5728\u4e00\u4e9b\u5b89\u5168\u95ee\u9898 &#8211; Power consumption of an RSA decryption Reference\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pjq.me\/?p=2309\" \/>\n<meta property=\"og:site_name\" content=\"Jianqing&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-26T14:48:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T05:26:01+00:00\" \/>\n<meta name=\"author\" content=\"pengjianqing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pengjianqing\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pjq.me\/?p=2309#article\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/?p=2309\"},\"author\":{\"name\":\"pengjianqing\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"headline\":\"Square and Multiply\",\"datePublished\":\"2024-11-26T14:48:22+00:00\",\"dateModified\":\"2025-11-13T05:26:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pjq.me\/?p=2309\"},\"wordCount\":67,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"keywords\":[\"Asymmetric Encryption\",\"Cryptography\",\"RSA\"],\"articleSection\":[\"Cryptography\",\"Tech\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pjq.me\/?p=2309#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pjq.me\/?p=2309\",\"url\":\"https:\/\/pjq.me\/?p=2309\",\"name\":\"Square and Multiply - Jianqing&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/#website\"},\"datePublished\":\"2024-11-26T14:48:22+00:00\",\"dateModified\":\"2025-11-13T05:26:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/pjq.me\/?p=2309#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pjq.me\/?p=2309\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pjq.me\/?p=2309#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/pjq.me\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Square and Multiply\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pjq.me\/#website\",\"url\":\"https:\/\/pjq.me\/\",\"name\":\"Jianqing&#039;s Blog\",\"description\":\"Thoughts and Future\",\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/pjq.me\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\",\"name\":\"pengjianqing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"contentUrl\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"width\":460,\"height\":752,\"caption\":\"pengjianqing\"},\"logo\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/pjq.me\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Square and Multiply - Jianqing&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pjq.me\/?p=2309","og_locale":"en_US","og_type":"article","og_title":"Square and Multiply - Jianqing&#039;s Blog","og_description":"\u5728\u5bc6\u7801\u5b66\u4e2d\u7ecf\u5e38\u770b\u5230a^b mod n\u8fd0\u7b97\uff0c\u5f53b\u5f88\u5927\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u80fd\u591f\u6309\u7167\u7b80\u5355\u7684\u6570\u5b66\u8fd0\u7b97\u8fdb\u884c\u4e86\u3002 &#8220;Square and Multiply&#8221;\u5c31\u662f\u4e00\u79cd\u7a8d\u95e8\u3002 \u628a\u6307\u6570\u8f6c\u6362\u62102\u8fdb\u5236\uff0c\u4ece\u5de6\u5230\u53f3\u5f00\u59cb\u8ba1\u7b97 \u5176\u4e2dz\u4e3a\u4e0a\u4e00\u4e2a\u6307\u6570\u4e8c\u8fdb\u5236\u8ba1\u7b97\u7ed3\u679c(\u4ece\u5de6\u5230\u53f3)\uff0c\u521d\u59cb\u4e3a1 \u4e3e\u4f8ba^b mod 21 = 3^11 mod 21 = 3^1011 mod 21 \u6240\u4ee5\u6700\u7ec8\u7ed3\u679c:3^11 mod 21 = 12 \u5f53\u7136\u8fd9\u79cd\u65b9\u5f0f\u4e5f\u5b58\u5728\u4e00\u4e9b\u5b89\u5168\u95ee\u9898 &#8211; Power consumption of an RSA decryption Reference","og_url":"https:\/\/pjq.me\/?p=2309","og_site_name":"Jianqing&#039;s Blog","article_published_time":"2024-11-26T14:48:22+00:00","article_modified_time":"2025-11-13T05:26:01+00:00","author":"pengjianqing","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pengjianqing","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pjq.me\/?p=2309#article","isPartOf":{"@id":"https:\/\/pjq.me\/?p=2309"},"author":{"name":"pengjianqing","@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"headline":"Square and Multiply","datePublished":"2024-11-26T14:48:22+00:00","dateModified":"2025-11-13T05:26:01+00:00","mainEntityOfPage":{"@id":"https:\/\/pjq.me\/?p=2309"},"wordCount":67,"commentCount":0,"publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"keywords":["Asymmetric Encryption","Cryptography","RSA"],"articleSection":["Cryptography","Tech"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pjq.me\/?p=2309#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pjq.me\/?p=2309","url":"https:\/\/pjq.me\/?p=2309","name":"Square and Multiply - Jianqing&#039;s Blog","isPartOf":{"@id":"https:\/\/pjq.me\/#website"},"datePublished":"2024-11-26T14:48:22+00:00","dateModified":"2025-11-13T05:26:01+00:00","breadcrumb":{"@id":"https:\/\/pjq.me\/?p=2309#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pjq.me\/?p=2309"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/pjq.me\/?p=2309#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pjq.me\/"},{"@type":"ListItem","position":2,"name":"Square and Multiply"}]},{"@type":"WebSite","@id":"https:\/\/pjq.me\/#website","url":"https:\/\/pjq.me\/","name":"Jianqing&#039;s Blog","description":"Thoughts and Future","publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pjq.me\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60","name":"pengjianqing","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/","url":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","contentUrl":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","width":460,"height":752,"caption":"pengjianqing"},"logo":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/"},"url":"https:\/\/pjq.me\/?author=1"}]}},"views":1463,"_links":{"self":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/2309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2309"}],"version-history":[{"count":3,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/2309\/revisions"}],"predecessor-version":[{"id":2313,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/2309\/revisions\/2313"}],"wp:attachment":[{"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}