Thread overview
sha3-d
Oct 29, 2021
dd
Oct 29, 2021
WebFreak001
Oct 29, 2021
dd
Oct 30, 2021
Johan
Nov 01, 2021
dd
Oct 29, 2021
Luís Ferreira
Nov 01, 2021
dd
Nov 03, 2021
starcanopy
Nov 05, 2021
bauss
Nov 05, 2021
dd
October 29, 2021
Hello all!

When I submitted my work to Phobos[1] earlier this year, it was rejected. (Understandably)

So I made a DUB package and forgot to announce it here!

Package: https://code.dlang.org/packages/sha3-d
Source: https://github.com/dd86k/sha3-d

[1] https://github.com/dlang/phobos/pull/7713
October 29, 2021
On Friday, 29 October 2021 at 15:13:38 UTC, dd wrote:
> Hello all!
>
> When I submitted my work to Phobos[1] earlier this year, it was rejected. (Understandably)
>
> So I made a DUB package and forgot to announce it here!
>
> Package: https://code.dlang.org/packages/sha3-d
> Source: https://github.com/dd86k/sha3-d
>
> [1] https://github.com/dlang/phobos/pull/7713

Awesome! Haven't had the need to use SHA-3 yet myself, but given all the other growing ecosystems where this could be of use it's nice to have this high-performance implementation already.

Would be cool having benchmarks comparing this to other implementations if great performance is a goal, as you already mentioned in your README it's much faster than keccack-tiny.
October 29, 2021
On Friday, 29 October 2021 at 15:18:39 UTC, WebFreak001 wrote:
> Awesome! Haven't had the need to use SHA-3 yet myself, but given all the other growing ecosystems where this could be of use it's nice to have this high-performance implementation already.

SHA-3 has been in use in SQLite and in Euthereum for a while, which are enormous projects. SHA-1 is on life support with sha1cd and SHA-2 faces length extension attacks (even with SHA-2-256 and SHA-2-512 but not SHA-2-512/256).

> Would be cool having benchmarks comparing this to other implementations if great performance is a goal, as you already mentioned in your README it's much faster than keccack-tiny.

From memory, I remember getting ~10MiB/s when I first implemented keccak-tiny from C to D. When I rewrote the package to my liking, and I got ~130MiB/s. But these tests were in a VM on my i7-3770 so it's not really a conclusive thing.

I could do a benchmark again.
October 29, 2021
On Fri, 2021-10-29 at 15:13 +0000, dd via Digitalmars-d-announce wrote:
> Hello all!
> 
> When I submitted my work to Phobos[1] earlier this year, it was rejected. (Understandably)
> 
> So I made a DUB package and forgot to announce it here!
> 
> Package: https://code.dlang.org/packages/sha3-d
> Source: https://github.com/dd86k/sha3-d
> 
> [1] https://github.com/dlang/phobos/pull/7713

Amazing work dd! Are you considering implementing it with SIMD instructions with something like intel-intrinsics?

-- 
Sincerely,
Luís Ferreira @ lsferreira.net



October 30, 2021
On Friday, 29 October 2021 at 15:33:57 UTC, dd wrote:
> On Friday, 29 October 2021 at 15:18:39 UTC, WebFreak001 wrote:
>
>> Would be cool having benchmarks comparing this to other implementations if great performance is a goal, as you already mentioned in your README it's much faster than keccack-tiny.
>
> From memory, I remember getting ~10MiB/s when I first implemented keccak-tiny from C to D. When I rewrote the package to my liking, and I got ~130MiB/s. But these tests were in a VM on my i7-3770 so it's not really a conclusive thing.

The readme mentions compilation with `-b release-nobounds`.
1. These are flags for DUB (?), can you add/replace it with the conversion to actual compiler flags?
2. Did you test without removing bounds checks? If there is a noticable performance drop, I think it'd be very worthwhile to modify the code such that there is no penalty of boundschecks (at -O3); I think in theory only very few bounds checks are needed. Enabling good performance _with_ boundschecks on means that the user is not forced to build his whole project without boundschecks, or move to separate compilation.

cheers,
  Johan

November 01, 2021
On Friday, 29 October 2021 at 16:02:14 UTC, Luís Ferreira wrote:
> On Fri, 2021-10-29 at 15:13 +0000, dd via Digitalmars-d-announce wrote:
>> Hello all!
>> 
>> When I submitted my work to Phobos[1] earlier this year, it was rejected. (Understandably)
>> 
>> So I made a DUB package and forgot to announce it here!
>> 
>> Package: https://code.dlang.org/packages/sha3-d
>> Source: https://github.com/dd86k/sha3-d
>> 
>> [1] https://github.com/dlang/phobos/pull/7713
>
> Amazing work dd! Are you considering implementing it with SIMD instructions with something like intel-intrinsics?

That would be interesting, especially this is my kind of stuff.

I'll be up to do it.
November 01, 2021
On Saturday, 30 October 2021 at 09:59:38 UTC, Johan wrote:
> The readme mentions compilation with `-b release-nobounds`.
> 1. These are flags for DUB (?), can you add/replace it with the conversion to actual compiler flags?

I can do a manual compilation section.

Though, it is documentation online:
https://dub.pm/package-format-sdl.html#build-types

> 2. Did you test without removing bounds checks? If there is a noticable performance drop, I think it'd be very worthwhile to modify the code such that there is no penalty of boundschecks (at -O3); I think in theory only very few bounds checks are needed. Enabling good performance _with_ boundschecks on means that the user is not forced to build his whole project without boundschecks, or move to separate compilation.

I haven't tested it with bounds checking. I could do a round of benchmarks with different compilers and build types.

November 03, 2021
On Friday, 29 October 2021 at 15:13:38 UTC, dd wrote:
> Hello all!
>
> When I submitted my work to Phobos[1] earlier this year, it was rejected. (Understandably)
>
> So I made a DUB package and forgot to announce it here!
>
> Package: https://code.dlang.org/packages/sha3-d
> Source: https://github.com/dd86k/sha3-d
>
> [1] https://github.com/dlang/phobos/pull/7713

Thank you so much for this! I have to rework a program, and it needs to support SHA3.
November 05, 2021
On Friday, 29 October 2021 at 15:13:38 UTC, dd wrote:
>
> When I submitted my work to Phobos[1] earlier this year, it was rejected. (Understandably)
>

What was the reasoning? I can't imagine it being worse than some of the terrible modules like std.json?

In fact it looks very nice.
November 05, 2021
On Friday, 5 November 2021 at 07:00:06 UTC, bauss wrote:
> What was the reasoning? I can't imagine it being worse than some of the terrible modules like std.json?

I have nothing against the decision, but you can read the comments here:
https://github.com/dlang/phobos/pull/7713

I should still add support for some kind of acceleration (e.g., core.simd). The liberty I have with this being a DUB package is that I could even use intel-intrinsics.