aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/dh.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-26 03:07:18 +0000
committerlloyd <[email protected]>2008-10-26 03:07:18 +0000
commita8ee54d459a42d98fdfe1e9ff4f0c011c2f41e10 (patch)
tree576d871ed243508e5458456d12ea99d240e8339c /doc/examples/dh.cpp
parentb1344477a80c7410da9ce05dd3343c04d24f8095 (diff)
Move rng.{cpp,h} from core to rng/ topdir
Add a new class AutoSeeded_RNG that is a RandomNumberGenerator that wraps up the logic formerly in RandomNumberGenerator::make_rng. make_rng in fact now just returns a new AutoSeeded_RNG object. AutoSeeded_RNG is a bit more convenient because - No need to use auto_ptr - No need to dereference (same syntax everywhere - it's an underestimated advantage imo) Also move the code from timer/timer_base to timer/
Diffstat (limited to 'doc/examples/dh.cpp')
-rw-r--r--doc/examples/dh.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/examples/dh.cpp b/doc/examples/dh.cpp
index f2a43e7f6..af0c19fec 100644
--- a/doc/examples/dh.cpp
+++ b/doc/examples/dh.cpp
@@ -17,15 +17,14 @@ int main()
{
try
{
- std::auto_ptr<RandomNumberGenerator> rng(
- RandomNumberGenerator::make_rng());
+ AutoSeeded_RNG rng;
// Alice creates a DH key and sends (the public part) to Bob
- DH_PrivateKey private_a(*rng, DL_Group("modp/ietf/1024"));
+ DH_PrivateKey private_a(rng, DL_Group("modp/ietf/1024"));
DH_PublicKey public_a = private_a; // Bob gets this
// Bob creates a key with a matching group
- DH_PrivateKey private_b(*rng, public_a.get_domain());
+ DH_PrivateKey private_b(rng, public_a.get_domain());
// Bob sends the key back to Alice
DH_PublicKey public_b = private_b; // Alice gets this