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 #173 (and #204) #225

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
6 changes: 6 additions & 0 deletions src/lab/exp8/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/exp8/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 @@ -106,21 +107,26 @@ <h1 class="text-h2-lightblue">AES and Modes of Operation</h1><div class="content
<li><input name="quest_581" type="radio" value="Electronic code Block"/>Electronic code Block</li>
<li><input name="quest_581" type="radio" value="Electronic code Book"/>Electronic code Book</li>
<li><input name="quest_581" type="radio" value="Electronic cipher Book"/>Electronic cipher Book</li>
<p id="q1" style="display:none"></p>
</ul></li>
<li><p>Which among the following is not CPA secure?</p>
<ul class="multichoice">
<li><input name="quest_593" type="radio" value="ECB"/>ECB</li>
<li><input name="quest_593" type="radio" value="CBC"/>CBC</li>
<li><input name="quest_593" type="radio" value="CFB"/>CFB</li>
<li><input name="quest_593" type="radio" value="None"/>None</li>
<p id="q2" style="display:none"></p>
</ul></li>
<li><p>Which of the following are block ciphers?</p>
<ul class="multichoice">
<li><input name="quest_589" type="radio" value="ECB"/>ECB</li>
<li><input name="quest_589" type="radio" value="CBC"/>CBC</li>
<li><input name="quest_589" type="radio" value="CFB"/>CFB</li>
<li><input name="quest_589" type="radio" value="All"/>All</li>
<p id="q3" style="display:none"></p>
</ul></li>
<input type="button" value="Submit MCQ answers" onclick="gradeQuiz()"></input>
<br><br>
<li>Which is the fastest mode of operation among four mode of operation?</li>
<li>Which mode of operation is more secure?</li>
<li>What is importance of Intialiczation Vector(IV) and CTR ?</li>
Expand Down
33 changes: 33 additions & 0 deletions src/lab/js/exp8/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_581", "quest_593", "quest_589")
var ans_id = new Array("q1", "q2", "q3")
var answers = new Array(3, 1, 4);

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"
}
}
}