1<!DOCTYPE html> 2<html lang="en-US"> 3 4 <head> 5 <meta charset='utf-8'> 6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 7 <meta name="viewport" content="width=device-width,maximum-scale=2"> 8 <link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style.css?v=f0d989500882a1470729d1b2d69aaaf9c3bbed84"> 9 10<!-- Begin Jekyll SEO tag v2.8.0 --> 11<title>zcc31415926.github.io</title> 12<meta name="generator" content="Jekyll v3.9.3" /> 13<meta property="og:title" content="zcc31415926.github.io" /> 14<meta property="og:locale" content="en_US" /> 15<link rel="canonical" href="https://zcc31415926.github.io/Contents/blogs/diffie_hellman/diffie_hellman.html" /> 16<meta property="og:url" content="https://zcc31415926.github.io/Contents/blogs/diffie_hellman/diffie_hellman.html" /> 17<meta property="og:site_name" content="zcc31415926.github.io" /> 18<meta property="og:type" content="website" /> 19<meta name="twitter:card" content="summary" /> 20<meta property="twitter:title" content="zcc31415926.github.io" />
21<script type="application/ld+json"> 22{"@context":"https://schema.org","@type":"WebPage","headline":"zcc31415926.github.io","url":"https://zcc31415926.github.io/Contents/blogs/diffie_hellman/diffie_hellman.html"}</script>
22 23<!-- End Jekyll SEO tag --> 24 25 <!-- start custom head snippets, customize with your own _includes/head-custom.html file --> 26 27<!-- Setup Google Analytics --> 28 29 30 31<!-- You can set your favicon here --> 32<!-- link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" --> 33 34<!-- end custom head snippets --> 35 36 </head> 37 38 <body> 39 40 <!-- HEADER --> 41 <div id="header_wrap" class="outer"> 42 <header class="inner"> 43 44 45 <h1 id="project_title">zcc31415926.github.io</h1> 46 <h2 id="project_tagline"></h2> 47 48 49 </header> 50 </div> 51 52 <!-- MAIN CONTENT --> 53 <div id="main_content_wrap" class="outer"> 54 <section id="main_content" class="inner"> 55 <head> 56
56<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
56 57
57<script type="text/x-mathjax-config"> 58 MathJax.Hub.Config({ 59 tex2jax: { 60 skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'], 61 inlineMath: [['$','$']] 62 } 63 }); 64 </script>
64 65</head> 66 67<h1 id="discussion-the-diffie-hellman-key-exchange-algorithm">Discussion: The Diffie-Hellman Key-Exchange Algorithm</h1> 68 69<p><a href="/">Return to main</a></p> 70 71<p><a href="/Contents/blogs.html">Return</a></p> 72 73<p>The Diffie-Hellman algorithm is a key-exchange algorithm for safe communications in networks. 74The algorithm is as follows:</p> 75<ol> 76 <li>the sender sets a prime number $p$, a base number $g$ and a random number $a$</li> 77 <li>the sender calculates $A=g^a\%p$</li> 78 <li>the sender sends $p$, $g$ and $A$ to the receiver</li> 79 <li>the receiver sets a random number $b$</li> 80 <li>the receiver calculates $B=g^b\%p$ and $s1=A^b\%p$</li> 81 <li>the receiver sends $B$ to the sender</li> 82 <li>the sender calculates $s2=B^a\%p$</li> 83 <li>$s1 \equiv s2 = s$, and the shared key is set $s$</li> 84</ol> 85 86<p>In the algorithm, $A$ and $B$ are named public keys; $a$ and $b$ are named private keys. 87In communications, private keys are hidden and unknown to other users; 88public keys are transmitted through the network. 89However, with only public keys, $p$ and $g$, $s$ cannot be determined. 90The sender and the receiver can cooperate to determine a shared key without knowledge of each otherâs private key.</p> 91 92<p>Proof of the algorithm:</p> 93 94<p>let $x$ and $y$ be two positive integers that satisfy:</p> 95 96\[g^a = px + A \\ 97g^b = py + B\] 98 99<p>then,</p> 100 101\[A^b = (g^a-px)^b \\ 102A^b\%p = (g^{ab}-C_b^1\times g^{a(b-1)}px+C_b^2\times g^{a(b-2)}(px)^2+\cdots)\%p = g^{ab}\%p\] 103 104<p>Similarly,</p> 105 106\[B^a\%p = g^{ab}\%p\] 107 108<p>Therefore, $s1 \equiv s2$.</p> 109 110<p><a href="/Contents/blogs.html">Return</a></p> 111 112<p><a href="/">Return to main</a></p> 113 114 </section> 115 </div> 116 117 <!-- FOOTER --> 118 <div id="footer_wrap" class="outer"> 119 <footer class="inner"> 120 121 <p>Published with <a href="https://pages.github.com">GitHub Pages</a></p> 122 </footer> 123 </div> 124 </body> 125</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.