Python Forum
Problem with using Crypto library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with using Crypto library
#1
Hello my execute error are
Error:
“Traceback (most recent call last): File "main.py", line 151, in <module> File "main.py", line 113, in menu File "main.py", line 64, in start_encryption File "symmetric.py", line 20, in encrypt File "site-packages/Crypto/Cipher/blockalgo.py", line 244, in encrypt ValueError: Input strings must be a multiple of 16 in length”
It happen when i exec command (only with several files)
encrypted = AES_obj.encrypt(file_content)
I know that it file_content length problem, but how solve this problem if i dont want to mess with file structure (now i'll encrypt it and next time i need to decrypt it to orginal state)

Some more code
def start_encryption(files):
    AES_and_base64_path = []
    for found_file in files:
        key = generate_keys.generate_key(128, True)
        AES_obj = symmetric.AESCipher(key)

        found_file = base64.b64decode(found_file)
        print(found_file)
        try:
            with open(found_file, 'rb') as f:
                file_content = f.read()
        except:
            continue

#       print(file_content)
        encrypted = AES_obj.encrypt(file_content)
#       print(encrypted)
        utils.shred(found_file)
Best regards
~Reks
Reply
#2
hello, any one can delete this topic? I dont see option to delete by myself :)
Reply
#3
We don't delete threads.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  cinemagoer library problem lunacy90 21 2,231 Sep-08-2023, 04:30 PM
Last Post: menator01
  Problem with importing python-telegram library into the project gandonio 1 1,515 Nov-01-2022, 02:19 AM
Last Post: deanhystad
  Creating a TG crypto Bot_ problem when trying to with bot.polling p1ner0 1 1,383 Apr-27-2022, 03:43 AM
Last Post: p1ner0
  how to manage crypto trading flooding data from exchange servers Mikeardy 0 1,209 Dec-26-2021, 08:31 PM
Last Post: Mikeardy
  Problem installing library thunderspeed 2 2,280 Mar-22-2020, 11:04 PM
Last Post: thunderspeed
  Python crypto byte plaintext to hexint Mangaz90 2 2,806 Feb-21-2020, 07:42 PM
Last Post: Mangaz90
  Problem importing resource library ChrisM 8 3,866 Oct-23-2019, 01:40 PM
Last Post: ChrisM
  Create file archive that contains crypto hash ED209 1 2,006 May-29-2019, 03:05 AM
Last Post: heiner55
  crypto import issue saisankalpj 2 7,784 Dec-20-2018, 06:08 AM
Last Post: saisankalpj
  AES encryption - does not match between arduino and python 3 crypto guillaume55 0 3,992 Sep-23-2018, 11:14 AM
Last Post: guillaume55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020