[PATCH] Make the md5 method of Decrypt public so it can be used by other files.

Julien Rebetez julien at fhtagn.net
Thu Oct 25 12:29:42 PDT 2007


---
 poppler/Decrypt.cc |    5 ++---
 poppler/Decrypt.h  |    1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/poppler/Decrypt.cc b/poppler/Decrypt.cc
index 3cf24ef..cc148ba 100644
--- a/poppler/Decrypt.cc
+++ b/poppler/Decrypt.cc
@@ -21,7 +21,6 @@ static Guchar rc4DecryptByte(Guchar *state, Guchar *x, Guchar *y, Guchar c);
 static void aesKeyExpansion(DecryptAESState *s,
 			    Guchar *objKey, int objKeyLen);
 static void aesDecryptBlock(DecryptAESState *s, Guchar *in, GBool last);
-static void md5(Guchar *msg, int msgLen, Guchar *digest);
 
 static Guchar passwordPad[32] = {
   0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
@@ -208,7 +207,7 @@ DecryptStream::DecryptStream(Stream *strA, Guchar *fileKey,
   } else {
     n = keyLength + 5;
   }
-  md5(objKey, n, objKey);
+  Decrypt::md5(objKey, n, objKey);
   if ((objKeyLength = keyLength + 5) > 16) {
     objKeyLength = 16;
   }
@@ -633,7 +632,7 @@ static inline Gulong md5Round4(Gulong a, Gulong b, Gulong c, Gulong d,
   return b + rotateLeft((a + (c ^ (b | ~d)) + Xk + Ti), s);
 }
 
-static void md5(Guchar *msg, int msgLen, Guchar *digest) {
+void Decrypt::md5(Guchar *msg, int msgLen, Guchar *digest) {
   Gulong x[16];
   Gulong a, b, c, d, aa, bb, cc, dd;
   int n64;
diff --git a/poppler/Decrypt.h b/poppler/Decrypt.h
index b2f754f..b861968 100644
--- a/poppler/Decrypt.h
+++ b/poppler/Decrypt.h
@@ -24,6 +24,7 @@
 
 class Decrypt {
 public:
+  static void md5(Guchar *msg, int msgLen, Guchar *digest);
 
   // Generate a file key.  The <fileKey> buffer must have space for at
   // least 16 bytes.  Checks <ownerPassword> and then <userPassword>
-- 
1.5.2.5


--------------030500050101040903030608
Content-Type: text/x-patch;
 name="0003-Adds-the-ability-to-save-PDF-using-either-incrementa.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename*0="0003-Adds-the-ability-to-save-PDF-using-either-incrementa.pa";
 filename*1="tch"



More information about the poppler mailing list