Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

256
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda