{"id":2341,"date":"2023-05-08T19:26:51","date_gmt":"2023-05-08T19:26:51","guid":{"rendered":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/?post_type=chapter&#038;p=2341"},"modified":"2025-02-14T17:50:32","modified_gmt":"2025-02-14T17:50:32","slug":"cryptography-learn-it-7","status":"web-only","type":"chapter","link":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/chapter\/cryptography-learn-it-7\/","title":{"raw":"Cryptography: Learn It 7","rendered":"Cryptography: Learn It 7"},"content":{"raw":"<h2>The Key Exchange (Diffie-Hellman-Merkle Key Exchange)<\/h2>\r\n<p>Having a better understanding of modulus and the one-way function provides us the basis for our key exchange.\u00a0Think of this like Alice and Bob trying to create a secret handshake without ever meeting in person, while others are watching them. Here's how it works:<\/p>\r\n<ol class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">Alice and Bob start by agreeing on two public numbers that everyone can see:\r\n\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">A prime number [latex]p[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">A base number [latex]g[\/latex] (called a generator)<\/li>\r\n<\/ul>\r\n<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Then, they each choose their own secret number:\r\n\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">Alice picks number [latex]a[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Bob picks number [latex]b[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">They never tell anyone these numbers!<\/li>\r\n<\/ul>\r\n<\/li>\r\n\t<li class=\"whitespace-normal break-words\">They each do a calculation and share the result:\r\n\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">Alice calculates [latex]A=g^{a} \\bmod p[\/latex] and sends [latex]A[\/latex] to Bob<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Bob calculates [latex]B=g^{b} \\bmod p[\/latex] and sends [latex]B[\/latex] to Alice<\/li>\r\n<\/ul>\r\n<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Finally, they each do one more calculation:\r\n\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">Alice takes Bob's number and calculates [latex]B^{a} \\bmod p[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Bob takes Alice's number and calculates [latex]A^{b} \\bmod p[\/latex]<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<p>The modular exponent power rule tells us [latex]\\left(g^{a} \\bmod p\\right)^{b} \\bmod p=\\left(g^{b} \\bmod p\\right)^{a} \\bmod p[\/latex]. This means they both end up with the same secret number, even though they never shared their secret numbers with each other!\u00a0\u00a0<\/p>\r\n<p>Let's see this with real numbers.<\/p>\r\n<section class=\"textbox example\">Alice and Bob publically share a generator and prime modulus. In this case, we\u2019ll use [latex]3[\/latex] as the generator and [latex]17[\/latex] as the prime.<br \/>\r\n[reveal-answer q=\"4330\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4330\"]<br \/>\r\n<p style=\"text-align: center;\">[latex]\\begin{array}{llll} &amp; \\textbf{Alice} &amp; &amp; \\textbf{Bob} \\\\ \\text{Alice and Bob publically} &amp; g=3, p=17 &amp; \\text{Common info} &amp; g=3, p=17 \\\\ \\text{share a generator and prime} &amp; &amp; &amp; \\\\ \\text{modulus.} &amp; &amp; &amp; \\\\ \\text{Each then secretly picks a} &amp; n = 8 &amp; \\text{secret number} &amp; n=6 \\\\ \\text{number n of their own.} &amp; &amp; &amp; \\\\ \\text{Each calculates } g^n \\bmod p &amp; 3^{8} \\bmod 17=16 &amp; &amp; 3^{6} \\bmod 17=15 \\\\ \\text{They then exchange these} &amp; A=16 &amp; &amp; B=15 \\\\ \\text{resulting values.} &amp; B=15 &amp; &amp; A=16\\\\ \\text{Each then raises the value} &amp; B^{n} \\bmod p= &amp; \\text{mix in secret} &amp; A^{n} \\bmod p=\\\\ \\text{they received to the power of } &amp; &amp; \\text{number} &amp; \\\\ \\text{their secret }n \\bmod p &amp; 15^{8} \\bmod 17=1 &amp; &amp; 16^{6} \\bmod 17=1\\\\ \\text{The result is the shared secret key.} &amp; 1 &amp; \\text{shared secret key} &amp; 1 \\end{array}[\/latex]<\/p>\r\n<p>The shared secrets come out the same because of the modular exponent power rule:<\/p>\r\n<p style=\"text-align: center;\">[latex]\\left(a^{b} \\bmod n\\right)^{c} \\bmod n=\\left(a^{c} \\bmod n\\right)^{b} \\bmod n[\/latex].<\/p>\r\n<p>Alice computed [latex]\\left(3^{6} \\bmod 17\\right)^{8} \\bmod 17[\/latex] while Bob computed [latex]\\left(3^{8} \\bmod 17\\right)^{6} \\bmod 17[\/latex], which the rule says will give the same results. Notice that even if a snooper were to obtain both exchanged values [latex]A = 16[\/latex] and [latex]B = 15[\/latex], there is no way they could obtain the shared secret key from these without having at least one of Alice or Bob\u2019s secret numbers. There is no easy way to obtain the secret numbers from the shared values, since the function was a one-way function.<\/p>\r\n\r\n[\/hidden-answer]<\/section>\r\n<h2>RSA<\/h2>\r\n<p>RSA is one of the most widely used methods in modern cryptography. It uses a public-private key system where anyone can encrypt a message using your public key, but only you can decrypt it with your private key. This is similar to having a special lock where copies of the public key can be freely distributed - anyone can use it to secure a message, but only the holder of the private key can unlock and read those messages.<\/p>\r\n<p>The security of RSA relies on a fundamental principle in mathematics: the difficulty of factoring large numbers into their prime components. For example, while it's straightforward to multiply [latex]53[\/latex] times [latex]59[\/latex] to get [latex]3127[\/latex], finding the original prime factors of [latex]12,317[\/latex] is considerably more challenging. This difficulty increases exponentially when working with prime numbers that are hundreds of digits long, making it computationally infeasible to break the encryption.<\/p>\r\n<p class=\"whitespace-pre-wrap break-words\">Here's how RSA encryption works:<\/p>\r\n<ol class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">Key Generation\r\n\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">Select two distinct prime numbers<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Calculate their product [latex]n[\/latex], which becomes part of the public key<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Generate the encryption key [latex]e[\/latex] and decryption key [latex]d[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Publish [latex]n[\/latex] and [latex]e[\/latex] as your public key, keep [latex]d[\/latex] private<\/li>\r\n<\/ul>\r\n<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Message Encryption\r\n\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">The sender uses your public key to encrypt their message<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Using the formula: [latex]\\text{encrypted} = \\text{message}^e \\bmod n[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">This creates a secure encrypted message<\/li>\r\n<\/ul>\r\n<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Message Decryption\r\n\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">You decrypt the message using your private key [latex]d[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Using the formula: [latex]\\text{message} = \\text{encrypted}^d \\bmod n[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">This recovers the original message<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<p class=\"whitespace-pre-wrap break-words\">The strength of RSA lies in its mathematical foundation: even with knowledge of the encrypted message and public key, determining the original message is computationally infeasible without access to the private key. This makes RSA a cornerstone of modern secure communications.<\/p>\r\n<section class=\"textbox example\">\r\n<p class=\"whitespace-pre-wrap break-words\">Suppose Alice has generated these values for her RSA system:<\/p>\r\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\r\n\t<li class=\"whitespace-normal break-words\">Public modulus: [latex]n = 3127[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Public encryption key: [latex]e = 3[\/latex]<\/li>\r\n\t<li class=\"whitespace-normal break-words\">Private decryption key: [latex]d = 2011[\/latex]<\/li>\r\n<\/ul>\r\n<p class=\"whitespace-pre-wrap break-words\">How would Bob send Alice the secret message [latex]50[\/latex].<\/p>\r\n<br \/>\r\n[reveal-answer q=\"4331\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4331\"]<br \/>\r\nBob starts with his message [latex]50[\/latex] and has access to Alice's public key information: [latex]n = 3127[\/latex] and [latex]e = 3[\/latex].\u00a0<br \/>\r\n[latex]\\\\[\/latex]<br \/>\r\nTo encrypt his message, he computes:<br \/>\r\n<center>[latex]50^{3} \\bmod 3127=3047[\/latex]<\/center>Bob then sends the encrypted value [latex]3047[\/latex] to Alice.<br \/>\r\n<br \/>\r\nWhen Alice receives the encrypted message [latex]3047[\/latex], she can use her private key [latex]d = 2011[\/latex] to decrypt it by calculating:<br \/>\r\n<center>[latex]3047^{2011} \\bmod 3127=50[\/latex]<\/center><br \/>\r\nThis gives her back Bob's original message of [latex]50[\/latex].<br \/>\r\n[latex]\\\\[\/latex]<br \/>\r\nNote: Only Alice, who has the private key [latex]d[\/latex], can perform this decryption. Anyone intercepting the encrypted message [latex]3047[\/latex] would not be able to determine that the original message was [latex]50[\/latex].<br \/>\r\n[\/hidden-answer]<\/section>\r\n<section>This method differs from Diffie-Hellman-Merkle because no exchange process is needed; Bob could send Alice an encrypted message using Bob\u2019s public key without having to communicate with Alice beforehand to determine a shared secret key. This is especially handy for applications like encrypting email, where both parties might not be online at the same time to perform a Diffie-Hellman-Merkle style key exchange.<\/section>\r\n<section class=\"textbox youChoose\">[videopicker divId=\"tnh-video-picker\" title=\"RSA Encryption\" label=\"Select Video\"]<br \/>\r\n[videooption displayName=\"Prime Numbers &amp; RSA Encryption Algorithm - Computerphile\" value=\"https:\/\/youtu.be\/JD72Ry60eP4\"][videooption displayName=\"How RSA Encryption Works\" value=\"\/\/plugin.3playmedia.com\/show?mf=12427540&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=ZPXVSJnDA_A&amp;video_target=tpm-plugin-0nwtzzf9-ZPXVSJnDA_A\"] [videooption displayName=\"RSA Encryption Algorithm - Rivest\u2013Shamir\u2013Adleman - RSA Algorithm Explained - Simplilearn\" value=\"\/\/plugin.3playmedia.com\/show?mf=12427541&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=vf1z7GlG6Qo&amp;video_target=tpm-plugin-le13zkx0-vf1z7GlG6Qo\"]<br \/>\r\n[\/videopicker]\r\n\r\n<p>&nbsp;<\/p>\r\n<p>You can view the <a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Prime+Numbers+%26+RSA+Encryption+Algorithm+-+Computerphile.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cPrime Numbers &amp; RSA Encryption Algorithm - Computerphile\u201d here (opens in new window).<\/a><\/p>\r\n<p>You can view the <a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/How+RSA+Encryption+Works.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cHow RSA Encryption Works\u201d here (opens in new window).<\/a><\/p>\r\n<p>You can view the <a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/RSA+Encryption+Algorithm+%7C+Rivest%E2%80%93Shamir%E2%80%93Adleman+%7C+RSA+Algorithm+Explained+%7C+Simplilearn.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cRSA Encryption Algorithm | Rivest\u2013Shamir\u2013Adleman | RSA Algorithm Explained | Simplilearn\u201d here (opens in new window).<\/a><\/p>\r\n<\/section>","rendered":"<h2>The Key Exchange (Diffie-Hellman-Merkle Key Exchange)<\/h2>\n<p>Having a better understanding of modulus and the one-way function provides us the basis for our key exchange.\u00a0Think of this like Alice and Bob trying to create a secret handshake without ever meeting in person, while others are watching them. Here&#8217;s how it works:<\/p>\n<ol class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">Alice and Bob start by agreeing on two public numbers that everyone can see:\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">A prime number [latex]p[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">A base number [latex]g[\/latex] (called a generator)<\/li>\n<\/ul>\n<\/li>\n<li class=\"whitespace-normal break-words\">Then, they each choose their own secret number:\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">Alice picks number [latex]a[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">Bob picks number [latex]b[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">They never tell anyone these numbers!<\/li>\n<\/ul>\n<\/li>\n<li class=\"whitespace-normal break-words\">They each do a calculation and share the result:\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">Alice calculates [latex]A=g^{a} \\bmod p[\/latex] and sends [latex]A[\/latex] to Bob<\/li>\n<li class=\"whitespace-normal break-words\">Bob calculates [latex]B=g^{b} \\bmod p[\/latex] and sends [latex]B[\/latex] to Alice<\/li>\n<\/ul>\n<\/li>\n<li class=\"whitespace-normal break-words\">Finally, they each do one more calculation:\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">Alice takes Bob&#8217;s number and calculates [latex]B^{a} \\bmod p[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">Bob takes Alice&#8217;s number and calculates [latex]A^{b} \\bmod p[\/latex]<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>The modular exponent power rule tells us [latex]\\left(g^{a} \\bmod p\\right)^{b} \\bmod p=\\left(g^{b} \\bmod p\\right)^{a} \\bmod p[\/latex]. This means they both end up with the same secret number, even though they never shared their secret numbers with each other!\u00a0\u00a0<\/p>\n<p>Let&#8217;s see this with real numbers.<\/p>\n<section class=\"textbox example\">Alice and Bob publically share a generator and prime modulus. In this case, we\u2019ll use [latex]3[\/latex] as the generator and [latex]17[\/latex] as the prime.<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q4330\">Show Solution<\/button><\/p>\n<div id=\"q4330\" class=\"hidden-answer\" style=\"display: none\"><\/p>\n<p style=\"text-align: center;\">[latex]\\begin{array}{llll} & \\textbf{Alice} & & \\textbf{Bob} \\\\ \\text{Alice and Bob publically} & g=3, p=17 & \\text{Common info} & g=3, p=17 \\\\ \\text{share a generator and prime} & & & \\\\ \\text{modulus.} & & & \\\\ \\text{Each then secretly picks a} & n = 8 & \\text{secret number} & n=6 \\\\ \\text{number n of their own.} & & & \\\\ \\text{Each calculates } g^n \\bmod p & 3^{8} \\bmod 17=16 & & 3^{6} \\bmod 17=15 \\\\ \\text{They then exchange these} & A=16 & & B=15 \\\\ \\text{resulting values.} & B=15 & & A=16\\\\ \\text{Each then raises the value} & B^{n} \\bmod p= & \\text{mix in secret} & A^{n} \\bmod p=\\\\ \\text{they received to the power of } & & \\text{number} & \\\\ \\text{their secret }n \\bmod p & 15^{8} \\bmod 17=1 & & 16^{6} \\bmod 17=1\\\\ \\text{The result is the shared secret key.} & 1 & \\text{shared secret key} & 1 \\end{array}[\/latex]<\/p>\n<p>The shared secrets come out the same because of the modular exponent power rule:<\/p>\n<p style=\"text-align: center;\">[latex]\\left(a^{b} \\bmod n\\right)^{c} \\bmod n=\\left(a^{c} \\bmod n\\right)^{b} \\bmod n[\/latex].<\/p>\n<p>Alice computed [latex]\\left(3^{6} \\bmod 17\\right)^{8} \\bmod 17[\/latex] while Bob computed [latex]\\left(3^{8} \\bmod 17\\right)^{6} \\bmod 17[\/latex], which the rule says will give the same results. Notice that even if a snooper were to obtain both exchanged values [latex]A = 16[\/latex] and [latex]B = 15[\/latex], there is no way they could obtain the shared secret key from these without having at least one of Alice or Bob\u2019s secret numbers. There is no easy way to obtain the secret numbers from the shared values, since the function was a one-way function.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<h2>RSA<\/h2>\n<p>RSA is one of the most widely used methods in modern cryptography. It uses a public-private key system where anyone can encrypt a message using your public key, but only you can decrypt it with your private key. This is similar to having a special lock where copies of the public key can be freely distributed &#8211; anyone can use it to secure a message, but only the holder of the private key can unlock and read those messages.<\/p>\n<p>The security of RSA relies on a fundamental principle in mathematics: the difficulty of factoring large numbers into their prime components. For example, while it&#8217;s straightforward to multiply [latex]53[\/latex] times [latex]59[\/latex] to get [latex]3127[\/latex], finding the original prime factors of [latex]12,317[\/latex] is considerably more challenging. This difficulty increases exponentially when working with prime numbers that are hundreds of digits long, making it computationally infeasible to break the encryption.<\/p>\n<p class=\"whitespace-pre-wrap break-words\">Here&#8217;s how RSA encryption works:<\/p>\n<ol class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">Key Generation\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">Select two distinct prime numbers<\/li>\n<li class=\"whitespace-normal break-words\">Calculate their product [latex]n[\/latex], which becomes part of the public key<\/li>\n<li class=\"whitespace-normal break-words\">Generate the encryption key [latex]e[\/latex] and decryption key [latex]d[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">Publish [latex]n[\/latex] and [latex]e[\/latex] as your public key, keep [latex]d[\/latex] private<\/li>\n<\/ul>\n<\/li>\n<li class=\"whitespace-normal break-words\">Message Encryption\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">The sender uses your public key to encrypt their message<\/li>\n<li class=\"whitespace-normal break-words\">Using the formula: [latex]\\text{encrypted} = \\text{message}^e \\bmod n[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">This creates a secure encrypted message<\/li>\n<\/ul>\n<\/li>\n<li class=\"whitespace-normal break-words\">Message Decryption\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">You decrypt the message using your private key [latex]d[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">Using the formula: [latex]\\text{message} = \\text{encrypted}^d \\bmod n[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">This recovers the original message<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p class=\"whitespace-pre-wrap break-words\">The strength of RSA lies in its mathematical foundation: even with knowledge of the encrypted message and public key, determining the original message is computationally infeasible without access to the private key. This makes RSA a cornerstone of modern secure communications.<\/p>\n<section class=\"textbox example\">\n<p class=\"whitespace-pre-wrap break-words\">Suppose Alice has generated these values for her RSA system:<\/p>\n<ul class=\"[&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7\">\n<li class=\"whitespace-normal break-words\">Public modulus: [latex]n = 3127[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">Public encryption key: [latex]e = 3[\/latex]<\/li>\n<li class=\"whitespace-normal break-words\">Private decryption key: [latex]d = 2011[\/latex]<\/li>\n<\/ul>\n<p class=\"whitespace-pre-wrap break-words\">How would Bob send Alice the secret message [latex]50[\/latex].<\/p>\n<div class=\"wp-nocaption \"><\/div>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q4331\">Show Solution<\/button><\/p>\n<div id=\"q4331\" class=\"hidden-answer\" style=\"display: none\">\nBob starts with his message [latex]50[\/latex] and has access to Alice&#8217;s public key information: [latex]n = 3127[\/latex] and [latex]e = 3[\/latex].\u00a0<br \/>\n[latex]\\\\[\/latex]<br \/>\nTo encrypt his message, he computes:<\/p>\n<div style=\"text-align: center;\">[latex]50^{3} \\bmod 3127=3047[\/latex]<\/div>\n<p>Bob then sends the encrypted value [latex]3047[\/latex] to Alice.<\/p>\n<p>When Alice receives the encrypted message [latex]3047[\/latex], she can use her private key [latex]d = 2011[\/latex] to decrypt it by calculating:<\/p>\n<div style=\"text-align: center;\">[latex]3047^{2011} \\bmod 3127=50[\/latex]<\/div>\n<p>\nThis gives her back Bob&#8217;s original message of [latex]50[\/latex].<br \/>\n[latex]\\\\[\/latex]<br \/>\nNote: Only Alice, who has the private key [latex]d[\/latex], can perform this decryption. Anyone intercepting the encrypted message [latex]3047[\/latex] would not be able to determine that the original message was [latex]50[\/latex].\n<\/div>\n<\/div>\n<\/section>\n<section>This method differs from Diffie-Hellman-Merkle because no exchange process is needed; Bob could send Alice an encrypted message using Bob\u2019s public key without having to communicate with Alice beforehand to determine a shared secret key. This is especially handy for applications like encrypting email, where both parties might not be online at the same time to perform a Diffie-Hellman-Merkle style key exchange.<\/section>\n<section class=\"textbox youChoose\">\n<div id=\"tnh-video-picker\" class=\"videoPicker\">\n<h3>RSA Encryption<\/h3>\n<form><label>Select Video:<\/label><select name=\"video\"><option value=\"https:\/\/www.youtube.com\/embed\/JD72Ry60eP4\">Prime Numbers &amp; RSA Encryption Algorithm &#8211; Computerphile<\/option><option value=\"\/\/plugin.3playmedia.com\/show?mf=12427540&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=ZPXVSJnDA_A&amp;video_target=tpm-plugin-0nwtzzf9-ZPXVSJnDA_A\">How RSA Encryption Works<\/option><option value=\"\/\/plugin.3playmedia.com\/show?mf=12427541&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=vf1z7GlG6Qo&amp;video_target=tpm-plugin-le13zkx0-vf1z7GlG6Qo\">RSA Encryption Algorithm &#8211; Rivest\u2013Shamir\u2013Adleman &#8211; RSA Algorithm Explained &#8211; Simplilearn<\/option><\/select><\/form>\n<div class=\"videoContainer\"><iframe src=\"https:\/\/www.youtube.com\/embed\/JD72Ry60eP4\" allowfullscreen><\/iframe><\/div>\n<p>&nbsp;<\/p>\n<p>You can view the <a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Prime+Numbers+%26+RSA+Encryption+Algorithm+-+Computerphile.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cPrime Numbers &amp; RSA Encryption Algorithm &#8211; Computerphile\u201d here (opens in new window).<\/a><\/p>\n<p>You can view the <a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/How+RSA+Encryption+Works.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cHow RSA Encryption Works\u201d here (opens in new window).<\/a><\/p>\n<p>You can view the <a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/RSA+Encryption+Algorithm+%7C+Rivest%E2%80%93Shamir%E2%80%93Adleman+%7C+RSA+Algorithm+Explained+%7C+Simplilearn.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cRSA Encryption Algorithm | Rivest\u2013Shamir\u2013Adleman | RSA Algorithm Explained | Simplilearn\u201d here (opens in new window).<\/a><\/p>\n<\/section>\n","protected":false},"author":15,"menu_order":10,"template":"","meta":{"_candela_citation":"[{\"type\":\"copyrighted_video\",\"description\":\"Prime Numbers & RSA Encryption Algorithm - Computerphile\",\"author\":\"Computerphile\",\"organization\":\"\",\"url\":\"https:\/\/youtu.be\/JD72Ry60eP4\",\"project\":\"\",\"license\":\"arr\",\"license_terms\":\"\"},{\"type\":\"copyrighted_video\",\"description\":\"How RSA Encryption Works\",\"author\":\"Mental Outlaw\",\"organization\":\"\",\"url\":\"https:\/\/youtu.be\/ZPXVSJnDA_A\",\"project\":\"\",\"license\":\"arr\",\"license_terms\":\"\"},{\"type\":\"copyrighted_video\",\"description\":\"RSA Encryption Algorithm | Rivestu2013Shamiru2013Adleman | RSA Algorithm Explained | Simplilearn\",\"author\":\"Simplilearn\",\"organization\":\"\",\"url\":\"https:\/\/youtu.be\/vf1z7GlG6Qo\",\"project\":\"\",\"license\":\"arr\",\"license_terms\":\"\"}]","pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"part":2245,"module-header":"learn_it","content_attributions":[{"type":"copyrighted_video","description":"Prime Numbers & RSA Encryption Algorithm - Computerphile","author":"Computerphile","organization":"","url":"https:\/\/youtu.be\/JD72Ry60eP4","project":"","license":"arr","license_terms":""},{"type":"copyrighted_video","description":"How RSA Encryption Works","author":"Mental Outlaw","organization":"","url":"https:\/\/youtu.be\/ZPXVSJnDA_A","project":"","license":"arr","license_terms":""},{"type":"copyrighted_video","description":"RSA Encryption Algorithm | Rivestu2013Shamiru2013Adleman | RSA Algorithm Explained | Simplilearn","author":"Simplilearn","organization":"","url":"https:\/\/youtu.be\/vf1z7GlG6Qo","project":"","license":"arr","license_terms":""}],"internal_book_links":[],"video_content":[{"divId":"tnh-video-picker","title":"RSA Encryption","label":"Select Video","video_collection":[{"displayName":"Prime Numbers &amp; RSA Encryption Algorithm - Computerphile","value":"https:\/\/www.youtube.com\/embed\/JD72Ry60eP4"},{"displayName":"How RSA Encryption Works","value":"\/\/plugin.3playmedia.com\/show?mf=12427540&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=ZPXVSJnDA_A&amp;video_target=tpm-plugin-0nwtzzf9-ZPXVSJnDA_A"},{"displayName":"RSA Encryption Algorithm - Rivest\u2013Shamir\u2013Adleman - RSA Algorithm Explained - Simplilearn","value":"\/\/plugin.3playmedia.com\/show?mf=12427541&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=vf1z7GlG6Qo&amp;video_target=tpm-plugin-le13zkx0-vf1z7GlG6Qo"}]}],"cc_video_embed_content":{"cc_scripts":"","media_targets":[]},"try_it_collection":null,"_links":{"self":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/2341"}],"collection":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/users\/15"}],"version-history":[{"count":31,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/2341\/revisions"}],"predecessor-version":[{"id":15472,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/2341\/revisions\/15472"}],"part":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/parts\/2245"}],"metadata":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/2341\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/media?parent=2341"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapter-type?post=2341"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/contributor?post=2341"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/license?post=2341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}