aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/Pl_AES_PDF.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/Pl_AES_PDF.cc')
-rw-r--r--libqpdf/Pl_AES_PDF.cc16
1 files changed, 4 insertions, 12 deletions
diff --git a/libqpdf/Pl_AES_PDF.cc b/libqpdf/Pl_AES_PDF.cc
index 1e5f81ab..0ceb7df7 100644
--- a/libqpdf/Pl_AES_PDF.cc
+++ b/libqpdf/Pl_AES_PDF.cc
@@ -1,6 +1,5 @@
#include <qpdf/Pl_AES_PDF.hh>
#include <qpdf/QUtil.hh>
-#include <qpdf/MD5.hh>
#include <cstring>
#include <assert.h>
#include <stdexcept>
@@ -111,17 +110,10 @@ Pl_AES_PDF::initializeVector()
static bool seeded_random = false;
if (! seeded_random)
{
- std::string seed_str;
- seed_str += QUtil::int_to_string((int)QUtil::get_current_time());
- seed_str += " QPDF aes random";
- MD5 m;
- m.encodeString(seed_str.c_str());
- MD5::Digest digest;
- m.digest(digest);
- assert(sizeof(digest) >= sizeof(unsigned int));
- unsigned int seed;
- memcpy((void*)(&seed), digest, sizeof(unsigned int));
- srandom(seed);
+ // Seed the random number generator with something simple, but
+ // just to be interesting, don't use the unmodified current
+ // time....
+ srandom((int)QUtil::get_current_time() ^ 0xcccc);
seeded_random = true;
}
for (unsigned int i = 0; i < this->buf_size; ++i)