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

176
Views
Error result when using hash512 package npm js

I want to use package hash from npm like md5,sha1,sha256 and sha512 with class . I successed hash using md5,sh1,sha256 but not sha512. I've got error like this "The value of "offset" is out of range. It must be >= 0 and <= 1. Received 4"

This my code:

var md5 = require("md5");
var sha1 = require("sha1");
var sha256 = require("sha256");
var sha512 = require("sha512");

class Hess {
  md5(params) {
    console.log(md5(params));
  }
  sha1(params) {
    console.log(sha1(params));
  }
  sha256(params) {
    console.log(sha256(params));
  }
  sha512(params) {
      var hash = sha512(params)
      console.log(hash.toString("hex"));
  }
}

const Hash = new Hess();
Hash.md5("secret");
Hash.sha1("secret"); 
Hash.sha256("secret");
Hash.sha512("hello");

How i repair my code so that not error and the result of sha512 successed?

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!