create cypher file from pdf file using python(i would like to use blowfish algorithm)

134 views Asked by At

I want to encrypt a whole data of a pdf file using blowfish algorithm. I feel password protection is not enough. The pdf can contain images text tables etc. The pdf will be a thesis of PHD student.

1

There are 1 answers

1
DivideByZero On

If you are worried that your file may be accessed by a malicious third-party then you should not attempt to implement your own algorithm. It is very easy to make a mistake that leads to security issues.

Also, you probably shouldn't be using the blowfish algorithm, which has some major security issues:

Blowfish's use of a 64-bit block size (as opposed to e.g. AES's 128-bit block size) makes it vulnerable to birthday attacks, particularly in contexts like HTTPS. In 2016, the SWEET32 attack demonstrated how to leverage birthday attacks to perform plaintext recovery (i.e. decrypting ciphertext) against ciphers with a 64-bit block size.[9] The GnuPG project recommends that Blowfish not be used to encrypt files larger than 4 GB[10] due to its small block size.

A reduced-round variant of Blowfish is known to be susceptible to known-plaintext attacks on reflectively weak keys. Blowfish implementations use 16 rounds of encryption, and are not susceptible to this attack.

https://en.wikipedia.org/wiki/Blowfish_(cipher)#Weakness_and_successors

I would recommend using a well-established cryptography program that you can trust - something written by industry experts. It is unethical to store somebody else's private data using home-made encryption software that may or may not be secure.