Skip to content

Commit

Permalink
add exercise 3a
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Nicholas Cunningham committed Aug 7, 2024
1 parent dbe4cef commit 2fba3e3
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 0 deletions.
1 change: 1 addition & 0 deletions classical_crypto.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions credits.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions el_gamal_encryption.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions exercise_five.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions exercise_four.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions exercise_one.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions exercise_three.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
184 changes: 184 additions & 0 deletions exercise_three_a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html>
<head>
<title>Crypto Exercises</title>
<link rel="stylesheet" href="./cryptoexercises-stylesheet.css" />
<script src="./sjcl/sjcl.js"></script>
<script src="./functions.js"></script>
</head>
<body onload="loadProblem()">
<!----------------------------------------------------------------------------->
<header>
<table class="headerTable" cellspacing="0">
<tr>
<td class="left">
<img class="bannerImage" src="./LLCipher_logo.png" alt="Llcipher logo" />
</td>
<td class="middle">
<p>Cryptography Challenges</p>
</td>
<td class="right">
<img class="lincolnLogo" src="./lincoln_logo.png" alt="Lincoln logo" />
</td>
</tr>
</table>
</header>
<!----------------------------------------------------------------------------->
<nav>
<ul>
<li><a href="./index.html">Home</a></li>
</ul>
<br />
<ul>
<li class="title">Background</li>
<li><a href="./el_gamal_encryption.html">El Gamal Encryption</a>
<li><a href="./rsa_encryption.html">RSA Encryption</a>
</ul>
<br />
<ul>
<li class="title">Challenges</li>
<li><a href="./classical_crypto.html">Classical Crypto</a></li>
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
<br />
<ul>
<li class="title">Other Stuff</li>
<li><a href="./references.html">References</a></li>
<li><a href="./credits.html">Credits</a></li>
</ul>
</nav>
<!----------------------------------------------------------------------------->
<article>
<table class="exerciseLayoutTable" cellspacing="0">
<tr>
<td class="exerciseDetails">
<h1>RSA Challenge Three (a): RSA Modulus Reuse</h1>
<div class="exerciseDescription">
<p><b>The Problem:</b> Given two RSA ciphertexts of the same message encrypted with the same modulus but different public keys, recover the plaintext.</p>
</div>
<div class="problemStatement">
<p>
Awfulland and Badland keep making strange choices with their keys - both of them are using the same modulus, even though their public keys are different.
Horridland has formed a new attack plan, and is sending an encrypted copy of the plan to Awfulland and Badland.
You've gotten a copy of both encrypted messages:
</p>
<ul>
<li>Awfulland's message, encrypted as c<sub>A</sub> =
m<sup>e<sub>A</sub></sup> mod N (using Awfulland's public exponent
e<sub>A</sub>), and</li>
<li>Badland's message, encrypted as c<sub>B</sub> = m<sup>e<sub>B</sub></sup>
mod N (using Badland's public exponent e<sub>B</sub>).</li>
</ul>
<p>Use the fact that both copies of the message are encrypted using the
same modulus to figure out what the evil plot is.</p>

<p>For this exercise, use the following values:</p>
<table class="exerciseValuesTable" cellspacing="0">
<tr class="headerRow">
<td class="name">Name</td>
<td class="value">Value</td>
</tr>
<tr class="oddRow">
<td class="name">Common modulus:</td>
<td class="value"><div id="modulus">153380639740849</div></td>
</tr>
<tr class="evenRow">
<td class="name">Ciphertext #1</td>
<td class="value"><div id="ciphertext_1">106230071531067</div></td>
</tr>
<tr class="oddRow">
<td class="name">Exponent #1</td>
<td class="value"><div id="exponent_1">1745</div></td>
</tr>
<tr class="evenRow">
<td class="name">Ciphertext #2</td>
<td class="value"><div id="ciphertext_2">51206346831694</div></td>
</tr>
<tr class="oddRow">
<td class="name">Exponent #2</td>
<td class="value"><div id="exponent_2">57</div></td>
</tr>
</table>

<form class="new_exercise">
<table class="answerFormTable" cellspacing="0">
<tr>
<td>
<!--
# The size of this text area is probably much smaller, but may
# also vary from exercise to exercise. The right answer is
# probably to see if this value can be moved into CSS, and
# then change the class name based on the exercise.
-->
<label class="answer" for="exercise_answer">Your Answer:</label>
<textarea class="answer" name="exercise[answer]" id="exercise_answer" cols="100" rows="20">
</textarea>
</td>
</tr>
<tr>
<td>
<!--
# Save the answer hash
-->
<input value="" type="hidden" id="ans_hash" />
<input type="submit" name="commit" value="Check Your Answer" onclick="checkAnswer(); return false;" />
<div id="anscheck_result"></div>
</td>
</tr>
</table>
</form>
</div>
<!-- Create and check problems -->
<script>
function loadProblem() {
// if you're still checking, please don't cheat
let answerhash = sjcl.hash.sha256.hash("Candy");
document.getElementById('ans_hash').value = answerhash;
return false;
}

function checkAnswer() {
let ans = document.getElementById('exercise_answer').value;
let anshash = sjcl.hash.sha256.hash(ans);
let realanshash = document.getElementById('ans_hash').value;
if (anshash == realanshash) {
document.getElementById('anscheck_result').innerHTML = "Correct!";
}
else {
document.getElementById('anscheck_result').innerHTML = "Incorrect";
}
return false;
}
</script>

</td>
<!-- start tool panel -->
<td class="cryptoToolkit">
<iframe
src="./toolpanel.html"
frameborder="0"
scrolling="yes"
seamless="seamless"
style="display:block;
width:100%;
height:85vh;"
>
</iframe>
</td>
<!-- end tool panel -->
</tr>
</table>
</article>
<!----------------------------------------------------------------------------->
<footer>
<small>
&copy; 2016, by Uri Blumenthal, Jeff Diewald, and Sophia Yakoubov, and 2024, by David Wilson and Nick Cunningham.
</small>
</footer>
</body>
</html>
1 change: 1 addition & 0 deletions exercise_two.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions references.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions rsa_encryption.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li><a href="./exercise_one.html">RSA Challenge One</a></li>
<li><a href="./exercise_two.html">RSA Challenge Two</a></li>
<li><a href="./exercise_three.html">RSA Challenge Three</a></li>
<li><a href="./exercise_three_a.html">RSA Challenge Three (a)</a></li>
<li><a href="./exercise_four.html">RSA Challenge Four</a></li>
<li><a href="./exercise_five.html">El Gamal Challenge</a></li>
</ul>
Expand Down

0 comments on commit 2fba3e3

Please sign in to comment.