Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
Trying to convert Javascript AES encryption to Python

I'm trying to convert the following Javascript code to python:

cryptoJs.AES.encrypt("secrettext", cryptoJs.enc.Base64.parse("QWJjZGVmZ2hpamtsbW5vcA=="), { iv: cryptoJs.enc.Base64.parse("AAAAAAAAAAAAAAAAAAAAAA==")}).ciphertext.toString(cryptoJs.enc.Base64)

I've been trying to figure out the python equivalent of the different parts (key and iv), but nothing is working. This is what I last tried but was given an error that my IV was the incorrect length:

key = b"QWJjZGVmZ2hpamtsbW5vcA=="
iv = b"AAAAAAAAAAAAAAAAAAAAAA=="
text = b"secrettext"

base64_key = base64.b64encode(key)
base64_iv = base64.b64encode(iv)

padtext=pad(text,16,style='pkcs7')

encryptor = AES.new(base64_key, AES.MODE_CBC, base64_iv)
result = encryptor.encrypt(padtext)
print(binascii.hexlify(result))
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!