Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 07dfcfe50d66c9a48a3c5e6c1693f12a > files > 26

cryptopp-doc-5.6.1-0.1.svn479.fc13.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Crypto++: bench2.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>bench2.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// bench2.cpp - written and placed in the public domain by Wei Dai</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="preprocessor">#include &quot;bench.h&quot;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;rng.h&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;files.h&quot;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &quot;hex.h&quot;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;<a class="code" href="rsa_8h.html" title="This file contains classes that implement the RSA ciphers and signature schemes as...">rsa.h</a>&quot;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &quot;nr.h&quot;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;<a class="code" href="dsa_8h.html">dsa.h</a>&quot;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;<a class="code" href="luc_8h.html">luc.h</a>&quot;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;<a class="code" href="rw_8h.html" title="This file contains classes that implement the Rabin-Williams signature schemes as...">rw.h</a>&quot;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;<a class="code" href="eccrypto_8h.html">eccrypto.h</a>&quot;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;ecp.h&quot;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;ec2n.h&quot;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;asn.h&quot;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &quot;<a class="code" href="dh_8h.html">dh.h</a>&quot;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="mqv_8h.html">mqv.h</a>&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="xtrcrypt_8h.html" title="&amp;quot;The XTR public key system&amp;quot; by Arjen K.">xtrcrypt.h</a>&quot;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="esign_8h.html" title="This file contains classes that implement the ESIGN signature schemes as defined...">esign.h</a>&quot;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;pssr.h&quot;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;oids.h&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;randpool.h&quot;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;time.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;math.h&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;iomanip&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 USING_NAMESPACE(CryptoPP)
<a name="l00031"></a>00031 USING_NAMESPACE(std)
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keywordtype">void</span> OutputResultOperations(const <span class="keywordtype">char</span> *name, const <span class="keywordtype">char</span> *operation, <span class="keywordtype">bool</span> pc, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> iterations, <span class="keywordtype">double</span> timeTaken);
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="keywordtype">void</span> BenchMarkEncryption(const <span class="keywordtype">char</span> *name, <a class="code" href="class_p_k___encryptor.html" title="interface for public-key encryptors">PK_Encryptor</a> &amp;key, <span class="keywordtype">double</span> timeTotal, <span class="keywordtype">bool</span> pc=false)
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len = 16;
<a name="l00038"></a>00038         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00039"></a>00039         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> plaintext(len), ciphertext(key.CiphertextLength(len));
<a name="l00040"></a>00040         rng.GenerateBlock(plaintext, len);
<a name="l00041"></a>00041 
<a name="l00042"></a>00042         clock_t start = clock();
<a name="l00043"></a>00043         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00044"></a>00044         <span class="keywordtype">double</span> timeTaken;
<a name="l00045"></a>00045         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
<a name="l00046"></a>00046                 key.Encrypt(rng, plaintext, len, ciphertext);
<a name="l00047"></a>00047 
<a name="l00048"></a>00048         OutputResultOperations(name, <span class="stringliteral">&quot;Encryption&quot;</span>, pc, i, timeTaken);
<a name="l00049"></a>00049 
<a name="l00050"></a>00050         <span class="keywordflow">if</span> (!pc &amp;&amp; key.GetMaterial().SupportsPrecomputation())
<a name="l00051"></a>00051         {
<a name="l00052"></a>00052                 key.AccessMaterial().Precompute(16);
<a name="l00053"></a>00053                 BenchMarkEncryption(name, key, timeTotal, <span class="keyword">true</span>);
<a name="l00054"></a>00054         }
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="keywordtype">void</span> BenchMarkDecryption(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <a class="code" href="class_p_k___decryptor.html" title="interface for public-key decryptors">PK_Decryptor</a> &amp;priv, <a class="code" href="class_p_k___encryptor.html" title="interface for public-key encryptors">PK_Encryptor</a> &amp;pub, <span class="keywordtype">double</span> timeTotal)
<a name="l00058"></a>00058 {
<a name="l00059"></a>00059         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len = 16;
<a name="l00060"></a>00060         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00061"></a>00061         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> ciphertext(pub.<a class="code" href="class_p_k___crypto_system.html#abf04a4e08fb69a1a118bad3e998ef6a6" title="calculate length of ciphertext given length of plaintext">CiphertextLength</a>(len));
<a name="l00062"></a>00062         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> plaintext(pub.<a class="code" href="class_p_k___crypto_system.html#aa4a3552c933a36b3aea26f31d00bee9b" title="maximum length of plaintext for a given ciphertext length">MaxPlaintextLength</a>(ciphertext.size()));
<a name="l00063"></a>00063         rng.GenerateBlock(plaintext, len);
<a name="l00064"></a>00064         pub.<a class="code" href="class_p_k___encryptor.html#aecb519bc1cb0b261698be999bb5c8961" title="encrypt a byte string">Encrypt</a>(rng, plaintext, len, ciphertext);
<a name="l00065"></a>00065 
<a name="l00066"></a>00066         clock_t start = clock();
<a name="l00067"></a>00067         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00068"></a>00068         <span class="keywordtype">double</span> timeTaken;
<a name="l00069"></a>00069         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
<a name="l00070"></a>00070                 priv.<a class="code" href="class_p_k___decryptor.html#ab7466675ed050c440c16508f8a88cac1" title="decrypt a byte string, and return the length of plaintext">Decrypt</a>(rng, ciphertext, ciphertext.size(), plaintext);
<a name="l00071"></a>00071 
<a name="l00072"></a>00072         OutputResultOperations(name, <span class="stringliteral">&quot;Decryption&quot;</span>, <span class="keyword">false</span>, i, timeTaken);
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 <span class="keywordtype">void</span> BenchMarkSigning(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <a class="code" href="class_p_k___signer.html" title="interface for public-key signers">PK_Signer</a> &amp;key, <span class="keywordtype">double</span> timeTotal, <span class="keywordtype">bool</span> pc=<span class="keyword">false</span>)
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len = 16;
<a name="l00078"></a>00078         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00079"></a>00079         <a class="code" href="class_sec_block.html">AlignedSecByteBlock</a> message(len), signature(key.<a class="code" href="class_p_k___signature_scheme.html#aab30ad8e2da2d706cf6c69bdac963afc" title="signature length if it only depends on the key, otherwise 0">SignatureLength</a>());
<a name="l00080"></a>00080         rng.GenerateBlock(message, len);
<a name="l00081"></a>00081 
<a name="l00082"></a>00082         clock_t start = clock();
<a name="l00083"></a>00083         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00084"></a>00084         <span class="keywordtype">double</span> timeTaken;
<a name="l00085"></a>00085         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
<a name="l00086"></a>00086                 key.<a class="code" href="class_p_k___signer.html#a08920dfd51f5d0d8e5f77c8f20b56ce2" title="sign a message">SignMessage</a>(rng, message, len, signature);
<a name="l00087"></a>00087 
<a name="l00088"></a>00088         OutputResultOperations(name, <span class="stringliteral">&quot;Signature&quot;</span>, pc, i, timeTaken);
<a name="l00089"></a>00089 
<a name="l00090"></a>00090         <span class="keywordflow">if</span> (!pc &amp;&amp; key.<a class="code" href="class_private_key_algorithm.html#a0199217f43af73a6ad78fe1303903fe3" title="returns a const reference to the crypto material used by this object">GetMaterial</a>().<a class="code" href="class_crypto_material.html#a64ab4ff4adfcfc2da59706ac32895b50">SupportsPrecomputation</a>())
<a name="l00091"></a>00091         {
<a name="l00092"></a>00092                 key.<a class="code" href="class_private_key_algorithm.html#a48cf4528f16263f2200d5b908a0b8ffb" title="returns a reference to the crypto material used by this object">AccessMaterial</a>().<a class="code" href="class_crypto_material.html#a39e512d2ea70d0e967db98c19994a7fd" title="do precomputation">Precompute</a>(16);
<a name="l00093"></a>00093                 BenchMarkSigning(name, key, timeTotal, <span class="keyword">true</span>);
<a name="l00094"></a>00094         }
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="keywordtype">void</span> BenchMarkVerification(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> <a class="code" href="class_p_k___signer.html" title="interface for public-key signers">PK_Signer</a> &amp;priv, <a class="code" href="class_p_k___verifier.html" title="interface for public-key signature verifiers">PK_Verifier</a> &amp;pub, <span class="keywordtype">double</span> timeTotal, <span class="keywordtype">bool</span> pc=<span class="keyword">false</span>)
<a name="l00098"></a>00098 {
<a name="l00099"></a>00099         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len = 16;
<a name="l00100"></a>00100         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00101"></a>00101         <a class="code" href="class_sec_block.html">AlignedSecByteBlock</a> message(len), signature(pub.<a class="code" href="class_p_k___signature_scheme.html#aab30ad8e2da2d706cf6c69bdac963afc" title="signature length if it only depends on the key, otherwise 0">SignatureLength</a>());
<a name="l00102"></a>00102         rng.GenerateBlock(message, len);
<a name="l00103"></a>00103         priv.<a class="code" href="class_p_k___signer.html#a08920dfd51f5d0d8e5f77c8f20b56ce2" title="sign a message">SignMessage</a>(rng, message, len, signature);
<a name="l00104"></a>00104 
<a name="l00105"></a>00105         clock_t start = clock();
<a name="l00106"></a>00106         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00107"></a>00107         <span class="keywordtype">double</span> timeTaken;
<a name="l00108"></a>00108         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
<a name="l00109"></a>00109                 pub.<a class="code" href="class_p_k___verifier.html#a4640a967fd291f8be86c1b721dc73b2d" title="check whether input signature is a valid signature for input message">VerifyMessage</a>(message, len, signature, signature.size());
<a name="l00110"></a>00110 
<a name="l00111"></a>00111         OutputResultOperations(name, <span class="stringliteral">&quot;Verification&quot;</span>, pc, i, timeTaken);
<a name="l00112"></a>00112 
<a name="l00113"></a>00113         <span class="keywordflow">if</span> (!pc &amp;&amp; pub.<a class="code" href="class_public_key_algorithm.html#aadbb6acca8905a61d75f1951d53a90e5" title="returns a const reference to the crypto material used by this object">GetMaterial</a>().<a class="code" href="class_crypto_material.html#a64ab4ff4adfcfc2da59706ac32895b50">SupportsPrecomputation</a>())
<a name="l00114"></a>00114         {
<a name="l00115"></a>00115                 pub.<a class="code" href="class_public_key_algorithm.html#a74b77db3086e07caf5506fda9ec204e7" title="returns a reference to the crypto material used by this object">AccessMaterial</a>().<a class="code" href="class_crypto_material.html#a39e512d2ea70d0e967db98c19994a7fd" title="do precomputation">Precompute</a>(16);
<a name="l00116"></a>00116                 BenchMarkVerification(name, priv, pub, timeTotal, <span class="keyword">true</span>);
<a name="l00117"></a>00117         }
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119 
<a name="l00120"></a>00120 <span class="keywordtype">void</span> BenchMarkKeyGen(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <a class="code" href="class_simple_key_agreement_domain.html" title="interface for domains of simple key agreement protocols">SimpleKeyAgreementDomain</a> &amp;d, <span class="keywordtype">double</span> timeTotal, <span class="keywordtype">bool</span> pc=<span class="keyword">false</span>)
<a name="l00121"></a>00121 {
<a name="l00122"></a>00122         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00123"></a>00123         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> priv(d.<a class="code" href="class_simple_key_agreement_domain.html#a8e2e4c5ab6584e4aef0c6da6b122a668" title="return length of private keys in this domain">PrivateKeyLength</a>()), pub(d.<a class="code" href="class_simple_key_agreement_domain.html#a717ec0ad52950f8d792466ad591b5104" title="return length of public keys in this domain">PublicKeyLength</a>());
<a name="l00124"></a>00124 
<a name="l00125"></a>00125         clock_t start = clock();
<a name="l00126"></a>00126         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00127"></a>00127         <span class="keywordtype">double</span> timeTaken;
<a name="l00128"></a>00128         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
<a name="l00129"></a>00129                 d.<a class="code" href="class_simple_key_agreement_domain.html#a75629cd8157dca667c6aff0562ca59af" title="generate private/public key pair">GenerateKeyPair</a>(rng, priv, pub);
<a name="l00130"></a>00130 
<a name="l00131"></a>00131         OutputResultOperations(name, <span class="stringliteral">&quot;Key-Pair Generation&quot;</span>, pc, i, timeTaken);
<a name="l00132"></a>00132 
<a name="l00133"></a>00133         <span class="keywordflow">if</span> (!pc &amp;&amp; d.<a class="code" href="class_key_agreement_algorithm.html#aeef052b9f5db7aa72d451c272e578e47" title="returns a const reference to the crypto material used by this object">GetMaterial</a>().<a class="code" href="class_crypto_material.html#a64ab4ff4adfcfc2da59706ac32895b50">SupportsPrecomputation</a>())
<a name="l00134"></a>00134         {
<a name="l00135"></a>00135                 d.<a class="code" href="class_key_agreement_algorithm.html#ab9c52198ff0dd877243c9520d96beaaa" title="returns a reference to the crypto material used by this object">AccessMaterial</a>().<a class="code" href="class_crypto_material.html#a39e512d2ea70d0e967db98c19994a7fd" title="do precomputation">Precompute</a>(16);
<a name="l00136"></a>00136                 BenchMarkKeyGen(name, d, timeTotal, <span class="keyword">true</span>);
<a name="l00137"></a>00137         }
<a name="l00138"></a>00138 }
<a name="l00139"></a>00139 
<a name="l00140"></a>00140 <span class="keywordtype">void</span> BenchMarkKeyGen(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <a class="code" href="class_authenticated_key_agreement_domain.html" title="interface for domains of authenticated key agreement protocols">AuthenticatedKeyAgreementDomain</a> &amp;d, <span class="keywordtype">double</span> timeTotal, <span class="keywordtype">bool</span> pc=<span class="keyword">false</span>)
<a name="l00141"></a>00141 {
<a name="l00142"></a>00142         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00143"></a>00143         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> priv(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a449deae54019f6dfc9677e721a193004" title="return length of ephemeral private keys in this domain">EphemeralPrivateKeyLength</a>()), pub(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a3dbef507ea4fd300ad8b2afb4d7afbe9" title="return length of ephemeral public keys in this domain">EphemeralPublicKeyLength</a>());
<a name="l00144"></a>00144 
<a name="l00145"></a>00145         clock_t start = clock();
<a name="l00146"></a>00146         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00147"></a>00147         <span class="keywordtype">double</span> timeTaken;
<a name="l00148"></a>00148         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
<a name="l00149"></a>00149                 d.<a class="code" href="class_authenticated_key_agreement_domain.html#a18f1fc5fa590be704d53759e44fba093" title="generate private/public key pair">GenerateEphemeralKeyPair</a>(rng, priv, pub);
<a name="l00150"></a>00150 
<a name="l00151"></a>00151         OutputResultOperations(name, <span class="stringliteral">&quot;Key-Pair Generation&quot;</span>, pc, i, timeTaken);
<a name="l00152"></a>00152 
<a name="l00153"></a>00153         <span class="keywordflow">if</span> (!pc &amp;&amp; d.<a class="code" href="class_key_agreement_algorithm.html#aeef052b9f5db7aa72d451c272e578e47" title="returns a const reference to the crypto material used by this object">GetMaterial</a>().<a class="code" href="class_crypto_material.html#a64ab4ff4adfcfc2da59706ac32895b50">SupportsPrecomputation</a>())
<a name="l00154"></a>00154         {
<a name="l00155"></a>00155                 d.<a class="code" href="class_key_agreement_algorithm.html#ab9c52198ff0dd877243c9520d96beaaa" title="returns a reference to the crypto material used by this object">AccessMaterial</a>().<a class="code" href="class_crypto_material.html#a39e512d2ea70d0e967db98c19994a7fd" title="do precomputation">Precompute</a>(16);
<a name="l00156"></a>00156                 BenchMarkKeyGen(name, d, timeTotal, <span class="keyword">true</span>);
<a name="l00157"></a>00157         }
<a name="l00158"></a>00158 }
<a name="l00159"></a>00159 
<a name="l00160"></a>00160 <span class="keywordtype">void</span> BenchMarkAgreement(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <a class="code" href="class_simple_key_agreement_domain.html" title="interface for domains of simple key agreement protocols">SimpleKeyAgreementDomain</a> &amp;d, <span class="keywordtype">double</span> timeTotal, <span class="keywordtype">bool</span> pc=<span class="keyword">false</span>)
<a name="l00161"></a>00161 {
<a name="l00162"></a>00162         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00163"></a>00163         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> priv1(d.<a class="code" href="class_simple_key_agreement_domain.html#a8e2e4c5ab6584e4aef0c6da6b122a668" title="return length of private keys in this domain">PrivateKeyLength</a>()), priv2(d.<a class="code" href="class_simple_key_agreement_domain.html#a8e2e4c5ab6584e4aef0c6da6b122a668" title="return length of private keys in this domain">PrivateKeyLength</a>());
<a name="l00164"></a>00164         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> pub1(d.<a class="code" href="class_simple_key_agreement_domain.html#a717ec0ad52950f8d792466ad591b5104" title="return length of public keys in this domain">PublicKeyLength</a>()), pub2(d.<a class="code" href="class_simple_key_agreement_domain.html#a717ec0ad52950f8d792466ad591b5104" title="return length of public keys in this domain">PublicKeyLength</a>());
<a name="l00165"></a>00165         d.<a class="code" href="class_simple_key_agreement_domain.html#a75629cd8157dca667c6aff0562ca59af" title="generate private/public key pair">GenerateKeyPair</a>(rng, priv1, pub1);
<a name="l00166"></a>00166         d.<a class="code" href="class_simple_key_agreement_domain.html#a75629cd8157dca667c6aff0562ca59af" title="generate private/public key pair">GenerateKeyPair</a>(rng, priv2, pub2);
<a name="l00167"></a>00167         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> val(d.<a class="code" href="class_simple_key_agreement_domain.html#aedb873e4aa6fc15ac5245b7af04e4946" title="return length of agreed value produced">AgreedValueLength</a>());
<a name="l00168"></a>00168 
<a name="l00169"></a>00169         clock_t start = clock();
<a name="l00170"></a>00170         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00171"></a>00171         <span class="keywordtype">double</span> timeTaken;
<a name="l00172"></a>00172         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i+=2)
<a name="l00173"></a>00173         {
<a name="l00174"></a>00174                 d.<a class="code" href="class_simple_key_agreement_domain.html#a732339ca730408cca7b1191fc32eb39e" title="derive agreed value from your private key and couterparty&amp;#39;s public key, return...">Agree</a>(val, priv1, pub2);
<a name="l00175"></a>00175                 d.<a class="code" href="class_simple_key_agreement_domain.html#a732339ca730408cca7b1191fc32eb39e" title="derive agreed value from your private key and couterparty&amp;#39;s public key, return...">Agree</a>(val, priv2, pub1);
<a name="l00176"></a>00176         }
<a name="l00177"></a>00177 
<a name="l00178"></a>00178         OutputResultOperations(name, <span class="stringliteral">&quot;Key Agreement&quot;</span>, pc, i, timeTaken);
<a name="l00179"></a>00179 }
<a name="l00180"></a>00180 
<a name="l00181"></a>00181 <span class="keywordtype">void</span> BenchMarkAgreement(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <a class="code" href="class_authenticated_key_agreement_domain.html" title="interface for domains of authenticated key agreement protocols">AuthenticatedKeyAgreementDomain</a> &amp;d, <span class="keywordtype">double</span> timeTotal, <span class="keywordtype">bool</span> pc=<span class="keyword">false</span>)
<a name="l00182"></a>00182 {
<a name="l00183"></a>00183         <a class="code" href="class_l_c___r_n_g.html" title="linear congruential generator">LC_RNG</a> rng((word32)time(NULL));
<a name="l00184"></a>00184         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> spriv1(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a1ede4e454e74031ec0f0786dc2a14ddf" title="return length of static private keys in this domain">StaticPrivateKeyLength</a>()), spriv2(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a1ede4e454e74031ec0f0786dc2a14ddf" title="return length of static private keys in this domain">StaticPrivateKeyLength</a>());
<a name="l00185"></a>00185         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> epriv1(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a449deae54019f6dfc9677e721a193004" title="return length of ephemeral private keys in this domain">EphemeralPrivateKeyLength</a>()), epriv2(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a449deae54019f6dfc9677e721a193004" title="return length of ephemeral private keys in this domain">EphemeralPrivateKeyLength</a>());
<a name="l00186"></a>00186         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> spub1(d.<a class="code" href="class_authenticated_key_agreement_domain.html#aa7a7a1a641b21fb55cfec96cbf029795" title="return length of static public keys in this domain">StaticPublicKeyLength</a>()), spub2(d.<a class="code" href="class_authenticated_key_agreement_domain.html#aa7a7a1a641b21fb55cfec96cbf029795" title="return length of static public keys in this domain">StaticPublicKeyLength</a>());
<a name="l00187"></a>00187         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> epub1(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a3dbef507ea4fd300ad8b2afb4d7afbe9" title="return length of ephemeral public keys in this domain">EphemeralPublicKeyLength</a>()), epub2(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a3dbef507ea4fd300ad8b2afb4d7afbe9" title="return length of ephemeral public keys in this domain">EphemeralPublicKeyLength</a>());
<a name="l00188"></a>00188         d.<a class="code" href="class_authenticated_key_agreement_domain.html#ae2c306a6582c6e592ecb2c13abfd7c9f" title="generate private/public key pair">GenerateStaticKeyPair</a>(rng, spriv1, spub1);
<a name="l00189"></a>00189         d.<a class="code" href="class_authenticated_key_agreement_domain.html#ae2c306a6582c6e592ecb2c13abfd7c9f" title="generate private/public key pair">GenerateStaticKeyPair</a>(rng, spriv2, spub2);
<a name="l00190"></a>00190         d.<a class="code" href="class_authenticated_key_agreement_domain.html#a18f1fc5fa590be704d53759e44fba093" title="generate private/public key pair">GenerateEphemeralKeyPair</a>(rng, epriv1, epub1);
<a name="l00191"></a>00191         d.<a class="code" href="class_authenticated_key_agreement_domain.html#a18f1fc5fa590be704d53759e44fba093" title="generate private/public key pair">GenerateEphemeralKeyPair</a>(rng, epriv2, epub2);
<a name="l00192"></a>00192         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> val(d.<a class="code" href="class_authenticated_key_agreement_domain.html#a98ff4ab957b445060f06c95636a098ea" title="return length of agreed value produced">AgreedValueLength</a>());
<a name="l00193"></a>00193 
<a name="l00194"></a>00194         clock_t start = clock();
<a name="l00195"></a>00195         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
<a name="l00196"></a>00196         <span class="keywordtype">double</span> timeTaken;
<a name="l00197"></a>00197         <span class="keywordflow">for</span> (timeTaken=(<span class="keywordtype">double</span>)0, i=0; timeTaken &lt; timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i+=2)
<a name="l00198"></a>00198         {
<a name="l00199"></a>00199                 d.<a class="code" href="class_authenticated_key_agreement_domain.html#ac9808fb56eacee0c08a9bbd22fe2c98e" title="derive agreed value from your private keys and couterparty&amp;#39;s public keys, return...">Agree</a>(val, spriv1, epriv1, spub2, epub2);
<a name="l00200"></a>00200                 d.<a class="code" href="class_authenticated_key_agreement_domain.html#ac9808fb56eacee0c08a9bbd22fe2c98e" title="derive agreed value from your private keys and couterparty&amp;#39;s public keys, return...">Agree</a>(val, spriv2, epriv2, spub1, epub1);
<a name="l00201"></a>00201         }
<a name="l00202"></a>00202 
<a name="l00203"></a>00203         OutputResultOperations(name, <span class="stringliteral">&quot;Key Agreement&quot;</span>, pc, i, timeTaken);
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 
<a name="l00206"></a>00206 <span class="comment">//VC60 workaround: compiler bug triggered without the extra dummy parameters</span>
<a name="l00207"></a>00207 <span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME&gt;
<a name="l00208"></a>00208 <span class="keywordtype">void</span> BenchMarkCrypto(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">double</span> timeTotal, SCHEME *x=NULL)
<a name="l00209"></a>00209 {
<a name="l00210"></a>00210         <a class="code" href="class_file_source.html" title="file-based implementation of Source interface">FileSource</a> f(filename, <span class="keyword">true</span>, <span class="keyword">new</span> <a class="code" href="class_hex_decoder.html" title="Decode base 16 data back to bytes.">HexDecoder</a>());
<a name="l00211"></a>00211         <span class="keyword">typename</span> SCHEME::Decryptor priv(f);
<a name="l00212"></a>00212         <span class="keyword">typename</span> SCHEME::Encryptor pub(priv);
<a name="l00213"></a>00213         BenchMarkEncryption(name, pub, timeTotal);
<a name="l00214"></a>00214         BenchMarkDecryption(name, priv, pub, timeTotal);
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 
<a name="l00217"></a>00217 <span class="comment">//VC60 workaround: compiler bug triggered without the extra dummy parameters</span>
<a name="l00218"></a>00218 <span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME&gt;
<a name="l00219"></a>00219 <span class="keywordtype">void</span> BenchMarkSignature(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">double</span> timeTotal, SCHEME *x=NULL)
<a name="l00220"></a>00220 {
<a name="l00221"></a>00221         <a class="code" href="class_file_source.html" title="file-based implementation of Source interface">FileSource</a> f(filename, <span class="keyword">true</span>, <span class="keyword">new</span> <a class="code" href="class_hex_decoder.html" title="Decode base 16 data back to bytes.">HexDecoder</a>());
<a name="l00222"></a>00222         <span class="keyword">typename</span> SCHEME::Signer priv(f);
<a name="l00223"></a>00223         <span class="keyword">typename</span> SCHEME::Verifier pub(priv);
<a name="l00224"></a>00224         BenchMarkSigning(name, priv, timeTotal);
<a name="l00225"></a>00225         BenchMarkVerification(name, priv, pub, timeTotal);
<a name="l00226"></a>00226 }
<a name="l00227"></a>00227 
<a name="l00228"></a>00228 <span class="comment">//VC60 workaround: compiler bug triggered without the extra dummy parameters</span>
<a name="l00229"></a>00229 <span class="keyword">template</span> &lt;<span class="keyword">class</span> D&gt;
<a name="l00230"></a>00230 <span class="keywordtype">void</span> BenchMarkKeyAgreement(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">double</span> timeTotal, D *x=NULL)
<a name="l00231"></a>00231 {
<a name="l00232"></a>00232         <a class="code" href="class_file_source.html" title="file-based implementation of Source interface">FileSource</a> f(filename, <span class="keyword">true</span>, <span class="keyword">new</span> <a class="code" href="class_hex_decoder.html" title="Decode base 16 data back to bytes.">HexDecoder</a>());
<a name="l00233"></a>00233         D d(f);
<a name="l00234"></a>00234         BenchMarkKeyGen(name, d, timeTotal);
<a name="l00235"></a>00235         BenchMarkAgreement(name, d, timeTotal);
<a name="l00236"></a>00236 }
<a name="l00237"></a>00237 
<a name="l00238"></a>00238 <span class="keyword">extern</span> <span class="keywordtype">double</span> g_hertz;
<a name="l00239"></a>00239 
<a name="l00240"></a>00240 <span class="keywordtype">void</span> BenchmarkAll2(<span class="keywordtype">double</span> t, <span class="keywordtype">double</span> hertz)
<a name="l00241"></a>00241 {
<a name="l00242"></a>00242         g_hertz = hertz;
<a name="l00243"></a>00243 
<a name="l00244"></a>00244         cout &lt;&lt; <span class="stringliteral">&quot;&lt;TABLE border=1&gt;&lt;COLGROUP&gt;&lt;COL align=left&gt;&lt;COL align=right&gt;&lt;COL align=right&gt;&quot;</span> &lt;&lt; endl;
<a name="l00245"></a>00245         cout &lt;&lt; <span class="stringliteral">&quot;&lt;THEAD&gt;&lt;TR&gt;&lt;TH&gt;Operation&lt;TH&gt;Milliseconds/Operation&quot;</span> &lt;&lt; (g_hertz ? <span class="stringliteral">&quot;&lt;TH&gt;Megacycles/Operation&quot;</span> : <span class="stringliteral">&quot;&quot;</span>) &lt;&lt; endl;
<a name="l00246"></a>00246 
<a name="l00247"></a>00247         cout &lt;&lt; <span class="stringliteral">&quot;\n&lt;TBODY style=\&quot;background: yellow\&quot;&gt;&quot;</span>;
<a name="l00248"></a>00248         BenchMarkCrypto&lt;RSAES&lt;OAEP&lt;SHA&gt; &gt; &gt;(<span class="stringliteral">&quot;TestData/rsa1024.dat&quot;</span>, <span class="stringliteral">&quot;RSA 1024&quot;</span>, t);
<a name="l00249"></a>00249         BenchMarkCrypto&lt;LUCES&lt;OAEP&lt;SHA&gt; &gt; &gt;(<span class="stringliteral">&quot;TestData/luc1024.dat&quot;</span>, <span class="stringliteral">&quot;LUC 1024&quot;</span>, t);
<a name="l00250"></a>00250         BenchMarkCrypto&lt;DLIES&lt;&gt; &gt;(<span class="stringliteral">&quot;TestData/dlie1024.dat&quot;</span>, <span class="stringliteral">&quot;DLIES 1024&quot;</span>, t);
<a name="l00251"></a>00251         BenchMarkCrypto&lt;LUC_IES&lt;&gt; &gt;(<span class="stringliteral">&quot;TestData/lucc512.dat&quot;</span>, <span class="stringliteral">&quot;LUCELG 512&quot;</span>, t);
<a name="l00252"></a>00252 
<a name="l00253"></a>00253         cout &lt;&lt; <span class="stringliteral">&quot;\n&lt;TBODY style=\&quot;background: white\&quot;&gt;&quot;</span>;
<a name="l00254"></a>00254         BenchMarkCrypto&lt;RSAES&lt;OAEP&lt;SHA&gt; &gt; &gt;(<span class="stringliteral">&quot;TestData/rsa2048.dat&quot;</span>, <span class="stringliteral">&quot;RSA 2048&quot;</span>, t);
<a name="l00255"></a>00255         BenchMarkCrypto&lt;LUCES&lt;OAEP&lt;SHA&gt; &gt; &gt;(<span class="stringliteral">&quot;TestData/luc2048.dat&quot;</span>, <span class="stringliteral">&quot;LUC 2048&quot;</span>, t);
<a name="l00256"></a>00256         BenchMarkCrypto&lt;DLIES&lt;&gt; &gt;(<span class="stringliteral">&quot;TestData/dlie2048.dat&quot;</span>, <span class="stringliteral">&quot;DLIES 2048&quot;</span>, t);
<a name="l00257"></a>00257         BenchMarkCrypto&lt;LUC_IES&lt;&gt; &gt;(<span class="stringliteral">&quot;TestData/lucc1024.dat&quot;</span>, <span class="stringliteral">&quot;LUCELG 1024&quot;</span>, t);
<a name="l00258"></a>00258 
<a name="l00259"></a>00259         cout &lt;&lt; <span class="stringliteral">&quot;\n&lt;TBODY style=\&quot;background: yellow\&quot;&gt;&quot;</span>;
<a name="l00260"></a>00260         BenchMarkSignature&lt;RSASS&lt;PSSR, SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/rsa1024.dat&quot;</span>, <span class="stringliteral">&quot;RSA 1024&quot;</span>, t);
<a name="l00261"></a>00261         BenchMarkSignature&lt;RWSS&lt;PSSR, SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/rw1024.dat&quot;</span>, <span class="stringliteral">&quot;RW 1024&quot;</span>, t);
<a name="l00262"></a>00262         BenchMarkSignature&lt;LUCSS&lt;PSSR, SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/luc1024.dat&quot;</span>, <span class="stringliteral">&quot;LUC 1024&quot;</span>, t);
<a name="l00263"></a>00263         BenchMarkSignature&lt;NR&lt;SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/nr1024.dat&quot;</span>, <span class="stringliteral">&quot;NR 1024&quot;</span>, t);
<a name="l00264"></a>00264         BenchMarkSignature&lt;DSA&gt;(<span class="stringliteral">&quot;TestData/dsa1024.dat&quot;</span>, <span class="stringliteral">&quot;DSA 1024&quot;</span>, t);
<a name="l00265"></a>00265         BenchMarkSignature&lt;LUC_HMP&lt;SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/lucs512.dat&quot;</span>, <span class="stringliteral">&quot;LUC-HMP 512&quot;</span>, t);
<a name="l00266"></a>00266         BenchMarkSignature&lt;ESIGN&lt;SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/esig1023.dat&quot;</span>, <span class="stringliteral">&quot;ESIGN 1023&quot;</span>, t);
<a name="l00267"></a>00267         BenchMarkSignature&lt;ESIGN&lt;SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/esig1536.dat&quot;</span>, <span class="stringliteral">&quot;ESIGN 1536&quot;</span>, t);
<a name="l00268"></a>00268 
<a name="l00269"></a>00269         cout &lt;&lt; <span class="stringliteral">&quot;\n&lt;TBODY style=\&quot;background: white\&quot;&gt;&quot;</span>;
<a name="l00270"></a>00270         BenchMarkSignature&lt;RSASS&lt;PSSR, SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/rsa2048.dat&quot;</span>, <span class="stringliteral">&quot;RSA 2048&quot;</span>, t);
<a name="l00271"></a>00271         BenchMarkSignature&lt;RWSS&lt;PSSR, SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/rw2048.dat&quot;</span>, <span class="stringliteral">&quot;RW 2048&quot;</span>, t);
<a name="l00272"></a>00272         BenchMarkSignature&lt;LUCSS&lt;PSSR, SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/luc2048.dat&quot;</span>, <span class="stringliteral">&quot;LUC 2048&quot;</span>, t);
<a name="l00273"></a>00273         BenchMarkSignature&lt;NR&lt;SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/nr2048.dat&quot;</span>, <span class="stringliteral">&quot;NR 2048&quot;</span>, t);
<a name="l00274"></a>00274         BenchMarkSignature&lt;LUC_HMP&lt;SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/lucs1024.dat&quot;</span>, <span class="stringliteral">&quot;LUC-HMP 1024&quot;</span>, t);
<a name="l00275"></a>00275         BenchMarkSignature&lt;ESIGN&lt;SHA&gt; &gt;(<span class="stringliteral">&quot;TestData/esig2046.dat&quot;</span>, <span class="stringliteral">&quot;ESIGN 2046&quot;</span>, t);
<a name="l00276"></a>00276 
<a name="l00277"></a>00277         cout &lt;&lt; <span class="stringliteral">&quot;\n&lt;TBODY style=\&quot;background: yellow\&quot;&gt;&quot;</span>;
<a name="l00278"></a>00278         BenchMarkKeyAgreement&lt;XTR_DH&gt;(<span class="stringliteral">&quot;TestData/xtrdh171.dat&quot;</span>, <span class="stringliteral">&quot;XTR-DH 171&quot;</span>, t);
<a name="l00279"></a>00279         BenchMarkKeyAgreement&lt;XTR_DH&gt;(<span class="stringliteral">&quot;TestData/xtrdh342.dat&quot;</span>, <span class="stringliteral">&quot;XTR-DH 342&quot;</span>, t);
<a name="l00280"></a>00280         BenchMarkKeyAgreement&lt;DH&gt;(<span class="stringliteral">&quot;TestData/dh1024.dat&quot;</span>, <span class="stringliteral">&quot;DH 1024&quot;</span>, t);
<a name="l00281"></a>00281         BenchMarkKeyAgreement&lt;DH&gt;(<span class="stringliteral">&quot;TestData/dh2048.dat&quot;</span>, <span class="stringliteral">&quot;DH 2048&quot;</span>, t);
<a name="l00282"></a>00282         BenchMarkKeyAgreement&lt;LUC_DH&gt;(<span class="stringliteral">&quot;TestData/lucd512.dat&quot;</span>, <span class="stringliteral">&quot;LUCDIF 512&quot;</span>, t);
<a name="l00283"></a>00283         BenchMarkKeyAgreement&lt;LUC_DH&gt;(<span class="stringliteral">&quot;TestData/lucd1024.dat&quot;</span>, <span class="stringliteral">&quot;LUCDIF 1024&quot;</span>, t);
<a name="l00284"></a>00284         BenchMarkKeyAgreement&lt;MQV&gt;(<span class="stringliteral">&quot;TestData/mqv1024.dat&quot;</span>, <span class="stringliteral">&quot;MQV 1024&quot;</span>, t);
<a name="l00285"></a>00285         BenchMarkKeyAgreement&lt;MQV&gt;(<span class="stringliteral">&quot;TestData/mqv2048.dat&quot;</span>, <span class="stringliteral">&quot;MQV 2048&quot;</span>, t);
<a name="l00286"></a>00286 
<a name="l00287"></a>00287         cout &lt;&lt; <span class="stringliteral">&quot;\n&lt;TBODY style=\&quot;background: white\&quot;&gt;&quot;</span>;
<a name="l00288"></a>00288         {
<a name="l00289"></a>00289                 <a class="code" href="class_random_pool.html" title="Randomness Pool.">RandomPool</a> rng;         <span class="comment">// not seeded</span>
<a name="l00290"></a>00290                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECIES&lt;ECP&gt;::Decryptor</a> cpriv(rng, ASN1::secp256k1());
<a name="l00291"></a>00291                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECIES&lt;ECP&gt;::Encryptor</a> cpub(cpriv);
<a name="l00292"></a>00292                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECDSA&lt;ECP, SHA&gt;::Signer</a> spriv(cpriv);
<a name="l00293"></a>00293                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECDSA&lt;ECP, SHA&gt;::Verifier</a> spub(spriv);
<a name="l00294"></a>00294                 <a class="code" href="class_d_h___domain.html" title=",">ECDH&lt;ECP&gt;::Domain</a> ecdhc(ASN1::secp256k1());
<a name="l00295"></a>00295                 <a class="code" href="class_m_q_v___domain.html" title="_">ECMQV&lt;ECP&gt;::Domain</a> ecmqvc(ASN1::secp256k1());
<a name="l00296"></a>00296 
<a name="l00297"></a>00297                 BenchMarkEncryption(<span class="stringliteral">&quot;ECIES over GF(p) 256&quot;</span>, cpub, t);
<a name="l00298"></a>00298                 BenchMarkDecryption(<span class="stringliteral">&quot;ECIES over GF(p) 256&quot;</span>, cpriv, cpub, t);
<a name="l00299"></a>00299                 BenchMarkSigning(<span class="stringliteral">&quot;ECDSA over GF(p) 256&quot;</span>, spriv, t);
<a name="l00300"></a>00300                 BenchMarkVerification(<span class="stringliteral">&quot;ECDSA over GF(p) 256&quot;</span>, spriv, spub, t);
<a name="l00301"></a>00301                 BenchMarkKeyGen(<span class="stringliteral">&quot;ECDHC over GF(p) 256&quot;</span>, ecdhc, t);
<a name="l00302"></a>00302                 BenchMarkAgreement(<span class="stringliteral">&quot;ECDHC over GF(p) 256&quot;</span>, ecdhc, t);
<a name="l00303"></a>00303                 BenchMarkKeyGen(<span class="stringliteral">&quot;ECMQVC over GF(p) 256&quot;</span>, ecmqvc, t);
<a name="l00304"></a>00304                 BenchMarkAgreement(<span class="stringliteral">&quot;ECMQVC over GF(p) 256&quot;</span>, ecmqvc, t);
<a name="l00305"></a>00305         }
<a name="l00306"></a>00306 
<a name="l00307"></a>00307         cout &lt;&lt; <span class="stringliteral">&quot;&lt;TBODY style=\&quot;background: yellow\&quot;&gt;&quot;</span> &lt;&lt; endl;
<a name="l00308"></a>00308         {
<a name="l00309"></a>00309                 <a class="code" href="class_random_pool.html" title="Randomness Pool.">RandomPool</a> rng;         <span class="comment">// not seeded</span>
<a name="l00310"></a>00310                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECIES&lt;EC2N&gt;::Decryptor</a> cpriv(rng, ASN1::sect233r1());
<a name="l00311"></a>00311                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECIES&lt;EC2N&gt;::Encryptor</a> cpub(cpriv);
<a name="l00312"></a>00312                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECDSA&lt;EC2N, SHA&gt;::Signer</a> spriv(cpriv);
<a name="l00313"></a>00313                 <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">ECDSA&lt;EC2N, SHA&gt;::Verifier</a> spub(spriv);
<a name="l00314"></a>00314                 <a class="code" href="class_d_h___domain.html" title=",">ECDH&lt;EC2N&gt;::Domain</a> ecdhc(ASN1::sect233r1());
<a name="l00315"></a>00315                 <a class="code" href="class_m_q_v___domain.html" title="_">ECMQV&lt;EC2N&gt;::Domain</a> ecmqvc(ASN1::sect233r1());
<a name="l00316"></a>00316 
<a name="l00317"></a>00317                 BenchMarkEncryption(<span class="stringliteral">&quot;ECIES over GF(2^n) 233&quot;</span>, cpub, t);
<a name="l00318"></a>00318                 BenchMarkDecryption(<span class="stringliteral">&quot;ECIES over GF(2^n) 233&quot;</span>, cpriv, cpub, t);
<a name="l00319"></a>00319                 BenchMarkSigning(<span class="stringliteral">&quot;ECDSA over GF(2^n) 233&quot;</span>, spriv, t);
<a name="l00320"></a>00320                 BenchMarkVerification(<span class="stringliteral">&quot;ECDSA over GF(2^n) 233&quot;</span>, spriv, spub, t);
<a name="l00321"></a>00321                 BenchMarkKeyGen(<span class="stringliteral">&quot;ECDHC over GF(2^n) 233&quot;</span>, ecdhc, t);
<a name="l00322"></a>00322                 BenchMarkAgreement(<span class="stringliteral">&quot;ECDHC over GF(2^n) 233&quot;</span>, ecdhc, t);
<a name="l00323"></a>00323                 BenchMarkKeyGen(<span class="stringliteral">&quot;ECMQVC over GF(2^n) 233&quot;</span>, ecmqvc, t);
<a name="l00324"></a>00324                 BenchMarkAgreement(<span class="stringliteral">&quot;ECMQVC over GF(2^n) 233&quot;</span>, ecmqvc, t);
<a name="l00325"></a>00325         }
<a name="l00326"></a>00326         cout &lt;&lt; <span class="stringliteral">&quot;&lt;/TABLE&gt;&quot;</span> &lt;&lt; endl;
<a name="l00327"></a>00327 }
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 9 Dec 2009 for Crypto++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>