Feature #12802
openAdd BLAKE2 support to Digest
Description
BLAKE2 is a fast, modern hash function, based on improvements to the BLAKE function, which was a SHA3 finalist. BLAKE2 performs about twice as fast in software as SHA3 winner Keccak:
BLAKE2 has received an informational RFC 7693 from the IETF:
https://tools.ietf.org/html/rfc7693
It was added to the Python standard library in Python 3.6:
https://docs.python.org/3.6/library/hashlib-blake2.html
If there's interest in supporting BLAKE2 in the Ruby standard library, I can put together a patch.
Updated by ferdinandrosario@gmail.com (ferdinand rosario) about 8 years ago
- Assignee set to core
Updated by hsbt (Hiroshi SHIBATA) about 8 years ago
- Assignee deleted (
core)
Updated by nobu (Nobuyoshi Nakada) about 8 years ago
Is BLAKE2b unavailable if 64-bit integer is unavailable?
Updated by bascule (Tony Arcieri) about 8 years ago
BLAKE2b will work on 32-bit CPUs but is optimized for 64-bit CPUs
Updated by nobu (Nobuyoshi Nakada) about 8 years ago
I meant that BLAKE2b seems to need uint64_t
.
If a compiler does not support such large integer type, isn't BLAKE2b usable on that platform?
Updated by rhenium (Kazuki Yamaguchi) about 8 years ago
Is there still a supported environment without 64-bit integer support? ext/digest/sha2/sha2.c is already using 64-bit integers. It is compiled only when OpenSSL (or CommonCrypto) is not available, but the current versions of OpenSSL also require uint64_t.
But, I'm wondering, why not add the SHA-3 winner but only BLAKE2?
Updated by bascule (Tony Arcieri) about 8 years ago
Nice @ SHA-3 branch. I think it makes sense to add both.
The reason to add BLAKE2 in addition to SHA-3 is that BLAKE2 is, in some cases, over 3X faster than SHA-3 at an equivalent security level:
BLAKE2b on a modern Intel CPU is even faster than MD5, but provides substantially better security.
Something of a grassroots movement is pushing for the use of BLAKE2 anywhere speed is important, such as checksumming large files.
Updated by naruse (Yui NARUSE) about 8 years ago
Nobuyoshi Nakada wrote:
I meant that BLAKE2b seems to need
uint64_t
.
If a compiler does not support such large integer type, isn't BLAKE2b usable on that platform?
Kazuki Yamaguchi wrote:
Is there still a supported environment without 64-bit integer support? ext/digest/sha2/sha2.c is already using 64-bit integers. It is compiled only when OpenSSL (or CommonCrypto) is not available, but the current versions of OpenSSL also require uint64_t.But, I'm wondering, why not add the SHA-3 winner but only BLAKE2?
Many part of CRuby requires int64_t/uint64_t.
The point seems acceptable.
Updated by shyouhei (Shyouhei Urabe) about 8 years ago
We looked at this issue at today's developer meeting. We could not be sure if we need our own implementation of BLAKE2 (or SHA3). Maybe a matter of time? We might need to use SHA3 someday, but OpenSSL should also have one at that time (BLAKE2 is there already).
Isn't it better for us to encourage people switching from Digest to OpenSSL?
Updated by ioquatix (Samuel Williams) over 5 years ago
Wondering if we can review this again?
Updated by knu (Akinori MUSHA) over 5 years ago
I feel a bit reluctant to have an implementation in our source tree and keep maintaining it when there's almost always a better implementation available in OpenSSL::Digest when you need one.
Here are some examples of Digest gems I wrote, so why not start with a gem and see if there are enough amount of users out there?
https://github.com/knu/ruby-digest-whirlpool
https://github.com/knu/ruby-digest-tiger