vinkla / hashids

A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
https://hashids.org/php
MIT License
5.29k stars 417 forks source link

encode_hex not working in PHP #160

Closed NamarsahaM closed 3 years ago

NamarsahaM commented 3 years ago

It returns blank when I use:

$hashids = new Hashids\Hashids();
$hashed_text = $hashids->encode_hex("63706b64");

echo $hashed_text;

But it gets hashed when I try:-

$hashids = new Hashids\Hashids();
$hashed_text = $hashids->encode_hex("63706b");

echo $hashed_text;
vinkla commented 3 years ago

You need to add failing test cases.

NamarsahaM commented 3 years ago

You need to add failing test cases.

it shows blank value. The same question is related in https://stackoverflow.com/questions/65966294/hashid-encryption-returning-no-value-in-php

vinkla commented 3 years ago

Add a failing test to the HashidsTest class: https://github.com/vinkla/hashids/blob/master/tests/HashidsTest.php

NamarsahaM commented 3 years ago

TBH, I am not sure how to add it in test in GitHub. Could you please help me with adding it for me?

$hashids = new Hashids\Hashids();
$hashed_text = $hashids->encode_hex("63706b64");

echo $hashed_text;
vinkla commented 3 years ago

TBH, I am not sure how to add it in test in GitHub. Could you please help me with adding it for me?

No, I don't have time. I'm closing this.

If you want to learn more about GitHub: https://guides.github.com/