Iam trying to encrypt file names using the cryptography library but the output is so long that windows doesn't rename it and gives me error. This was asked here but didnt have a solution.
fileName= f.encrypt(b'#Filenamehere')
print(fileName)
Output
b'gAAAAABhpf2t5brpCcfFoMZ9NvQ9R21uCeGGpVGZE2L_xfWwSw4IwSEj0Eos5smAmfZz3nySqGXsQOCjbThrTAFZuBOD3r1-t-aaV6RVpHWadybdE5A5RKVudM8BoD4_wvksaw4W9swNqgDZuGw=='
Is there a way to limit the output encrypted message to a certain number in cryptography library.
change the filename so that nobody knows what it is. Windows has a limit on filename characters. Is there any other way to do this.
I suggest taking look at Vernam cipher, cryptomuseum.com article explain how it is working and describe history of its' usage. Vernam is easy to implement, gives ciphertext same length as plaintext, but requires key length no lesser than plaintext.
Beware that as it does deals with bits, you might get byte outside 0-127 range (I am not sure how windows filesystem will react to that) or byte with character not allowed in filename