paralleldrive/cuid2

"text" not used in hash function

thibaultmeyer opened this issue · 2 comments

It appears that the variable "text" is not used. The problem is probably in the call to sha3 function.

const text = input + salt;

const hash = (input = "", length = bigLength) => {
  const salt = createEntropy(length);
  const text = input + salt;
  return BigInt(
    sha3(input)
      .map((x) => x.toString(16))
      .join("")
  )
    .toString(36)
    .substring(2);
};

Good catch! Thank you.

Please review #6

Released in @paralleldrive/cuid2@1.0.1