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

109
Views
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
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!