// Numbas version: finer_feedback_settings {"name": "Diffie Hellman Encryption", "extensions": ["numbertheory", "elliptic-curves"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Diffie Hellman Encryption", "tags": [], "metadata": {"description": "

This question runs the students through the Elliptic Curves version of Diffie Hellman.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "

Alice and Bob want to use Diffie-Hellman encryption using Elliptic Curves. They agree to use $E=\\var{curve}$ and the point $P=\\var{p}$.

", "advice": "

Alice's public key

\n

Since Alice's private key is $n_A = \\var{na}$, then the public key is $n_A\\cdot P = \\var{na}\\cdot\\var{p} = \\var{AliceM}$.

\n

Shared Secret

\n

Bob sent the message $\\var{bobm}$ and so Alice can find the shared secret by multiplying by the private key: $\\var{na}\\cdot\\var{bobm}=\\var{alicek}$.

", "rulesets": {}, "extensions": ["elliptic-curves", "numbertheory"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"m": {"name": "m", "group": "Ungrouped variables", "definition": "random(primelist(20,100))", "description": "", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "1", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-20..20)", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(-20..20 except 0)", "description": "", "templateType": "anything", "can_override": false}, "curve": {"name": "curve", "group": "Ungrouped variables", "definition": "curve(a,b,c,m)", "description": "", "templateType": "anything", "can_override": false}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "random(getpoints(curve))", "description": "", "templateType": "anything", "can_override": false}, "k": {"name": "k", "group": "Ungrouped variables", "definition": "order(p)", "description": "", "templateType": "anything", "can_override": false}, "na": {"name": "na", "group": "Ungrouped variables", "definition": "random(2..k-1)", "description": "", "templateType": "anything", "can_override": false}, "nb": {"name": "nb", "group": "Ungrouped variables", "definition": "random(2..k-1)", "description": "", "templateType": "anything", "can_override": false}, "AliceM": {"name": "AliceM", "group": "Ungrouped variables", "definition": "na*p", "description": "", "templateType": "anything", "can_override": false}, "BobM": {"name": "BobM", "group": "Ungrouped variables", "definition": "nb*P", "description": "", "templateType": "anything", "can_override": false}, "AliceK": {"name": "AliceK", "group": "Ungrouped variables", "definition": "na*BobM", "description": "", "templateType": "anything", "can_override": false}, "BobK": {"name": "BobK", "group": "Ungrouped variables", "definition": "nb*AliceM", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "k<> Infinity and k>4 and k<10", "maxRuns": 100}, "ungrouped_variables": ["m", "a", "b", "c", "curve", "p", "k", "na", "nb", "AliceM", "BobM", "AliceK", "BobK"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Alice's public key", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Alice chooses the secret key $\\var{na}$. What message does she send Bob? The message must be a point. Enter x,y. ([[0]],[[1]]).

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "x", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(AliceM,'x')", "maxValue": "get(AliceM,'x')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "y", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(AliceM,'y')", "maxValue": "get(AliceM,'y')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Shared Key", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Alice receives Bob's public key $\\var{BobM}$. What is Alice and Bob's shared secret? The shared secret must be a point. Enter x,y. ([[0]],[[1]]).

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "x", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(AliceK,'x')", "maxValue": "get(AliceK,'x')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "y", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "get(AliceK,'y')", "maxValue": "get(AliceK,'y')", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}, {"name": "Guillermo Pineda", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/20075/"}], "resources": []}]}], "contributors": [{"name": "Julien Ugon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3575/"}, {"name": "Guillermo Pineda", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/20075/"}]}