17 ms·
Blake3 is 10 times faster than SHA-2
- diego_moita 7y agoIs "faster" always a good thing in hashing algorithms? Suppose a hashed password database falls into wrong hands. If they're hashed with a faster algorithm wouldn't it be easier to try a dictionary attack to discover the real passwords?
- jchw 7y agoBlake3 is not for use in a password hashing algorithm; those have different goals. Check out Argon2 or bcrypt for that.
- diego_moita 7y agoOk, thank you. I understand that it is for implementing things like dictionaries/hash tables.
- lucb1e 7y agoOr integrity checking for non-authenticated encryption modes (wouldn't want file encryption or https to be slow).
- nneonneo 7y agoNo, Blake3 is a cryptographic hash algorithm, not for dictionaries or hash tables. It is intended for cryptographic signatures, file/data integrity, message authentication codes, etc. For dictionaries/hash tables you'd typically use a very fast hash algorithm like xxHash, murmurHash, etc. Those are tuned for speed but can have collisions (typically they have very short outputs - 32 or 64 bits - so that they're easy to compare and compute with). For cryptographic purposes (authenticity, integrity) you'd use a medium speed algorithm like SHA2/3, Blake2/3, etc. which are reasonably fast and essentially guarantee there won't be collisions (i.e. it's computationally hard to come up with collisions). These are meant to be computed quickly and potentially in parallel because you want to be able to verify data fast. For password hashing you'd use a slow algorithm like bcrypt/scrypt or Argon2. These are designed specifically to be slow; some also use lots of memory specifically to slow down parallel attackers. You want password hashing to be relatively slow because you need to protect low-entropy data (a typical password only has a few dozen bits of security). By making the algorithm deliberately slow you would ensure that an attacker can't quickly guess the password, even if they have the hash. These are the three major categories of hash; knowing which one to use in which application is pretty important. Don't mix them up!
- yarg 7y agoIn any situation where a hashcode is cacheable (which seems to me to cover all situations where a hashcode even makes sense) a cryptographic hash function might not be such a bad idea (especially if you're IO bound in any way). With a bad hash function you can end up with a high level of bucket utilisation, significantly reducing the efficiency of the structure. With user defined data there's even the possibility of maliciously crafted input attempting to force collisions as part of a DOS attack. You can salt your input, and pretty much eliminate the issue - but as far as I can tell, you'll just end up rolling your own crypto.
- yarg 7y agoActually, a counter-point: there might be situations where you want an anti-cryptographic hash function - where similar inputs produce generally similar hashes. It could have some application as a preprocessing step in clustering (if it could be done efficiently).
- earenndil 7y agoEasy: for n-byte output, separate input into n equally-sized chunks (pad with zeroes if not enough). For each chunk, XOR all the bytes together.
- nneonneo 7y agoThose are called fuzzy or locality-sensitive hashes; they’re used a lot in image processing for similarity testing, for example. I don’t consider them to be in the same category as normal hashes, though, because fuzzy hashes have vastly different properties.
- dgacmu 7y agoThe term for this is locality sensitive hashing, and it's very useful in some contexts.
- nneonneo 7y agoCryptographic hash functions can be orders of magnitude slower than functions tuned for hashtables and dictionaries. If you’re using them as hash table indexes, then you have to take the big cryptographically secure number and mod it by a small bucket count - and then you’re going to have collisions. If you don’t salt, then an attacker is going to predict the bucket indexes no matter how strong your hash function is, and since you can’t have that many buckets, they can just brute force to find collisions. Salting is the way to deal with these issues, and for hash tables it works well even if your hash function isn’t cryptographically secure. Hence, for hash tables, salt+fast hash function should be sufficient.
- codetrotter 7y agoBlake3 is explicitly not a password hashing algorithm. For that use Bcrypt or Scrypt or Argon2. The authors of Blake3 point this out in the README of Blake3.
- jayflux 7y agoFor general purpose algorithms yes. Blake3 is not a password hashing algorithm it’s a general purpose one, used for checksums or verifying 2 files are the same etc. For password hashing you’re correct they should be slow, bcrypt for example.
- ilvez 7y ago> For password hashing you’re correct they should be slow, bcrypt for example. Slowness is not the quality of a hashing algorithm that guarantees anything :)
- thephyber 7y agoGuarantee, I agree. Resistance to quickly creating a rainbow table with significant coverage, however, is a reasonable property. The mentioned bcrypt library allows you to “tighten the ratchet” over time as average computing power increases to make hashing a single password in 2010 take about the same amount of time on average modern computing hardware as in 2020 (assuming you correctly increase the number of iterations)
- TheDong 7y agoYou're being pointlessly pedantic. The commenter above obviously meant "slow to brute-force". You're pedantically interpreting it to mean "slow for a given implementation, even if there are some scenarios under which it would be faster to brute force". What the parent comment meant is clear enough I think, and it's accurate in that context. The whole point of modern hashing algorithms that require memory and have scaling difficulty factors is to make it slower for an attacker with certain kinds of resources to brute force it. If you have a very slow hashing algorithm implementation of a fast hashing algorithm (say 'sleep 5, echo 1'), that's not slow by the parent's comment definition because it's not slow to brute force. Similarly, if the hashing algorithm has predictable output that allows the attacker to derive information about the input, that obviously is also faster to brute-force. That sort of pedantry is arguably somewhat useful if you also choose to provide a more precise definition or explanation. It's definitely not constructive if you just add a little smiley face and do it as an asinine "hah look at how smart I am".
- chefkoch 7y agoI guess Most would use rainbow tables so it wouldn't matter.
- geofft 7y agoYou can always make a fast hashing algorithm into a slow-enough password hashing algorithm by repeating it multiple times (as with PBKDF2) or better yet using a construction that also uses a minimum amount of memory, not just computational time. For most cryptographic applications (signing data in transit, signing data at rest, computing things like Merkle trees for applications like git and dm-verity), you want a hash that is fast to compute. It's basically only password hashing and cryptocurrency mining that needs to be slow. BLAKE3's readme says: (https://github.com/BLAKE3-team/BLAKE3 https://github.com/BLAKE3-team/BLAKE3) NOTE: BLAKE3 is not a password hashing algorithm, because it's designed to be fast, whereas password hashing should not be fast. If you hash passwords to store the hashes or if you derive keys from passwords, we recommend Argon2. Argon2 (https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf https://github.com/P-H-C/phc-winner-argon2/blob/master/argon...) is based on BLAKE2b.
- deleted 7y ago[deleted]
- mrb 7y agoFaster is always a good thing for a hashing primitive. For hashing passwords, you should not directly use a hashing primitive but instead stretch/iterate it through a higher-level algorithm, such as Argon2, that will (1) slow it down and (2) salt it.
- olliej 7y agoDifferent hashing functions have different purposes. More specifically a hashing function used for authenticating data must be fast, so should never be used for password hashing. Password hashing should always be performed using a hashing function designed specifically to prevent high speed execution - for that reason modern password hashing functions are both computationally slow (because of course), but also use large amounts of memory (to inhibit parallel execution).
- deleted 7y ago[deleted]
- amlozano 7y agoWe often use 'hash' as a sort-hand way of saying 'Key Derivation Function' when talking about secrets like passwords. https://en.wikipedia.org/wiki/Key_derivation_function https://en.wikipedia.org/wiki/Key_derivation_function These functions usually use hashes as a primitive, but there is more to them than that. Using a plain hash to store passwords is usually a red flag that the storage is insecure. I see it when doing source code audits: some legacy software using md5 without a salt. To be precise I think security community should make an effort to separate the two terms more often. I've been trying to be more precise when writing and reviewing assessment reports.
- throwawaymath 7y agoUnfortunately, not all password hashing algorithms are key derivation functions. That's just a common design and closely related.
- lucb1e 7y agoI've never really understood the difference between a KDF, hashing function, password hashing function, though it's relevant to know when writing reports (I work for a security company). We recommend Argon2/scrypt/bcrypt for password storage of course, but we call them KDFs and I'm not sure if it's correct. From my understanding, a KDF can be fast, but a PBKDF must be slow. Could you elaborate or do you know a good resource (short of a whole book on low level crypto details)?
- amlozano 7y agoWhen talking about passwords specifically in our reports (I work at a security company too), I tell our team to use the same language as NIST 800-63B, since its the best "standard" for passwords and authentication I can find. The relevant bit here is this: Verifiers SHALL store memorized secrets in a form that is resistant to offline attacks. Memorized secrets SHALL be salted and hashed using a suitable one-way key derivation function. Key derivation functions take a password, a salt, and a cost factor as inputs then generate a password hash. They are specific about the type of KDF required: "one-way key derivation function". The examples given later are PBKDF2 and Balloon.
- baby 7y agoyou are not supposed to use a hash to store a password (because hash functions are super fast), but a password hashing function instead like Argon2.
- isopede 7y agoAnother way of making it "slower" is to require more memory to compute your algorithms. The idea being that lots of memory is expensive no matter how clever you are with the computation.
- rurban 7y agoNot really. It's even 2x slower than SHA256-NI, the builtin. b3sum is much faster than sha256sum, and blake3 is about 2x faster than blake2. http://rurban.github.io/smhasher/doc/table.html http://rurban.github.io/smhasher/doc/table.html
- brandmeyer 7y agoJust exactly what does the "insecure" flag mean in your tables? I'm curious about the kind of definition you are using for security whereby sha2 fails but farmhash passes.
- rurban 7y ago"insecure" means that it fails any of the security tests. SHA2NI and many other hashes fail most of those unless they are hardened, e.g. by support for adding random seeds, being insensitive to added \0 and such. No crypto hash supports random seeds out of the box btw.
- antpls 7y agoNot sure why you are downvoted. Your table looks more factual than the blake3's github.
- espadrine 7y agoRE: the downvotes; while I didn't partake, I know there is history between the BLAKE/BLAKE2/BLAKE3 author, JP Aumasson, and Rurban, in particular related to differing opinions over the publication of SipHash. Differing opinions here means that most of the cryptographic community agree that SipHash clears its claims as a PRF, while Rurban indicated he has found undisclosed vulnerabilities that he wishes not to publish. RE: the table; a point to note is that BLAKE3's main implementation, in Rust, benefits a lot from multithreading on large files, which SHA2 cannot. The C version, which Rurban copied, does not leverage multithreading: https://github.com/BLAKE3-team/BLAKE3/blob/master/c/README.md https://github.com/BLAKE3-team/BLAKE3/blob/master/c/README.m...
- mintyc 7y agoDo the runtime tests decouple from I/O times e.g. file and memory caching aren't affecting the results? Surprised because I'd expect a big file like that to be I/o bound in practice
- thephyber 7y agoThere is a tech talk about Bao (I think it’s the same author) where he prefaced the talk by describing a few caveats like “benchmarks are lies” and he mentioned that you should always run a timed process a second time to tease out bias from cached/pages instructions and data. The core reason this method is faster than traditional SHAs is because Blake3 is a binary tree where the leaf blocks can be hashed in parallel and SHA is entirely sequential
- lucb1e 7y ago> you should always run a timed process a second time I should hope that anyone doing benchmarks does them multiple times to avoid crap like popcon or adobe reader update randomly keeping the system busy during one of the two algorithms' benchmarks. I don't expect that the author ran this only once and decided to make a blog post based on that, even if the post doesn't show multiple runs.
- kvlr 7y agoAuthor here, I did run it a few times but you don’t have to take my word for it, you can rerun the notebook yourself if you sign up for Nextjournal and remix my notebook. Full disclosure: I’m also a Cofounder of Nextjournal. But I wouldn’t suggest to use Nextjournal for serious benchmarking (yet). We’re running on Google Cloud and it’s not suited for benchmarking unless you pay for a (big) sole tenant instance. In the future we plan to offer dedicated instances for benchmarking.
- oconnor663 7y agoTo be clear, "benchmarks are nothing but lies" is an exaggeration to get my point across. (And a good way to get a laugh at the start of a talk.) But take a look at Figure 3 from the Performance section of the BLAKE3 spec: https://i.imgur.com/smGHAKA.png https://i.imgur.com/smGHAKA.png. Even ignoring things like caching and compiler settings and different hardware, that's a complicated graph! The lines cross all over each other. I count 5 different functions in that graph that are, for at least some input, the "fastest hash function". (I think BLAKE2sp just baaarely passes below BLAKE2bp, just prior to 8 KiB.) It's hard to give a simple summary of a complicated picture. For the big red bar chart at the top of the BLAKE3 repo, we certainly cherry-picked a point where BLAKE3 looks good. But you could also cherry-pick points where it looks bad.
- lucb1e 7y agoSpeed comparison from the BLAKE3 authors: https://github.com/BLAKE3-team/BLAKE3/ https://github.com/BLAKE3-team/BLAKE3/ I hadn't heard of BLAKE3 before (I thought BLAKE2b was the latest and greatest), judging by commits from the repositories of that user it's about half a year old now. Paper's abstract starts with: > BLAKE3 [is] an evolution of the BLAKE2 cryptographic hash that is both faster and also more consistently fast across different platforms and input sizes. BLAKE3 supports an unbounded degree of parallelism, using a tree structure that scales up to any number of SIMD lanes and CPU cores. On Intel Cascade Lake-SP, peak single-threaded throughput is 4× that of BLAKE2b, 8× that of SHA-512, and 12× that of SHA-256, and it can scale further using multiple threads. BLAKE3 is also efficient on smaller architectures [like] 32-bit ARM1176 In the introduction, the reason for BLAKE3 is described: > A drawback of BLAKE2 has been its large number of incompatible variants. The performance tradeoffs between different variants are subtle, and library support is uneven. BLAKE2b is the most widely supported, but it is not the fastest on most platforms. BLAKE2bp and BLAKE2sp are more than twice as fast on modern x86 processors, but they are sparsely supported and rarely adopted. BLAKE3 eliminates this drawback. It is a single algorithm with no variants Paper: https://github.com/BLAKE3-team/BLAKE3-specs/ https://github.com/BLAKE3-team/BLAKE3-specs/ (By the way, the download doesn't work for me in the latest Firefox on Linux and GitHub's rendering is plain awful. Not sure if anyone else can reproduce that or if my Firefox is broken.)
- zahllos 7y agoThe reason you haven't heard of it before now is that it was released 2020-01-09, last Thursday at the time of writing, at Real World Crypto.
- lucb1e 7y agoThe only author of BLAKE3 that spoke there was JP (@veorq). The day matches but the title of his talk is "Too Much Crypto". Is that where it was announced? (Quick link to program: https://rwc.iacr.org/2020/program.html#day-2020-01-09 https://rwc.iacr.org/2020/program.html#day-2020-01-09)
- 7y ago
- ww520 7y agoIs it better in preventing hash collisions?
- tromp 7y agoIt might be slightly worse as it reduced the number of rounds from 10 to 7.
- lucb1e 7y agoCompared to? MD2, MD4, MD5, SHA-1, etc.: There are collisions known, so yes. SHA-2, SHA-3, BLAKE2b, Skein, Whirlpool, etc.: We don't have any collisions for these, so it doesn't get any better than that.
- espadrine 7y ago> SHA-2, SHA-3, BLAKE2b, Skein, Whirlpool, etc.: We don't have any collisions for these, so it doesn't get any better than that. There are important differences; some of those primitives are definitely more trustworthy than others. SHA-2 and Whirlpool use the old Merkle–Damgård construction, which has fallen out of favor because of unfortunate properties. They are vulnerable to length extension attacks, such that it can be misused. For instance, if you want to use it as a keyed hash, you cannot just do sha2(key + message) (where + is concatenation). You have to use something like HMAC for that. Skein is much better, but has a bit of an aged design now, and an insane 72 rounds. It doesn’t have as much love as BLAKE2 for instance, which makes it unlikely that people will build things competitive with BLAKE3 with it. SHA-3, BLAKE2b and BLAKE3 are the best. Like Skein, they are not vulnerable to length extension attacks, so they have a trivial keyed hash function construction. SHA-3 in particular has an elegant new design, the Sponge construction, which yields precise cryptographic protections in terms of the number of bits of security. It has displaced Merkle–Damgård as The Way We Do Things™ now; many modern hashes use it, eg Gimli relied on it to make comparisons. One of the great things about this form is that it makes it a XOF: you can make your hash as long as you desire. (BLAKE also shares this property, but with a different construction.) However, SHA-3 is slow, so if you want speed, use BLAKE2b (or Kangaroo12) over SHA-3, and BLAKE3 over them both. If you want to be conservative about security and don't care about speed, a safe bet is still SHA-512/256, which is safe against length extension attacks.
- zimmerfrei 7y agoThis is a bit pointless, since it does not say on which platform the comparison is made. In any case, KangarooTwelve [1][2] (on AVX-512) is also 10x faster than SHA-256. KangarooTwelve is a fast hash function of the Keccak family (from which the SHA-3 derives from), and it is clearly what BLAKE3 tries to catch up with. However, KangarooTwelve probably benefits from the more extensive scrutiny that SHA-3 has received and will receive, and (from a performance standpoint) from future HW extensions that will speed it up even more (the first one appeared on ARMv8.2). [1] https://keccak.team/files/KangarooTwelve.pdf https://keccak.team/files/KangarooTwelve.pdf [2] https://www.cryptologie.net/article/393/kangarootwelve/ https://www.cryptologie.net/article/393/kangarootwelve/
- throwawaymath 7y agoThere is a comparison of Blake3 to various hash functions (including SHA-2 and SHA-3 families) on AWS c5.metal; see the chart here: https://github.com/BLAKE3-team/BLAKE3 https://github.com/BLAKE3-team/BLAKE3
- zimmerfrei 7y agoYes, and it didn't go unnoticed that KangarooTwelve (which - mind - does not belong to the SHA-3 family right now) is not included on that prominent comparison diagram, while it is considered in the BLAKE3 paper.
- throwawaymath 7y agoThat's a good point; I was just giving you a handy chart with an explicitly called out platform :)
- oconnor663 7y agoI felt it would've been unfair to include KangarooTwelve in that particular bar chart, because at 16 KiB of input it hasn't reached its peak throughput. At the same time, the goal was to focus on more widely used algorithms.
- 7y ago
- rhn_mk1 7y agoWhat are the criteria for choosing an integrity checking hash? Speed is always desired, and longer output makes collisions due to random bit swaps less likely. Even CRC32 is still used in embedded systems for short pieces of data. Is there anything else important for detecting transmission errors if the data was sent encrypted, or is something like MD5 still sufficient for such uses? Is Blake3 even worth considering for such a use case?
- dagenix 7y agoNever use MD5 except for compatibility.
- lucb1e 7y agoThis. There are hash functions that are faster than MD5, so it's not the fastest, and everyone knows (since 1996, actually[1]) that MD5 is insecure. If you want transmission error checking, use CRC32 or Siphash or whatever. If you want an actual, cryptographic hash function, then BLAKE3 is one of the options, though it's a very young one so unless you really know what you're doing, you should probably not use this for another few years. Heck, if anything in this comment is new to you, you'll want to steer clear of such low-level decisions and just use a library that makes the decision for you. [1] https://en.wikipedia.org/wiki/MD5 https://en.wikipedia.org/wiki/MD5 "In 1996, Dobbertin announced a collision of the compression function of MD5 (Dobbertin, 1996). While this was not an attack on the full MD5 hash function, it was close enough for cryptographers to recommend switching to a replacement, such as SHA-1 or RIPEMD-160."
- diegocg 7y agoI don't think it's a coincidence that BLAKE3 has been released shortly after the latest SHA-1 news. Many SHA-1 users would rather avoid the performance impact of SHA-2/3.
- deleted 7y ago[deleted]
- nloladze 7y agoUhhh, I have an idea how sha-256 works but not blake3. Is blake3 better for storing passwords? If not, what is the go-to recommended hash for password storage of say, a simple front-facing app for consumers.
- deleted 7y ago[deleted]
- nabla9 7y agoNeither is especially good for storing passwords. Better use specialized password hashing functions like Argon2 or bcrypt.
- klodolph 7y agoSHA-256 is absolutely not recommended for storing passwords, and it was never designed for that purpose. If you are storing passwords with SHA-256 you should immediately migrate them to a password hashing algorithm. See “Upgrading Legacy Hashes” in the link below. https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html https://cheatsheetseries.owasp.org/cheatsheets/Password_Stor... Recommended algorithms: - Argon2 - PBKDF2 - Bcrypt
- deleted 7y ago[deleted]
- jupp0r 7y agoThis benchmark is not a comparison between BLAKE3 and SHA-2, it’s a comparison between b3sum and sha2sum. Things like file access pattern, hiding io latency, distributing work to cores, etc can make huge differences that have nothing to do with the hash functions themselves.
- deleted 7y ago[deleted]
- baby 7y agoJP Aumasson just announced Blake3 at Real World Crypto a few days ago during the lightning talks. This was also right after he presented on "Too Much Crypto"[1] which argues that we use too many rounds in symmetric constructions: our security margins are too high and don't match any of the best "practical" attacks. We're too paranoid for our own good. He suggests reducing the number of rounds for a number of constructions like AES, SHA-3, Blake2, etc. [1]: https://eprint.iacr.org/2019/1492.pdf https://eprint.iacr.org/2019/1492.pdf Blake3 is in part a reduction of number of rounds (so it's faster), it's also a bit of a design change (the round function, and the parallelization), and it's now just one multi-purpose function (instead of several instances) that takes an arbitrary-length input and gives an arbitrary-length output. My questions are: * what are standards using Blake2 (like Noise) going to do? * what do cryptanalysts think? * is it really that fast? (I'll have to benchmark this for my own use-case.)
- dathinab 7y ago> which argues that we use too many rounds in symmetric constructions: our security margins are too high and don't match any of the best "practical" attacks. We're too paranoid for our own good. He suggests reducing the number of rounds for a number of constructions like AES, SHA-3, Blake2, etc. This seems a quite dangerous way of thinking. New attacks, methods to attack crypto are discovered regularly. A view years ago people also said SHA-1 will never get broken to the degree it just got broken a recently. So the only think we can do is to be slightly paranoid, everything else would be strongly negligent. Especially if we consider how long it often takes in practice to update software and phase out previous encryption and hash methods without having to worry about e.g. downgrade attacks or similar. Sure software should be possible to be updated asap, but honestly how long will it take until SHA-1 is phased out? EDIT: Through that also means if you believe you will always be able update the _deployed_ relevant parts of your software ASAP (which can't work for libraries) and you are sure that you will follow the crypto community close enough and you believe some one else does so to if you are unavailable because of sickness, then yes go ahead and use less paranoid/secure crypto.
- bawolff 7y ago> This seems a quite dangerous way of thinking. New attacks, methods to attack crypto are discovered regularly. He does actually address this counterargument in his paper. In fact most of his paper is a rebuttal to this argument (the status quo wisdom, so to speak).
- jagged-chisel 7y agoI can write a fast digest algorithm. Doesn't mean it's safe for anything more than triviality.
- andybak 7y agoI look forward to a future point in time where Blake7 is released.
- oconnor663 7y agohttps://twitter.com/dchest/status/1215751501567709185 https://twitter.com/dchest/status/1215751501567709185
- JdeBP 7y ago1978 isn't on the graph. (-: Hint: andybak was making a joke.
- oconnor663 7y agoStraight talk, should I watch this show? :)
- JdeBP 7y agoAre you prepared to cope with the idea that, more than 7 centuries from now, a tetchy oblong plastic computer will be able to easily find collisions in any hash algorithm that you can come up with and take over any system that strikes its fancy? ... and that it is in the hands of Kerr Avon?
- fanf2 7y agoA friend recently wrote a re-watch review: https://nwhyte.livejournal.com/tag/tv:%20blakes%207 https://nwhyte.livejournal.com/tag/tv:%20blakes%207
- blakesterz 7y agoThis is completely pointless, but there's so many random things I share a name with, and somehow I've only met a few PEOPLE named Blake in real life.
- nneonneo 7y agoA lot of people in the comments are wondering about using SHA-2 vs Blake3 for password hashing. The answer is, neither of these is suitable by itself for password hashing. Sadly there’s still a lot of advice on the internet (and, sadly, real systems) which do things like store md5(password) in a database and call it a day. Blake2/3, SHA-2/3, and other cryptographic hash functions are meant to be fast, while also effectively guaranteeing no collisions or any way of reversing the hash (pre-image attack). This makes them ideal for stuff like checking file integrity, message authentication, inputs for cryptographic signatures and the like. But since they’re meant to be fast, they’re very poor choices for hashing low-entropy data such as passwords - attackers can test vast numbers of passwords (even if you salt!!) on GPU hardware. For low-entropy data, you want a hash function that is slow and hard to parallelize. Use a specialized password hashing algorithm like bcrypt, scrypt or Argon2, and tune it so it’s slow enough without impacting overall usability (e.g. takes 50ms on your server). These algorithms are resistant to parallelization, so attackers will only be able to test a small number of passwords per second. This slows attackers down and can prevent them from recovering passwords that might be recoverable if stored using SHA-2, etc.
- nolok 7y ago> tune it so it’s slow enough without impacting overall usability (e.g. takes 50ms on your server) I want to insist that this is a very important part. If you are 99.9% of applications or websites out there, the only time you need to run that hash is at registration, login and password change. All of these case will be fine if it's a bit slow. Don't lowball it. Also informationally I would like to add that as part of their "meant to be slow" job, algorithm like bcrypt are built in a way that makes it extremely hard if not impossible to run on cheap massively parallelized hardware (eg: CUDA on GPU).
- kragen 7y agoAlso you can do the stretching in the browser client (“server relief”) without losing security. Historically this would have meant a big performance penalty (and thus an advantage for attackers, who don't need to use your code) but JS and wasm are fast enough now that the price is fairly low.
- wolf550e 7y agoI would like to see the performance of KanagarooTwelve in the same tree structure as BLAKE3, with AVX-512, on the same hardware (AWS c5.metal).
- oconnor663 7y agoTake a look at Figure 3 in the Performance section of the BLAKE3 spec: https://i.imgur.com/smGHAKA.png https://i.imgur.com/smGHAKA.png. That graph doesn't account for differences in the tree structure, but it compares the performance of both with AVX-512.
- SlowRobotAhead 7y agoI have a project I couldn’t use SHA-2 on because of speed and because it was a 224bit or 256bit result. Is there a way to use Blake3 in a reduced hash result way? Like 12-16 byte results. (IIRC, you can not truncate hashes for smaller results)
- garmaine 7y agoSHA-224 is literally truncated SHA-256. There's no security proof this is safe, but only in the sense there is no proof SHA does what it claims to do at all. Hash truncation is in the design of SHA-2. There's even an appendix of one of the FIPS documents explaining how to do the truncation for arbitrary sizes. But be very careful to make sure that you only need preimage resistance...
- bscphil 7y agoA 224 bit output is going to be collision resistant too, though, for the foreseeable future. And when it comes to preimage resistance, even md5 is safe for the time being. (With the usual qualifier that there's absolutely no justification for using it with better hashes available.)
- garmaine 7y agoHe's talking about 12 to 16 byte outputs though, which is 96-128 bits of preimage resistance, and only 48-64 bits of collision resistance.. which would be very broken today.
- SlowRobotAhead 7y agoMostly. There are 12-16 byte hash or hash-like results are plenty secure. They’re keyed though. The output from HMAC and AEAD ciphers with no encryption (think the additional data portion of ChaCha20-Poly1305 in a Nonce-MAC mode)... or maybe I’m wrong because these require nonces and keys.
- 7y ago
- throwaway838475 7y agoI always shake my head when performance is touted for new functions/constructions. It’s more important to minimize the costs of legitimate use while maximizing the costs of software and hardware attacks. Minimizing the former inevitably leads to minimization of the latter in brute force (cloud cluster, ASIC, FPGA, etc.) attacks. The fundamental impetuses of scrypt (a PBKDF rather than an unauthenticated hash function) was a righteous and necessary advance that must never be forgotten with each fashionable iteration of newness that seems to lose sight of how faster or newer isn’t always automatically better.
- nullc 7y agoUnless you have SHA-NI in your processor... in which case Blake3 is slower than SHA-2.
- icf80 7y agoIf you hash the password, and then use that hash as the key to encrypt(AES/ChaCha20) the original password it self, isn't this good?
- FRIEDCHICKEN 7y agobahaha, yes indeed Blake3 is faster than SHA-2. By reducing the 10 rounds in Blake2 to 7 rounds in Blake3... lol OK NSA
- PabloGranolabar 7y agoReducing 10 rounds in Blake2 to 7 in Blake3.. huh? The entire industry is going in exactly the opposite direction of this, to increase the complexity and depth of the attack surface of cryptographic methods and algorithms due to advances in quantum computing. Cloudflare, Microsoft Research etc are all investing heavily into post-quantum cryptography technologies, almost exactly the opposite of what this guy is promoting. Makes no sense. ‾\_(ツ)_/‾