{"id":370826,"date":"2024-05-21T04:34:31","date_gmt":"2024-05-21T04:34:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=370826"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=370826","title":{"rendered":"<span>\u041f\u0442\u0438\u0446\u0443 \u0443\u0437\u043d\u0430\u044e\u0442 \u043f\u043e \u043f\u0435\u0440\u044c\u044f\u043c\u2026 \u0438\u043b\u0438 \u043f\u0440\u043e\u0444\u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0441\u043f\u0430\u043c\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0427\u0430\u0441\u0442\u043e \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0441\u0435\u0431\u044f (\u0432 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435), \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u0443\u0447\u0443 \u0441\u043f\u0430\u043c\u0430 (\u0430\u0445 \u044d\u0442\u0438 \u0434\u0440\u0435\u0432\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u044b).<br \/>  \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0449\u0435\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u2014 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0446\u0435\u043d\u0437 \u0432 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u2014 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u0434\u0430\u0441\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u00ab\u043d\u0435\u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u044b\u043c\u00bb.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0438\u0442\u0435 \u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043e\u0434\u043d\u0443 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0430\u0441\u0441\u0438\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f RSA \u2014 \u0447\u0442\u043e \u043b\u0435\u0436\u0438\u0442 \u0432 \u0435\u0451 \u043e\u0441\u043d\u043e\u0432\u0435?<br \/>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u0430\u043a\u0442:<br \/>  \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u0430 <b>m <\/b>\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u042d\u0439\u043b\u0435\u0440\u0430 <b>E(m)<\/b>, <br \/>  \u0442\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e <b>a != 0<\/b> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <b>a ^ E(m) % m = 1<\/b><\/p>\n<p>  \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0435\u0441\u043b\u0438 <b>p<\/b> \u0438 <b>E(m)<\/b> \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 <b>c<\/b> \u0438 <b>d<\/b>, \u0442\u0430\u043a\u0438\u0435 \u0447\u0442\u043e <b>c*p + d*E(m) = 1<\/b>, \u0438 <b>s = c % E(m)<\/b><br \/>  \u0442\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e <b>a<\/b> \u0438\u0437 <b>[0,m)<\/b> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <b>a ^ (s*p) % m = a<\/b><\/p>\n<p>  \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u044d\u0442\u0438\u043c.<br \/>  \u041d\u0430\u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043a\u0443 \u043d\u0430 js (\u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0435 \u044d\u0442\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0437\u043d\u0430\u044e\u0442 \u043a\u0430\u043a \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c)<\/p>\n<pre><code class=\"javascript\">function split(x) {     for (let i = 2n; i * i &lt;= x; i++) {         let j = x \/ i;         if (i * j == x) return [i, j];     } }  function toPrimes(x) {     let arr = [x];     let primes = [];     while (arr.length > 0) {         let x = arr.pop();         let s = split(x);         if (s) s.forEach(y => arr.push(y));         else primes.push(x);     }     primes.sort((a, b) => a &lt; b ? -1 : a > b ? 1 : 0);     return primes; }  function euler(p) {     let z = 1n;     let map = new Map();      p.forEach(x => {         let value = 0n;         if (map.has(x)) { value = map.get(x); map.delete(x); }         value++;         map.set(x, value);     });     for (let [key, value] of map.entries()) {         z *= pow(key, value) - 1n;     }     return z; }  function xgcd(a, b) {     if (!b) return [1n, 0n];     let [c, d] = xgcd(b, a % b);     let q = a \/ b;     return [d, c - d * q]; }  function pow(x, y) {     if (!y) return 1n;     let h = y \/ 2n;     let z = pow(x, h);     let r = (z * z);     if (y % 2n) r = (r * x);     return r; }  function powmod(x, y, m) {     if (!y) return 1n;     let h = y \/ 2n;     let z = powmod(x, h, m);     let r = (z * z) % m;     if (y % 2n) r = (r * x) % m;     return r; }  let p = 3n; let q = 11n; let m = pow(10n, q) + 1n;  let primes = toPrimes(m); let z = euler(primes); let primes2 = toPrimes(z); while (primes2.find(x => (p \/ x) * x == p)) p += 2n; let [c, d] = xgcd(p, z);  let s = c >= 0n ? c : (z + c);  function get(x) {     let t = powmod(x, s, m);     console.log(`(${t} ** ${p}) % (10 ** ${q} + 1) =`, powmod(t, p, m)); }  console.assert(powmod(275491122648n, 7n, pow(10n, 13n) + 1n) == 81234567890n);  get(81234567890n); <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<\/p>\n<p>  <code>(83735460521 ** 13) % (10 ** 11 + 1) = 81234567890n<\/code><\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0430\u044f?<\/p>\n<p>  UPD.<br \/>  \u0425\u0430-\u0445\u0430 \u2014 \u0441\u0443\u0434\u044f \u043f\u043e \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 (-4 \u043d\u0430 17.03.2024) \u2014 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0430\u044f\u2026<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/800345\/\"> https:\/\/habr.com\/ru\/articles\/800345\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0427\u0430\u0441\u0442\u043e \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430 \u0441\u0435\u0431\u044f (\u0432 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435), \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u0443\u0447\u0443 \u0441\u043f\u0430\u043c\u0430 (\u0430\u0445 \u044d\u0442\u0438 \u0434\u0440\u0435\u0432\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u044b).<br \/>  \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0449\u0435\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u2014 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0446\u0435\u043d\u0437 \u0432 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u2014 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u0434\u0430\u0441\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u00ab\u043d\u0435\u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u044b\u043c\u00bb.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0438\u0442\u0435 \u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-370826","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/370826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=370826"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/370826\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=370826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=370826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=370826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}