Added support for decrypting PDF 1.7/2.0 Algorithm 5 revision 5 and 6. (perf)

See #4647. Refactors SHA512, so unit testing time reduced from 9848ms to 1382ms.