proj home

Files   Classes   Functions   Hierarchy  

passwordverifier001 Class Reference

Password verification without passing the passoword, instead evaluating a public one way function. More...

#include <passwordverifier001.h>

Collaboration diagram for passwordverifier001:
Collaboration graph

List of all members.

Public Member Functions

 passwordverifier001 (uintc nbits_)
 The number of bits is a measure of the solution space.
void generatePassword ()
 Randomly generate a nbits-1 password.
void generateRandomFunction ()
 j1 j2 n1 n2 k1 values are randomly generated.
void parameters_set (stringc &parameters)
 Set this classes parameters j1 j2 n1 n2 k1 as a string.
void parameters_get (string &parameters)
 Get/read the parameters j1 j2 n1 n2 k1.
void eval (ZZ &val) const
 Apply the one way function to the password.
void eval (string &val) const
 Apply the one way function to the password.
boolc verify (stringc &attempt) const
 The current one way function is evaluated and if its result is equal to the attemp true is returned.

Public Attributes

ZZ password
 The password is a nbit-1 or less bit number.
ZZ j1
 A variable in the one way function.
ZZ j2
 A variable in the one way function.
ZZ n1
 A variable in the one way function.
ZZ n2
 A variable in the one way function.
ZZ k1
 A variable in the one way function.
uintc nbits
 The strength is O(2^(nbits-1)).

Detailed Description

Password verification without passing the passoword, instead evaluating a public one way function.

The client and server are both represented by this class.

Definition at line 15 of file passwordverifier001.h.


Constructor & Destructor Documentation

passwordverifier001::passwordverifier001 ( uintc  nbits_  )  [inline]

The number of bits is a measure of the solution space.

Definition at line 36 of file passwordverifier001.h.

00037     : nbits(nbits_) {}


Member Function Documentation

void passwordverifier001::eval ( string &  val  )  const

Apply the one way function to the password.

Definition at line 27 of file passwordverifier001.cpp.

References eval().

00028 {
00029   ZZ w;
00030   eval(w);
00031 
00032   stringstream ss;
00033   ss << w;
00034   val = ss.str();
00035 }

void passwordverifier001::eval ( ZZ &  val  )  const

Apply the one way function to the password.

Definition at line 8 of file passwordverifier001.cpp.

References j1, j2, k1, n1, n2, and password.

Referenced by eval(), and passwordverifier001test::unittest01().

00009 {
00010   // The password must be less than n1
00011   // to go into the PowerMod funtion.
00012   // Further having it greater than n1
00013   // is meaningless.
00014   assert(password < n1);
00015 
00016 //cout << SHOW(password) << endl;
00017 //cout << SHOW(j1) << endl;
00018 //cout << SHOW(n1) <<endl;
00019   ZZ w;
00020   PowerMod(w,password%n1,j1,n1);
00021 //cout << SHOW(w) << endl;
00022   w += k1;
00023 //cout << SHOW(w) << endl;
00024   PowerMod(val,w%n2,j2,n2);
00025 }

void passwordverifier001::generatePassword (  ) 

Randomly generate a nbits-1 password.

Definition at line 114 of file passwordverifier001.cpp.

References nbits, and password.

Referenced by passwordverifier001test::unittest01().

00115 {
00116   random(password,nbits-1);
00117 }

void passwordverifier001::generateRandomFunction (  ) 

j1 j2 n1 n2 k1 values are randomly generated.

Definition at line 119 of file passwordverifier001.cpp.

References j1, j2, k1, n1, and nbits.

Referenced by passwordverifier001test::unittest01().

00120 {
00121   random(j1,nbits);
00122   random(j2,nbits);
00123   random(n1,nbits);
00124   random(n2,nbits);
00125   random(k1,nbits);
00126 }

void passwordverifier001::parameters_get ( string &  parameters  ) 

Get/read the parameters j1 j2 n1 n2 k1.

Definition at line 49 of file passwordverifier001.cpp.

Referenced by passwordverifier001test::unittest01().

00052 {
00053   parameters = "";
00054 
00055   string str;
00056   convInverse(str,j1);
00057   parameters += (str + " ");
00058   convInverse(str,j2);
00059   parameters += (str + " ");
00060   convInverse(str,n1);
00061   parameters += (str + " ");
00062   convInverse(str,n2);
00063   parameters += (str + " ");
00064   convInverse(str,k1);
00065   parameters += str;
00066 }

void passwordverifier001::parameters_set ( stringc parameters  ) 

Set this classes parameters j1 j2 n1 n2 k1 as a string.

Definition at line 80 of file passwordverifier001.cpp.

Referenced by passwordverifier001test::unittest01().

00083 {
00084   stringstream ss(parameters);
00085   string str;
00086 
00087   ss >> str;
00088   conv(j1,str.c_str());
00089 
00090   ss >> str;
00091   conv(j2,str.c_str());
00092 
00093   ss >> str;
00094   conv(n1,str.c_str());
00095 
00096   ss >> str;
00097   conv(n2,str.c_str());
00098 
00099   ss >> str;
00100   conv(k1,str.c_str());
00101 }

boolc passwordverifier001::verify ( stringc attempt  )  const

The current one way function is evaluated and if its result is equal to the attemp true is returned.

Definition at line 38 of file passwordverifier001.cpp.

Referenced by passwordverifier001test::unittest01().

00041 {
00042   string val;
00043   eval(val);
00044   
00045   return (attempt == val);
00046 }


Member Data Documentation

A variable in the one way function.

Definition at line 22 of file passwordverifier001.h.

Referenced by eval(), generateRandomFunction(), and passwordverifier001test::unittest01().

A variable in the one way function.

Definition at line 24 of file passwordverifier001.h.

Referenced by eval(), generateRandomFunction(), and passwordverifier001test::unittest01().

A variable in the one way function.

Definition at line 30 of file passwordverifier001.h.

Referenced by eval(), generateRandomFunction(), and passwordverifier001test::unittest01().

A variable in the one way function.

Definition at line 26 of file passwordverifier001.h.

Referenced by eval(), generateRandomFunction(), and passwordverifier001test::unittest01().

A variable in the one way function.

Definition at line 28 of file passwordverifier001.h.

Referenced by eval(), and passwordverifier001test::unittest01().

The strength is O(2^(nbits-1)).

Definition at line 33 of file passwordverifier001.h.

Referenced by generatePassword(), and generateRandomFunction().

The password is a nbit-1 or less bit number.

Definition at line 20 of file passwordverifier001.h.

Referenced by eval(), generatePassword(), and passwordverifier001test::unittest01().


The documentation for this class was generated from the following files:

Generated on 27 Nov 2012 for Chelton Evans Source by  doxygen 1.6.1