From bc7ad20e57d3cc85940bdcedf0f61bca6e16104a Mon Sep 17 00:00:00 2001 From: Hetav Panchani Date: Wed, 27 Mar 2019 01:30:53 +0530 Subject: [PATCH] added submit button to verify answers --- src/lab/exp6/Quizzes.html | 7 +++++++ src/lab/js/exp6/quiz_check.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/lab/js/exp6/quiz_check.js diff --git a/src/lab/exp6/Quizzes.html b/src/lab/exp6/Quizzes.html index 610030b..d471186 100644 --- a/src/lab/exp6/Quizzes.html +++ b/src/lab/exp6/Quizzes.html @@ -24,6 +24,7 @@ + @@ -105,6 +106,7 @@

Cryptographic Hash Functions and Applications(HMAC
  • Weak-collision-resistance
  • Strong-collision-resistance
  • None
  • +
  • Which criterion Ensures that it must be extremely difficult or impossible to create the message if the message digest is given.

      @@ -112,6 +114,7 @@

      Cryptographic Hash Functions and Applications(HMAC
    1. Weak-collision-resistance
    2. Strong-collision resistance
    3. None
    4. +

  • Consider the function h: {0,1}8 -> {0,1}4. Suppose h(x) = x xmod 5 mod 16, x in [0, 255]. The collision in h occurs for.

      @@ -119,6 +122,7 @@

      Cryptographic Hash Functions and Applications(HMAC
    1. (2, 16)
    2. (1, 16)
    3. (2, 17)
    4. +

  • The Merkle-Damgard Transform is mainly useful for

      @@ -126,7 +130,10 @@

      Cryptographic Hash Functions and Applications(HMAC
    1. Converting arbitrary length hash function to a fixed length hash function
    2. Constructing hash function from random function
    3. None
    4. +

  • + +

  • Understand HMAC scheme and find a break it using availble source code
  • Understand Merkel-Damgard transform and Explain,how we are using it for HMAC?
  • Understand and explain analogy between SHA1 and our dummy HMAC function
  • diff --git a/src/lab/js/exp6/quiz_check.js b/src/lab/js/exp6/quiz_check.js new file mode 100644 index 0000000..7bfdd2f --- /dev/null +++ b/src/lab/js/exp6/quiz_check.js @@ -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