Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #184 #229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lab/exp6/Quizzes.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<!-- Custom CSS -->
<link href="../../../css/style.css" rel="stylesheet">
<script type="text/javascript" src = 'tabs.js'></script>
<script type="text/javascript" src = '../js/exp6/quiz_check.js'></script>
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-67558473-1', 'auto');ga('send', 'pageview');</script>
</head>
<body id="page-top" class="index">
Expand Down Expand Up @@ -105,28 +106,34 @@ <h1 class="text-h2-lightblue">Cryptographic Hash Functions and Applications(HMAC
<li><input name="quest_590" type="radio" value="Weak-collision-resistance"/>Weak-collision-resistance</li>
<li><input name="quest_590" type="radio" value="Strong-collision-resistance "/>Strong-collision-resistance </li>
<li><input name="quest_590" type="radio" value="None"/>None</li>
<p id="q1" style="display:none"></p>
</ol></li>
<li><p>Which criterion Ensures that it must be extremely difficult or impossible to create the message if the message digest is given.</p>
<ol class="d">
<li><input name="quest_591" type="radio" value="One-wayness"/>One-wayness</li>
<li><input name="quest_591" type="radio" value="Weak-collision-resistance"/>Weak-collision-resistance</li>
<li><input name="quest_591" type="radio" value="Strong-collision resistance"/>Strong-collision resistance</li>
<li><input name="quest_591" type="radio" value="None"/>None</li>
<p id="q2" style="display:none"></p>
</ol></li>
<li><p>Consider the function h: {0,1}<sup>8</sup> -&gt; {0,1}<sup>4</sup>. Suppose h(x) = x <sup>xmod 5</sup> mod 16, x in [0, 255]. The collision in h occurs for.</p>
<ol class="d">
<li><input name="quest_594" type="radio" value="(1, 17)"/>(1, 17)</li>
<li><input name="quest_594" type="radio" value="(2, 16)"/>(2, 16)</li>
<li><input name="quest_594" type="radio" value="(1, 16)"/>(1, 16)</li>
<li><input name="quest_594" type="radio" value="(2, 17)"/>(2, 17)</li>
<p id="q3" style="display:none"></p>
</ol></li>
<li><p>The Merkle-Damgard Transform is mainly useful for</p>
<ol class="d">
<li><input name="quest_582" type="radio" value="Converting any fixed-length collision resistant hash function to an arbitrary length collision resistant hash function "/>Converting any fixed-length collision resistant hash function to an arbitrary length collision resistant hash function </li>
<li><input name="quest_582" type="radio" value="Converting arbitrary length hash function to a fixed length hash function "/>Converting arbitrary length hash function to a fixed length hash function </li>
<li><input name="quest_582" type="radio" value="Constructing hash function from random function "/>Constructing hash function from random function </li>
<li><input name="quest_582" type="radio" value="None"/>None</li>
<p id="q4" style="display:none"></p>
</ol></li>
<input type="button" value="Submit MCQ answers" onclick="gradeQuiz()"></input>
<br><br>
<li>Understand HMAC scheme and find a break it using availble source code</li>
<li>Understand Merkel-Damgard transform and Explain,how we are using it for HMAC? </li>
<li>Understand and explain analogy between SHA1 and our dummy HMAC function</li>
Expand Down
33 changes: 33 additions & 0 deletions src/lab/js/exp6/quiz_check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function checkAnswer(q_name, ans) {
var q = document.getElementsByName(q_name)
var valid = false
var i = 0
while (!valid && i < q.length) {
if(q[i].checked && i == (ans-1))
valid = true
i++
}
return valid
}

var question_id = new Array("quest_590", "quest_591", "quest_594", "quest_582")
var ans_id = new Array("q1", "q2", "q3", "q4")
var answers = new Array(1, 3, 1, 1);

function gradeQuiz() {
var i;
for(i=0; i<answers.length; i++) {
if(checkAnswer(question_id[i], answers[i])) {
var temp = document.getElementById(ans_id[i])
temp.style.display="block"
temp.innerHTML="Correct"
temp.style.color="Green"
}
else {
var temp = document.getElementById(ans_id[i])
temp.style.display="block"
temp.innerHTML="Incorret, The right answer is option " + answers[i]
temp.style.color="Red"
}
}
}