Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

110
Visualizações
Require CryptoJS Function Returning Wrong Thing

I am attempting to SHA3 a password. It works, and I make the hash.

var hash = CryptoJS.SHA3(pass, { outputLength: 512});
console.log(hash.toString());

and the result is:

8ca32d950873fd2b5b34a7d79c4a294b2fd805abe3261beb04fab61a3b4b75609afd6478aa8d34e03f262d68bb09a2ba9d655e228c96723b2854838a6e613b9d

which is what I want.

The issue is that this code is in this:

this.pass = require(["crypto-js"], function(CryptoJS) {
       console.log(pass);
       var hash = CryptoJS.SHA3(pass, { outputLength: 512});
       console.log(hash.toString());
       return hash.toString();     
});

Which doesn't actually set my variable to it. I instead get the function.

I've now sat here for probably 6-7 hrs trying random stuff.

I know it doesn't make sense the way I'm doing it, but I included require as a script tag in html. This is because I'm not actually running an npm server. This is also a browser extension. I am also aware my title makes it sound like "I'm right, code is wrong" trust me I know I'm wrong just please help me.

Tried various forms of setting this.pass. Tried to pass in this.pass. Tried setting this.pass inside the function. I don't know anymore.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda