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

230
Vistas
How can I write a client side cryption same as node js server side?

I'm using Vue and Typescript in my client side, I assume the client side code can return the same result as the server side function, but it does not work.(When passing the same params to the two functions, the results are different. )

// server side
import crypto from 'crypto';

const cipherPwd = (pwd, key) => {
  const ciph = crypto.createCipher("aes192", key);
  return ciph.update(pwd, "utf8", "base64") + ciph.final("base64");
};

// client side (using crypto-js because crypto can't be used in client)
import CryptoJS from 'crypto-js';

private cipherPwd(pwd: string, key: string): string {
  const keyArr = CryptoJS.enc.Utf8.parse(key);
  const ivArr = CryptoJS.enc.Utf8.parse('');
  const json = CryptoJS.AES.encrypt(pwd, keyArr, { iv: ivArr });
  return json.ciphertext.toString(CryptoJS.enc.Base64);
}

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