#1 Keccak 384 Hash Fix

Open
Yorgyetson wants to merge 1 commits from Yorgyetson/master into desktopd/master

I am working on a project that required PHP SHA3 hashing and came across this repo.

I ended up using it in my project, which is a PHP implementation of Kerl: https://github.com/iotaledger/kerl/blob/master/IOTA-Kerl-spec.md

My project can be found here: https://gitlab.com/YorgYetson/Kerl-PHP

While I was working on this, I found that the SHA3.php file needed to be modified in order to get Keccak 384 hashing to work properly. I'm not sure if this is an older spec for Keccak or just a typo.

I am working on a project that required PHP SHA3 hashing and came across this repo. I ended up using it in my project, which is a PHP implementation of Kerl: https://github.com/iotaledger/kerl/blob/master/IOTA-Kerl-spec.md My project can be found here: https://gitlab.com/YorgYetson/Kerl-PHP While I was working on this, I found that the SHA3.php file needed to be modified in order to get Keccak 384 hashing to work properly. I'm not sure if this is an older spec for Keccak or just a typo.
platform commented 6 years ago
Owner

Because this change actually breaks consistency with the SHA-3 reference, I feel Kerl is just using another (possibly older) instance of Keccak. I've made changes to export the internal constructor, so please try this:

$sponge = new SHA3 (832, 768, 0x01, 48);

or namespaced optimized version (recommended, PHP 5.3+) under namespaced/desktopd/SHA3:

$sponge = new desktopd\SHA3\Sponge (832, 768, 0x01, 48);

If you find any new information, please notify me so I can make necessary changes.

Because this change actually breaks consistency with the SHA-3 reference, I feel Kerl is just using another (possibly older) instance of Keccak. I've made changes to export the internal constructor, so please try this: $sponge = new SHA3 (832, 768, 0x01, 48); or namespaced optimized version (**recommended**, PHP 5.3+) under `namespaced/desktopd/SHA3`: $sponge = new desktopd\SHA3\Sponge (832, 768, 0x01, 48); If you find any new information, please notify me so I can make necessary changes.
Yorgyetson commented 6 years ago
Poster

Wow, very cool! Thank you for the quick response!

I think this is a great solution.

I'll give the sponge update a shot and let you know if it gives me any trouble.

I noticed that the python module Kerl uses for SHA3 the 0x01 value, that's actually how I figured out to change this one in the first place. Although, they also have a different value for byte size(?) so I really don't know what is going on.

https://github.com/tiran/pysha3/blob/5cbf015fb1fa5d8b6a61fb9187bf59739118d5ee/Modules/_sha3/sha3module.c#L210

The repo is fairly active, but maybe they just use the old spec too?

Any way you slice it your solution should work for what I need, so thanks again!

Wow, very cool! Thank you for the quick response! I think this is a great solution. I'll give the sponge update a shot and let you know if it gives me any trouble. I noticed that the python module Kerl uses for SHA3 the 0x01 value, that's actually how I figured out to change this one in the first place. Although, they also have a different value for byte size(?) so I really don't know what is going on. https://github.com/tiran/pysha3/blob/5cbf015fb1fa5d8b6a61fb9187bf59739118d5ee/Modules/_sha3/sha3module.c#L210 The repo is fairly active, but maybe they just use the old spec too? Any way you slice it your solution should work for what I need, so thanks again!
This pull request can be merged automatically.
Sign in to join this conversation.
No Label
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.