roles) || in_array('administrator', $user->roles) || in_array('admin', $user->roles ) ) { ?>
probname); ?>
Topic Classification: nid, "Topic Classification"); ?> Tags: nid, "Problem Tag");?>
Topics: nid, "Topics"); ?> Prerequisites: nid, "Prerequisites"); ?>
Supplies: nid, "Supplies"); ?> Pedagogy: nid, "Pedagogy"); ?>
Grade Vs Difficulty:
  EasyModerateChallengingPerplexing
1-2
3-4
5-6
7-8
9-10
11-12
13-14
Solution: nid, "Solution"); ?>
Problem

The code we'll describe in this exercise is due to Diffie and Hellman. It is a \emph{public-key code} because part of the code is known to everyone. Here's how it works: you and your friend choose a prime number $p$ and an integer $g$ between 2 and $p-1$. Both of these numbers are public (so, e.g., you two can safely discuss these numbers on the phone or over email---if someone wiretaps you, no problem).
Now you \emph{secretely} choose an integer $m$, and your friend \emph{secretely} chooses an integer $n$. You compute $g^m \bmod p$ and tell your friend the result. Your friend computs $g^n \bmod p$ and tells you the result. The secret key that you both can use is
\[
s \equiv g^{ mn } \equiv \left( g^m \right)^n \equiv \left( g^n \right)^m \bmod p \, .
\]
The last two equalities explain why both you and your friend can easily compute $s$.
You can now use $s$ to encode messages, e.g., using multiplication mod $p$, and $s^{ -1 }$ to decode.
Can you see why it's hard to compute $s$ if you know $p$, $g$, $g^m$, and $g^n$? How could you make this cryptosystem safer? Do you see a way to ``break" it?

Details
Contributer: Matt
Authors
nid); while ($data = db_fetch_object($authorresult)) { $authorfirstname = $data->firstname; $authorlastname = $data->lastname; $authors = $authorfirstname . ' ' . $authorlastname; print $authors; ?>
References
nid); if (mysql_num_rows($refresult) > 0 ) { ?> nmcreferenceid; $referenceauthor = $data->author; $referencetitle = $data->title; $referenceurl = $data->url; ?> 0 ) { print '
Reference Author Reference Title Reference URL
'; } ?>
nid); $totalSets = mysql_num_rows($setsResult); if ($totalSets > 0) { ?>
Problem Sets This Problem Belongs to:
parent_nid; ?> Set:
VARIABLES
nid, 1); while ($data = db_fetch_object($variablesresult)) { $variable = $data->elementdata; ?> •


DEFINITIONS
nid); while ($data = db_fetch_object($defresult)) { $definitionid = $data->nmcdefinitionid; $definition = $data->definition; $definitionname = $data->definitionname; ?> •