mufeedvh / pdfrip

A multi-threaded PDF password cracking utility equipped with commonly encountered password format builders and dictionary attacks.
MIT License
589 stars 67 forks source link

performance across PDF versions #1

Closed roycewilliams closed 2 years ago

roycewilliams commented 2 years ago

What's the expected performance across PDF versions / types? (Edit: maybe have a table added to the README?)

For comparison, GPU performance under hashcat on a single GTX 1080, across supported PDF versions, is as follows:

$ for hashtype in 10400 10420 10500 25400 10600 10700; do \
    hashcat -b -w 4 -O -m $hashtype --quiet; done

-------------------------------------------------
* Hash-Mode 10400 (PDF 1.1 - 1.3 (Acrobat 2 - 4))
-------------------------------------------------

Speed.#1.........:   414.1 MH/s (403.66ms) @ Accel:1024 Loops:256 Thr:32 Vec:1

--------------------------------------------------------------
* Hash-Mode 10420 (PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2)
--------------------------------------------------------------

Speed.#1.........:  6510.0 MH/s (102.36ms) @ Accel:1024 Loops:1024 Thr:32 Vec:1

------------------------------------------------------------------
* Hash-Mode 10500 (PDF 1.4 - 1.6 (Acrobat 5 - 8)) [Iterations: 70]
------------------------------------------------------------------

Speed.#1.........: 14044.6 kH/s (30.67ms) @ Accel:1024 Loops:70 Thr:32 Vec:1

----------------------------------------------------------------------------------------
* Hash-Mode 25400 (PDF 1.4 - 1.6 (Acrobat 5 - 8) - user and owner pass) [Iterations: 70]
----------------------------------------------------------------------------------------

Speed.#1.........: 14294.5 kH/s (30.56ms) @ Accel:1024 Loops:70 Thr:32 Vec:1

-----------------------------------------------
* Hash-Mode 10600 (PDF 1.7 Level 3 (Acrobat 9))
-----------------------------------------------

Speed.#1.........:  3128.5 MH/s (423.99ms) @ Accel:128 Loops:512 Thr:1024 Vec:1

----------------------------------------------------------------------
* Hash-Mode 10700 (PDF 1.7 Level 8 (Acrobat 10 - 11)) [Iterations: 64]
----------------------------------------------------------------------

Speed.#1.........:    34875 H/s (586.47ms) @ Accel:32 Loops:8 Thr:256 Vec:1
mufeedvh commented 2 years ago

Hey @roycewilliams,

Can you please send me/attach these PDF files, I will run a benchmark with hyperfine, as for the hashes per second, it is currently reported with indicatif.

I will run a benchmark for all these PDF versions. :+1:

And I also don't think pdfrip will perform even nearly to hashcat since it's just multi-threading and it uses the pdf crate for decryption, I am thinking of writing my own PDF parser like pdfcrack does just to validate decryption but that's too far fetched for me at the moment.

Thanks :raised_hands:

roycewilliams commented 2 years ago

Well, I'd call this more of a doc bug / request than a pure question. :D

Unfortunately, the hashcat project doesn't retain raw PDFs for testing that I'm aware of - only extracted example hashes, as listed here:

https://hashcat.net/wiki/doku.php?id=example_hashes

... as follows:

Hash mode #10400
  Name................: PDF 1.1 - 1.3 (Acrobat 2 - 4)
  Example.Hash........: $pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000
  Example.Pass........: hashcat

Hash mode #10410
  Name................: PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1
  Example.Hash........: $pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000
  Example.Pass........: $HEX[6a8aedccb7]

Hash mode #10420
  Name................: PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2
  Example.Hash.Format.: plain
  Example.Hash........: $pdf$1*2*40*-1*0*16*01221086741440841668371056103222*32*27c3fecef6d46a78eb61b8b4dbc690f5f8a2912bbb9afc842c12d79481568b74*32*0000000000000000000000000000000000000000000000000000000000000000:6a8aedccb7
  Example.Pass........: hashcat

Hash mode #10500
  Name................: PDF 1.4 - 1.6 (Acrobat 5 - 8)
  Example.Hash........: $pdf$2*3*128*-4*1*16*62888255846156252261477183186121*32*6879919b1afd520bd3b7dbcc0868a0a500000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000
  Example.Pass........: hashcat

Hash mode #10600
  Name................: PDF 1.7 Level 3 (Acrobat 9)
  Example.Hash........: $pdf$5*5*256*-1028*1*16*28562274676426582441147358074521*127*a3aab04cff2c536118870976d768f1fdd445754d6b2dd81fba10bb6e742acd7f2856227467642658244114735807452100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000
  Example.Pass........: hashcat

Hash mode #10700
  Name................: PDF 1.7 Level 8 (Acrobat 10 - 11)
  Example.Hash........: $pdf$5*6*256*-1028*1*16*62137640825124540503886403748430*127*0391647179352257f7181236ba371e540c2dbb82fac1c462313eb58b772a54956213764082512454050388640374843000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*127*00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000*32*0000000000000000000000000000000000000000000000000000000000000000
  Example.Pass........: hashcat

Hash mode #25400
  Name................: PDF 1.4 - 1.6 (Acrobat 5 - 8) - user and owner pass
  Example.Hash........: $pdf$2*3*128*-3904*1*16*631ed33746e50fba5caf56bcc39e09c6*32*5f9d0e4f0b39835dace0d306c40cd6b700000000000000000000000000000000*32*842103b0a0dc886db9223b94afe2d7cd63389079b61986a4fcf70095ad630c24
  Example.Pass........: hashcat