{"id":2250,"date":"2023-05-08T17:46:52","date_gmt":"2023-05-08T17:46:52","guid":{"rendered":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/?post_type=chapter&#038;p=2250"},"modified":"2025-08-26T04:04:35","modified_gmt":"2025-08-26T04:04:35","slug":"cryptography-fresh-take","status":"web-only","type":"chapter","link":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/chapter\/cryptography-fresh-take\/","title":{"raw":"Cryptography: Fresh Take","rendered":"Cryptography: Fresh Take"},"content":{"raw":"<section class=\"textbox learningGoals\">\r\n<ul>\r\n\t<li>Compare ways of encrypting and decrypting data using shared symmetric-key methods<\/li>\r\n\t<li>Understand the basics of public key cryptography, including key pairs, digital signatures, and encryption\/decryption<\/li>\r\n\t<li>Compare the pros and cons of using public key cryptography versus symmetric-key methods<\/li>\r\n<\/ul>\r\n<\/section>\r\n<h2>Symmetric-Key Methods<\/h2>\r\n<div class=\"textbox shaded\">\r\n<p><strong>The Main Idea\u00a0<\/strong><\/p>\r\n<p><strong>Cryptography <\/strong>involves using techniques to obscure a message so outsiders cannot read the message.<\/p>\r\n<p><strong>Encryption <\/strong>is the process of converting plain text or data into an encoded format that can only be read by authorized parties who possess the appropriate decryption key. The goal of encryption is to protect the confidentiality and integrity of the information being transmitted or stored.<\/p>\r\n<p><strong>Decryption<\/strong>, on the other hand, is the process of converting the encrypted data back into its original, readable form using the appropriate decryption key. Only authorized parties who possess the correct key are able to decrypt the information and access the original plain text or data.<\/p>\r\n<p>The security of any encryption method should depend only on the encryption key being difficult to discover. It is not safe to rely on the encryption method (algorithm) being kept secret.<\/p>\r\n<p>A <strong>brute force attack<\/strong> is a method for breaking encryption by trying all possible encryption keys.<\/p>\r\n<p>A <strong>substitution cipher<\/strong> is a method of encryption that involves replacing each letter in a message with a different letter or symbol according to a predetermined pattern or rule.<\/p>\r\n<\/div>\r\n<section class=\"textbox watchIt\"><iframe src=\"\/\/plugin.3playmedia.com\/show?mf=10350389&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=vk3py9M2IfE&amp;video_target=tpm-plugin-46au6j05-vk3py9M2IfE\" width=\"800px\" height=\"450px\" frameborder=\"0\" marginwidth=\"0px\" marginheight=\"0px\"><\/iframe><br \/>\r\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Private+Key+Encryption+Symmetric+Key+Encryption.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cPrivate Key Encryption (Symmetric Key Encryption)\u201d here (opens in new window).<\/a><\/p>\r\n<\/section>\r\n<section class=\"textbox example\">Decrypt the message [latex]GZD\\:KNK\\:YDX\\:MFW\\:JXA[\/latex] if it was encrypted using a shift cipher with shift of [latex]5[\/latex].<br \/>\r\n[reveal-answer q=\"4330\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4330\"]<br \/>\r\nWe start by writing out the character mapping by shifting the alphabet, with [latex]A[\/latex] mapping to [latex]F[\/latex], five characters later in the alphabet.<br \/>\r\n<br \/>\r\nOriginal: [latex]ABCDEFGHIJKLMNOPQRSTUVWXYZ[\/latex]<br \/>\r\nMaps to: [latex]FGHIJKLMNOPQRSTUVWXYZABCDE[\/latex]<br \/>\r\n<br \/>\r\nWe now work backward to decrypt the message. The first letter [latex]G[\/latex] is mapped to [latex]B[\/latex], so [latex]B[\/latex] is the first character of the original message. Continuing, our decrypted message is [latex]BUY\\:FIF\\:TYS\\:HAR\\:ESA.[\/latex] Removing spaces we get [latex]BUYFIFTYSHARESA[\/latex]. In this case, it appears an extra character was added to the end to make the groups of three come out even, and that the original message was \u201cBuy fifty shares.\u201d[\/hidden-answer]<\/section>\r\n<h2>Transposition Ciphers<\/h2>\r\n<div class=\"textbox shaded\">\r\n<p><strong>The Main Idea\u00a0<\/strong><\/p>\r\n<p>A <strong>transposition cipher<\/strong> is one in which the order of characters is changed to obscure the message.<\/p>\r\n<\/div>\r\n<section class=\"textbox example\">Decrypt the message [latex]CEE\\: IAI\\: MNL\\: NOG\\: LTR\\: VMH\\: NW[\/latex] with a table with rows of [latex]5[\/latex] characters.<br \/>\r\n[reveal-answer q=\"4331\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4331\"]\r\n\r\n<p class=\"lt-math-34277\">Since there are a total of [latex]20[\/latex] characters and each row should have [latex]5[\/latex] characters, then there will be [latex]\\frac{20}{5} =4[\/latex]\u00a0rows.<\/p>\r\n<p class=\"lt-math-34277\">We start writing, putting the first [latex]4[\/latex] letters, [latex]CEEI[\/latex], down the first column.<\/p>\r\n<p style=\"text-align: center;\">[latex]CALLM[\/latex]<\/p>\r\n<p style=\"text-align: center;\">[latex]EINTH[\/latex]<\/p>\r\n<p style=\"text-align: center;\">[latex]EMORN[\/latex]<\/p>\r\n<p style=\"text-align: center;\">[latex]INGVW[\/latex]<\/p>\r\n<p class=\"lt-math-34277\">We can now read the message: [latex]CALL\\: ME\\: IN\\: THE\\: MORNING\\: VW[\/latex]. The [latex]VW[\/latex] is likely nonsense characters used to fill out the message.<\/p>\r\n<p>[\/hidden-answer]<\/p>\r\n<\/section>\r\n<h2>Public Key Cryptography<\/h2>\r\n<div class=\"textbox shaded\">\r\n<p><strong>The Main Idea\u00a0<\/strong><\/p>\r\n<p><strong>Public key cryptography<\/strong> is a method of securing digital communication by using two mathematically related keys: a public key and a private key. The public key is used for encrypting data, while the private key is used for decrypting it.<\/p>\r\n<\/div>\r\n<section class=\"textbox watchIt\"><iframe src=\"\/\/plugin.3playmedia.com\/show?mf=10350390&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=8I7BNgD2Yag&amp;video_target=tpm-plugin-lkuagsa8-8I7BNgD2Yag\" width=\"800px\" height=\"450px\" frameborder=\"0\" marginwidth=\"0px\" marginheight=\"0px\"><\/iframe><br \/>\r\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Public+Key+Encryption+Asymmetric+Key+Encryption.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cPublic Key Encryption (Asymmetric Key Encryption)\u201d here (opens in new window).<\/a><\/p>\r\n<\/section>\r\n\r\n[caption id=\"attachment_2318\" align=\"alignright\" width=\"485\"]<img class=\"wp-image-2318\" src=\"https:\/\/content-cdn.one.lumenlearning.com\/wp-content\/uploads\/sites\/18\/2023\/05\/08185929\/Screenshot-2023-05-08-145855.png\" alt=\"The mixing-color analogy for Diffie-Hellman-Merkle key exchange described in the text.\" width=\"485\" height=\"703\" \/> Figure 1. Alice's and Bob's processes for mixing their colors[\/caption]\r\n\r\n<p><br \/>\r\nAs an example, let\u2019s consider mixing paint. It\u2019s easy to mix paint to make a new color, but much harder to separate a mixed paint into the two original colors used.<\/p>\r\n<p>Using this analogy, Alice and Bob publically agree on a common starter color. Each then mixes in some of their own secret color. They then exchange their mixed colors.<\/p>\r\n<p>Since separating colors is hard, even if a snooper were to obtain these mixed colors, it would be hard to obtain the original secret colors.<\/p>\r\n<p>Once they have exchanged their mixed colors, Alice and Bob both add their secret color to the mix they obtained from the other person. In doing so, both Alice and Bob now have the same common secret color, since it contains a mix of the original common color, Alice\u2019s secret color, and Bob\u2019s secret color.<\/p>\r\n<p>They now have a common secret color they can use as their encryption key, even though neither Alice nor Bob knows the other\u2019s secret color.<\/p>\r\n<p>Likewise, there is no way for a snooper to obtain the common secret color without separating one of the mixed colors.<\/p>\r\n<h2>Pros VS Cons: Public Key Cryptography and Symmetric-Key Cryptography<\/h2>\r\n<p>Both methods have their own advantages and disadvantages, and it is essential to evaluate them before selecting the appropriate method.<\/p>\r\n<p>Symmetric-key methods use the same key for encryption and decryption, and the key needs to be securely shared between the sender and the receiver. The encryption process is fast, and the data can be decrypted quickly. However, the main disadvantage of symmetric-key methods is that the key needs to be kept secret, and if it falls into the wrong hands, the data can be easily decrypted. Symmetric-key methods also suffer from a key distribution problem, where securely sharing the key between multiple parties can be challenging.<\/p>\r\n<p>Public key cryptography, on the other hand, uses a pair of keys, a public key, and a private key. The public key is widely available and can be shared with anyone, while the private key is kept secret. Data encrypted with the public key can only be decrypted with the corresponding private key. Public key cryptography provides a secure solution to the key distribution problem since the public key can be widely shared without compromising the security of the encryption process. However, public key cryptography is computationally expensive, and the encryption process can be slow compared to symmetric-key methods.<\/p>\r\n<h2>The One-Way Function<\/h2>\r\n<section class=\"textbox watchIt\"><iframe src=\"\/\/plugin.3playmedia.com\/show?mf=10350391&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=5OjZWSdxlU0&amp;video_target=tpm-plugin-8fhheb3v-5OjZWSdxlU0\" width=\"800px\" height=\"450px\" frameborder=\"0\" marginwidth=\"0px\" marginheight=\"0px\"><\/iframe><br \/>\r\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/How+does+Modular+Arithmetic+work.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cHow does Modular Arithmetic work?\u201d here (opens in new window).<\/a><\/p>\r\n<\/section>\r\n<section class=\"textbox tryIt\">Compute:\r\n\r\n<ol style=\"list-style-type: lower-alpha;\">\r\n\t<li>[latex]23 \\bmod 7[\/latex]<\/li>\r\n\t<li>[latex]15 \\bmod 7[\/latex]<\/li>\r\n\t<li>[latex]2034 \\bmod 7[\/latex]<\/li>\r\n<\/ol>\r\n<p>[reveal-answer q=\"4339\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4339\"]<\/p>\r\n<ol style=\"list-style-type: lower-alpha;\">\r\n\t<li>[latex]2[\/latex]<\/li>\r\n\t<li>[latex]1[\/latex]<\/li>\r\n\t<li>[latex]4[\/latex]<\/li>\r\n<\/ol>\r\n<p>[\/hidden-answer]<\/p>\r\n<\/section>\r\n<section class=\"textbox example\">Calculate [latex]31345 \\bmod 419[\/latex]<br \/>\r\n[reveal-answer q=\"4338\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4338\"]<br \/>\r\n[latex]\\begin{array}{ll} 31345 \/ 419=74.8090692 &amp; \\text{Now subtract 74 to get just the decimal remainder} \\\\ 74.8090692-74=0.8090692 &amp; \\text{Multiply this by 419 to get the modulus} \\\\ 0.8090692 \\times 419=339 &amp; \\text{This tells us 0.8090692 was equivalent to }\\frac{339}{419} \\end{array}[\/latex][\/hidden-answer]<\/section>\r\n<section class=\"textbox example\">Use the modular exponent rule to calculate [latex]10000 \\bmod 7[\/latex], by noting [latex] 10000 = 10^4[\/latex]<br \/>\r\n[reveal-answer q=\"4337\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4337\"]<br \/>\r\n[latex]10000 \\bmod 7=10^{4} \\bmod 7=(10 \\bmod 7)^{4} \\bmod 7=3^{4} \\bmod 7=81 \\bmod 7=4[\/latex][\/hidden-answer]<\/section>\r\n<h2>The Key Exchange<\/h2>\r\n<section class=\"textbox watchIt\"><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/M-0qt6tdHzk\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><br \/>\r\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Diffie-hellman+key+exchange+_+Journey+into+cryptography+_+Computer+Science+_+Khan+Academy.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cDiffie-hellman key exchange | Journey into cryptography | Computer Science | Khan Academy\u201d here (opens in new window).<\/a><\/p>\r\n<\/section>\r\n<section class=\"textbox example\">Suppose you are doing a key exchange with Kylie using generator [latex]5[\/latex] and prime [latex]23[\/latex]. Your secret number is [latex]2[\/latex]. What number do you send to Kylie? If Kylie sends you the value [latex]8[\/latex], determine the shared secret key.<br \/>\r\n[reveal-answer q=\"4335\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"4335\"]To compute the number we'd send to Kylie, we raise the generator to the power of our secret number modulus the prime: [latex]5^{2} \\bmod 23=25 \\bmod 23=2[\/latex] .<br \/>\r\n<br \/>\r\nIf Kylie sends us the value [latex]8[\/latex], we determine the shared secret by raising her number to the power of our secret number modulus the prime: [latex]8^{2} \\bmod 23=64 \\bmod 23=18.18[\/latex] would be the shared secret.[\/hidden-answer]<\/section>","rendered":"<section class=\"textbox learningGoals\">\n<ul>\n<li>Compare ways of encrypting and decrypting data using shared symmetric-key methods<\/li>\n<li>Understand the basics of public key cryptography, including key pairs, digital signatures, and encryption\/decryption<\/li>\n<li>Compare the pros and cons of using public key cryptography versus symmetric-key methods<\/li>\n<\/ul>\n<\/section>\n<h2>Symmetric-Key Methods<\/h2>\n<div class=\"textbox shaded\">\n<p><strong>The Main Idea\u00a0<\/strong><\/p>\n<p><strong>Cryptography <\/strong>involves using techniques to obscure a message so outsiders cannot read the message.<\/p>\n<p><strong>Encryption <\/strong>is the process of converting plain text or data into an encoded format that can only be read by authorized parties who possess the appropriate decryption key. The goal of encryption is to protect the confidentiality and integrity of the information being transmitted or stored.<\/p>\n<p><strong>Decryption<\/strong>, on the other hand, is the process of converting the encrypted data back into its original, readable form using the appropriate decryption key. Only authorized parties who possess the correct key are able to decrypt the information and access the original plain text or data.<\/p>\n<p>The security of any encryption method should depend only on the encryption key being difficult to discover. It is not safe to rely on the encryption method (algorithm) being kept secret.<\/p>\n<p>A <strong>brute force attack<\/strong> is a method for breaking encryption by trying all possible encryption keys.<\/p>\n<p>A <strong>substitution cipher<\/strong> is a method of encryption that involves replacing each letter in a message with a different letter or symbol according to a predetermined pattern or rule.<\/p>\n<\/div>\n<section class=\"textbox watchIt\"><iframe loading=\"lazy\" src=\"\/\/plugin.3playmedia.com\/show?mf=10350389&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=vk3py9M2IfE&amp;video_target=tpm-plugin-46au6j05-vk3py9M2IfE\" width=\"800px\" height=\"450px\" frameborder=\"0\" marginwidth=\"0px\" marginheight=\"0px\"><\/iframe><\/p>\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Private+Key+Encryption+Symmetric+Key+Encryption.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cPrivate Key Encryption (Symmetric Key Encryption)\u201d here (opens in new window).<\/a><\/p>\n<\/section>\n<section class=\"textbox example\">Decrypt the message [latex]GZD\\:KNK\\:YDX\\:MFW\\:JXA[\/latex] if it was encrypted using a shift cipher with shift of [latex]5[\/latex].<\/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\">\nWe start by writing out the character mapping by shifting the alphabet, with [latex]A[\/latex] mapping to [latex]F[\/latex], five characters later in the alphabet.<\/p>\n<p>Original: [latex]ABCDEFGHIJKLMNOPQRSTUVWXYZ[\/latex]<br \/>\nMaps to: [latex]FGHIJKLMNOPQRSTUVWXYZABCDE[\/latex]<\/p>\n<p>We now work backward to decrypt the message. The first letter [latex]G[\/latex] is mapped to [latex]B[\/latex], so [latex]B[\/latex] is the first character of the original message. Continuing, our decrypted message is [latex]BUY\\:FIF\\:TYS\\:HAR\\:ESA.[\/latex] Removing spaces we get [latex]BUYFIFTYSHARESA[\/latex]. In this case, it appears an extra character was added to the end to make the groups of three come out even, and that the original message was \u201cBuy fifty shares.\u201d<\/p><\/div>\n<\/div>\n<\/section>\n<h2>Transposition Ciphers<\/h2>\n<div class=\"textbox shaded\">\n<p><strong>The Main Idea\u00a0<\/strong><\/p>\n<p>A <strong>transposition cipher<\/strong> is one in which the order of characters is changed to obscure the message.<\/p>\n<\/div>\n<section class=\"textbox example\">Decrypt the message [latex]CEE\\: IAI\\: MNL\\: NOG\\: LTR\\: VMH\\: NW[\/latex] with a table with rows of [latex]5[\/latex] characters.<\/p>\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\">\n<p class=\"lt-math-34277\">Since there are a total of [latex]20[\/latex] characters and each row should have [latex]5[\/latex] characters, then there will be [latex]\\frac{20}{5} =4[\/latex]\u00a0rows.<\/p>\n<p class=\"lt-math-34277\">We start writing, putting the first [latex]4[\/latex] letters, [latex]CEEI[\/latex], down the first column.<\/p>\n<p style=\"text-align: center;\">[latex]CALLM[\/latex]<\/p>\n<p style=\"text-align: center;\">[latex]EINTH[\/latex]<\/p>\n<p style=\"text-align: center;\">[latex]EMORN[\/latex]<\/p>\n<p style=\"text-align: center;\">[latex]INGVW[\/latex]<\/p>\n<p class=\"lt-math-34277\">We can now read the message: [latex]CALL\\: ME\\: IN\\: THE\\: MORNING\\: VW[\/latex]. The [latex]VW[\/latex] is likely nonsense characters used to fill out the message.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<h2>Public Key Cryptography<\/h2>\n<div class=\"textbox shaded\">\n<p><strong>The Main Idea\u00a0<\/strong><\/p>\n<p><strong>Public key cryptography<\/strong> is a method of securing digital communication by using two mathematically related keys: a public key and a private key. The public key is used for encrypting data, while the private key is used for decrypting it.<\/p>\n<\/div>\n<section class=\"textbox watchIt\"><iframe loading=\"lazy\" src=\"\/\/plugin.3playmedia.com\/show?mf=10350390&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=8I7BNgD2Yag&amp;video_target=tpm-plugin-lkuagsa8-8I7BNgD2Yag\" width=\"800px\" height=\"450px\" frameborder=\"0\" marginwidth=\"0px\" marginheight=\"0px\"><\/iframe><\/p>\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Public+Key+Encryption+Asymmetric+Key+Encryption.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cPublic Key Encryption (Asymmetric Key Encryption)\u201d here (opens in new window).<\/a><\/p>\n<\/section>\n<figure id=\"attachment_2318\" aria-describedby=\"caption-attachment-2318\" style=\"width: 485px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2318\" src=\"https:\/\/content-cdn.one.lumenlearning.com\/wp-content\/uploads\/sites\/18\/2023\/05\/08185929\/Screenshot-2023-05-08-145855.png\" alt=\"The mixing-color analogy for Diffie-Hellman-Merkle key exchange described in the text.\" width=\"485\" height=\"703\" srcset=\"https:\/\/content-cdn.one.lumenlearning.com\/wp-content\/uploads\/sites\/18\/2023\/05\/08185929\/Screenshot-2023-05-08-145855.png 522w, https:\/\/content-cdn.one.lumenlearning.com\/wp-content\/uploads\/sites\/18\/2023\/05\/08185929\/Screenshot-2023-05-08-145855-207x300.png 207w, https:\/\/content-cdn.one.lumenlearning.com\/wp-content\/uploads\/sites\/18\/2023\/05\/08185929\/Screenshot-2023-05-08-145855-65x94.png 65w, https:\/\/content-cdn.one.lumenlearning.com\/wp-content\/uploads\/sites\/18\/2023\/05\/08185929\/Screenshot-2023-05-08-145855-225x326.png 225w, https:\/\/content-cdn.one.lumenlearning.com\/wp-content\/uploads\/sites\/18\/2023\/05\/08185929\/Screenshot-2023-05-08-145855-350x508.png 350w\" sizes=\"(max-width: 485px) 100vw, 485px\" \/><figcaption id=\"caption-attachment-2318\" class=\"wp-caption-text\">Figure 1. Alice&#8217;s and Bob&#8217;s processes for mixing their colors<\/figcaption><\/figure>\n<p>\nAs an example, let\u2019s consider mixing paint. It\u2019s easy to mix paint to make a new color, but much harder to separate a mixed paint into the two original colors used.<\/p>\n<p>Using this analogy, Alice and Bob publically agree on a common starter color. Each then mixes in some of their own secret color. They then exchange their mixed colors.<\/p>\n<p>Since separating colors is hard, even if a snooper were to obtain these mixed colors, it would be hard to obtain the original secret colors.<\/p>\n<p>Once they have exchanged their mixed colors, Alice and Bob both add their secret color to the mix they obtained from the other person. In doing so, both Alice and Bob now have the same common secret color, since it contains a mix of the original common color, Alice\u2019s secret color, and Bob\u2019s secret color.<\/p>\n<p>They now have a common secret color they can use as their encryption key, even though neither Alice nor Bob knows the other\u2019s secret color.<\/p>\n<p>Likewise, there is no way for a snooper to obtain the common secret color without separating one of the mixed colors.<\/p>\n<h2>Pros VS Cons: Public Key Cryptography and Symmetric-Key Cryptography<\/h2>\n<p>Both methods have their own advantages and disadvantages, and it is essential to evaluate them before selecting the appropriate method.<\/p>\n<p>Symmetric-key methods use the same key for encryption and decryption, and the key needs to be securely shared between the sender and the receiver. The encryption process is fast, and the data can be decrypted quickly. However, the main disadvantage of symmetric-key methods is that the key needs to be kept secret, and if it falls into the wrong hands, the data can be easily decrypted. Symmetric-key methods also suffer from a key distribution problem, where securely sharing the key between multiple parties can be challenging.<\/p>\n<p>Public key cryptography, on the other hand, uses a pair of keys, a public key, and a private key. The public key is widely available and can be shared with anyone, while the private key is kept secret. Data encrypted with the public key can only be decrypted with the corresponding private key. Public key cryptography provides a secure solution to the key distribution problem since the public key can be widely shared without compromising the security of the encryption process. However, public key cryptography is computationally expensive, and the encryption process can be slow compared to symmetric-key methods.<\/p>\n<h2>The One-Way Function<\/h2>\n<section class=\"textbox watchIt\"><iframe loading=\"lazy\" src=\"\/\/plugin.3playmedia.com\/show?mf=10350391&amp;p3sdk_version=1.10.1&amp;p=20361&amp;pt=375&amp;video_id=5OjZWSdxlU0&amp;video_target=tpm-plugin-8fhheb3v-5OjZWSdxlU0\" width=\"800px\" height=\"450px\" frameborder=\"0\" marginwidth=\"0px\" marginheight=\"0px\"><\/iframe><\/p>\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/How+does+Modular+Arithmetic+work.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cHow does Modular Arithmetic work?\u201d here (opens in new window).<\/a><\/p>\n<\/section>\n<section class=\"textbox tryIt\">Compute:<\/p>\n<ol style=\"list-style-type: lower-alpha;\">\n<li>[latex]23 \\bmod 7[\/latex]<\/li>\n<li>[latex]15 \\bmod 7[\/latex]<\/li>\n<li>[latex]2034 \\bmod 7[\/latex]<\/li>\n<\/ol>\n<p><div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q4339\">Show Solution<\/button><\/p>\n<div id=\"q4339\" class=\"hidden-answer\" style=\"display: none\">\n<ol style=\"list-style-type: lower-alpha;\">\n<li>[latex]2[\/latex]<\/li>\n<li>[latex]1[\/latex]<\/li>\n<li>[latex]4[\/latex]<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"textbox example\">Calculate [latex]31345 \\bmod 419[\/latex]<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q4338\">Show Solution<\/button><\/p>\n<div id=\"q4338\" class=\"hidden-answer\" style=\"display: none\">\n[latex]\\begin{array}{ll} 31345 \/ 419=74.8090692 & \\text{Now subtract 74 to get just the decimal remainder} \\\\ 74.8090692-74=0.8090692 & \\text{Multiply this by 419 to get the modulus} \\\\ 0.8090692 \\times 419=339 & \\text{This tells us 0.8090692 was equivalent to }\\frac{339}{419} \\end{array}[\/latex]<\/div>\n<\/div>\n<\/section>\n<section class=\"textbox example\">Use the modular exponent rule to calculate [latex]10000 \\bmod 7[\/latex], by noting [latex]10000 = 10^4[\/latex]<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q4337\">Show Solution<\/button><\/p>\n<div id=\"q4337\" class=\"hidden-answer\" style=\"display: none\">\n[latex]10000 \\bmod 7=10^{4} \\bmod 7=(10 \\bmod 7)^{4} \\bmod 7=3^{4} \\bmod 7=81 \\bmod 7=4[\/latex]<\/div>\n<\/div>\n<\/section>\n<h2>The Key Exchange<\/h2>\n<section class=\"textbox watchIt\"><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/M-0qt6tdHzk\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>You can view the\u00a0<a href=\"https:\/\/course-building.s3.us-west-2.amazonaws.com\/Quantitative+Reasoning+-+2023+Build\/Transcriptions\/Diffie-hellman+key+exchange+_+Journey+into+cryptography+_+Computer+Science+_+Khan+Academy.txt\" target=\"_blank\" rel=\"noopener\">transcript for \u201cDiffie-hellman key exchange | Journey into cryptography | Computer Science | Khan Academy\u201d here (opens in new window).<\/a><\/p>\n<\/section>\n<section class=\"textbox example\">Suppose you are doing a key exchange with Kylie using generator [latex]5[\/latex] and prime [latex]23[\/latex]. Your secret number is [latex]2[\/latex]. What number do you send to Kylie? If Kylie sends you the value [latex]8[\/latex], determine the shared secret key.<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q4335\">Show Solution<\/button><\/p>\n<div id=\"q4335\" class=\"hidden-answer\" style=\"display: none\">To compute the number we&#8217;d send to Kylie, we raise the generator to the power of our secret number modulus the prime: [latex]5^{2} \\bmod 23=25 \\bmod 23=2[\/latex] .<\/p>\n<p>If Kylie sends us the value [latex]8[\/latex], we determine the shared secret by raising her number to the power of our secret number modulus the prime: [latex]8^{2} \\bmod 23=64 \\bmod 23=18.18[\/latex] would be the shared secret.<\/p><\/div>\n<\/div>\n<\/section>\n","protected":false},"author":15,"menu_order":13,"template":"","meta":{"_candela_citation":"[]","pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"part":2245,"module-header":"fresh_take","content_attributions":[],"internal_book_links":[],"video_content":null,"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\/2250"}],"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":49,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/2250\/revisions"}],"predecessor-version":[{"id":15677,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/2250\/revisions\/15677"}],"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\/2250\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/media?parent=2250"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapter-type?post=2250"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/contributor?post=2250"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/license?post=2250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}