-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hash::fromHex #84
Comments
It has been removed in latest commit. I tried reverting to an older commit but things went sideways, so I'm updating my whole db to generate bits hashes instead of hex hashes. |
I got the same problem for my project. Please help it |
I'll check it out! |
Yes, thank you so much. |
Trying to use this project and I need to load a hash from the database to evaluate it. Is this going to be re-implemented any time soon? |
@dimitre @jenssegers maybe we could refactor the constructor of |
No because in the latest version you don't have big integer either. In the end I downgraded to 0.8.0 like the other person.
Sent from Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: took ***@***.***>
Sent: Monday, August 28, 2023 8:01:58 PM
To: jenssegers/imagehash ***@***.***>
Cc: Richard ***@***.***>; Comment ***@***.***>
Subject: Re: [jenssegers/imagehash] Hash::fromHex (Issue #84)
new Hash(new BigInteger($hex, 16)); should do the trick!
—
Reply to this email directly, view it on GitHub<#84 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWWO64OEDCKRB7R7PCTCLALXXTTKNANCNFSM6AAAAAAWS32PN4>.
You are receiving this because you commented.Message ID: ***@***.***>
|
changing API in minor is a BC-break - not good. UPD <?php
namespace App\Helper;
class HashHelper
{
public static function hashToBits(string $value): string
{
$value = hex2bin($value);
$bits = '';
$digits = unpack('J*', $value);
foreach ($digits as $digit) {
$bits .= sprintf('%064b', $digit);
}
return $bits;
}
}
$hash = '0000000000000000082bfe0000000000';
$h1 = Hash::fromBits(HashHelper::hashToBits($s));
var_dump(str_pad($h1->toHex(), 32, 0, STR_PAD_LEFT) === $s); |
does it exist?
The text was updated successfully, but these errors were encountered: