0

Was trying to encrypt text:- "Michael Fehr" or "carpet" using hashids, it returns blank.

Code:-

$hashids = new Hashids\Hashids("mysalt");
$hashed_text = $hashids->encode_hex(bin2hex("Michael Fehr"));

echo "<script>alert('".$hashed_text."')</script>";

Also tried:- $hashed_interestrate = $hashids->encode_hex("63706b64");, but not working. If I try text:- "CPC", it's working.

kayos
  • 31
  • 5
  • Two bugs on first sight: "c445def"seems not to be a valid hex string (just 5 chars) and what should be the result of "bin2hex" - I think you should use "hex2bin" – Michael Fehr Jan 30 '21 at 09:17
  • @MichaelFehr okay, so not to be confused, I am trying `$hashids->encode_hex(bin2hex("Michael Fehr"));` but it also returns blank. – kayos Jan 30 '21 at 09:21

0 Answers0