30 ms·
A new hash algorithm for Git
- jakeogh 7y agoIs there an archive of crypto related future predictions? How long until a specified length preimage attack can break bittorrent blocks? I remember a paper published a ~decade ago estimating very short (well funded) ASIC sha1 collisons. Anyone have that ref? EDIT: Should I have not said preimage? My understanding is bittorrent is broken (by DDoS, not infohash(?)) if you can make a bad block that matches the length and sha1 of a target block.
- glandium 7y ago> How long until a specified length preimage attack can break bittorrent blocks? Even MD5 still doesn't have a known preimage attack, so... many many years?
- tialaramex 7y agoTo be fair for MD5 there is a known attack, it's just impractical. It's a real attack though because the whole point of a crypto hash is that you'd have to brute force it to win, and the paper shows a slightly quicker way because MD5 is broken. It's just not quick enough that you could actually do it. Oh wait, perhaps you actually meant preimage as you said rather than I assumed second preimage. OK yes, that isn't ever going to be possible for non-trivial inputs.
- GoblinSlayer 7y agoCheap talk is hardly an attack though.
- rocqua 7y agoI think OP meant 'viable' pre-image attack. Not just an attack that is better than brute force.
- pabs3 7y agoThere is one for hashes: http://valerieaurora.org/hash.html http://valerieaurora.org/hash.html
- strenholme 7y agoNot to mention this one, which covers more hash algorithms: https://electriccoin.co/blog/lessons-from-the-history-of-attacks-on-secure-hash-functions/ https://electriccoin.co/blog/lessons-from-the-history-of-att...
- hannob 7y agoPreimage is really a whole different beast than collission. It's also not particularly surprising. Just by its length SHA-1 has in its best case 80 bits of collission security and 160 bits of preimage security. Now its important to understand that attacks usually don't cause full devastation, but they usually make attacks a bit better than optimal. Attacks in the 60 bit range is what's possible, attacks in the 70 bit range is what's dangerous. It's easy to imagine that relatively small deviation from optimal security gets SHA-1 from 80 into the dangerous territorry (the attacks are in the low 60s range). However getting from 160 bit down to the 60/70 bit range would require massive improvements in attacks. It's safe to say that SHA-1 is still very far from preimage attacks. Still to be clear I'd still recommend to get rid of it whereever you can. The far bigger risk is that you think you only need preimage security, while you actually need collission security for scenarios you haven't thought about.
- tialaramex 7y ago> EDIT: Should I have not said preimage? My understanding is bittorrent is broken (by DDoS, not infohash(?)) if you can make a bad block that matches the length and sha1 of a target block. There are three different attacks 1. Collision, which is practical (expensive but practical) for SHA-1 today, lets somebody make two documents A and B which have the same hash. This is only useful if you can fool people somehow into accepting document B when they think it's document A because of the hash, for example with digital signatures. 2. Pre-image, which is not practical for any hashes you care about including MD5. This lets you find the document A given the hash(A) value. This is very niche, since obviously for large documents by the pigeon hole principle there will be many such pre-images and it's impossible to get the "right" one, for small inputs it can be relevant, sometimes. 3. Second Pre-image, likewise not practical. Given either document A or hash(A) which you could easily determine from document A, this lets you produce a new document A' that is different from A but hash(A') == hash(A). This would be extremely bad, and is what you'd need to attack real world Bittorrent from somebody else. Often people say "pre-image" meaning strictly second pre-image, it's usually clear from context, and a true pre-image attack as I explained above is only rarely relevant. Collision would only let bad guys corrupt their own purposefully constructed collision bittorrent, which like, why? So yes, Bittorrent would only really be in serious trouble if there was a second pre-image attack. But on the other hand, don't use broken cryptographic primitives. Attacks only get better, always.
- SAI_Peregrinus 7y ago1.5 Chosen-prefix collision: Given a prefix A, generate two values AB and AC, where B and C differ but are both prefixed with A. (AX is A concatenated with X). This exists for SHA1. It's more powerful than a basic collision wheri you can't pick the prefix, but weaker than either type of pre-image.
- wyoung2 7y agoIt's worth noting that this attack is a property of the Merkle–Damgård hash construction, not of SHA-1 specifically, which means SHA-2 (Git's path forward) is also vulnerable: https://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction#Security_characteristics https://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_co... https://www.reddit.com/r/crypto/comments/44p5jc/eli5_why_are_chosenprefix_collisions_specific_to/ https://www.reddit.com/r/crypto/comments/44p5jc/eli5_why_are... Fossil uses SHA-3, which has an entirely different construction, which is not at this time known to have a similar weakness. SHA-3 is also much newer, with a much shorter list of known attacks.
- sandGorgon 7y agodoes anyone know if github/bitbucket support it today ?
- freddie_mercury 7y agoWhy would they support it? The article clearly states it is nowhere close to being useful yet. It is untested, unstable code that can only write to repositories and not read them. "Much of the work to implement the SHA‑256 transition has been done, but it remains in a relatively unstable state and most of it is not even being actively tested yet. In mid-January, carlson posted the first part of this transition code, which clearly only solves part of the problem: "First, it contains the pieces necessary to set up repositories and write _but not read_ extensions.objectFormat. In other words, you can create a SHA‑256 repository, but will be unable to read it. "
- sandGorgon 7y agoactually - i might have worded it confusingly. For smaller projects (like my own), can i move to sha-256 with no expectation of backward compatibility today ?
- SAI_Peregrinus 7y ago"First, it contains the pieces necessary to set up repositories and write _but not read_ extensions.objectFormat. In other words, you can create a SHA‑256 repository, but will be unable to read it. " If you want it to be write-only, sure, go ahead!
- tcharlton 7y agoI can't find documentation for the command in the article: git convert-repo --to-hash=sha-256 --frobnicate-blobs --climb-subtrees \ --liability-waiver=none --use-shovels --carbon-offsets Surely some of those options aren't real...
- amarshall 7y ago> A new version of Git can be made…with a simple command like: <command> … note that the specific command-line options may differ Gives me the impression that it’s a construction of the article alone. Unsurprising, given the snark of the options.
- buserror 7y agoOf course they are ?!?!!? https://git-man-page-generator.lokaltog.net/ https://git-man-page-generator.lokaltog.net/ (never fails to amuse me)
- bangboombang 7y agoOh dear god. Because it's git related, my brain somehow still tries to make sense of that stuff because it just seems so real.
- ekimekim 7y agoIt's a curious feeling. Like reading code that is syntactically valid but utterly nonsensical.
- hrgiger 7y agoreminds me https://projects.haykranen.nl/java/ https://projects.haykranen.nl/java/
- pabs3 7y agoThat seems to be intended to be humour.
- 7y ago
- mratsim 7y ago> Thus, unlike some other source-code management systems, Git does not (conceptually, at least) record "deltas" from one revision to the next. It thus forms a sort of blockchain, with each block containing the state of the repository at a given commit. Color me surprised, dropping the "blockchain" word in the middle of the introduction
- AndrewDucker 7y agoGit is a blockchain. Being, as it is, a chain of signed blocks.
- tonyedgecombe 7y agoGit is a Merkle tree as is a blockchain. https://en.wikipedia.org/wiki/Merkle_tree https://en.wikipedia.org/wiki/Merkle_tree
- afiori 7y agoIt is still a sort of namedropping. In the sense that it is used due to the trendiness of the term. It is entirely possible and likely that it is used for didactic purposes as many people are familiar with the blockchain structure and its use of hashes.
- bawolff 7y agoI thought it was a joke. The whole: blockchain isnt that inovative if you use a strict technical definition because lots of things are a chain of blocks before bitcoin was cool, meme. And honestly fair enough. The inovative part of bitcoin is not the blockchain but all the economics & game theory going on to create trust in the system
- anaisbetts 7y agoI don't understand the practical attack vector for breaking SHA1s in Git. Not only are objects checksummed by SHA1, they also encode the length. Finding a SHA1 collision is plausible, but finding a SHA1 collision that both lets you do something Nefarious, and is the length you need, seems really really unlikely
- tialaramex 7y agoThis makes no sense. The collision manufacture algorithm of course produces the same length output in both the A and B documents. Doing otherwise would be considerably harder in fact.
- HereBeBeasties 7y agoYou're assuming that 100% of the source code matters, but most source code has comments. Some has a lot of comments (boilerplate headers). Delete all the comments and superfluous whitespace, add nefarious code, put in a comment in the remaining bytes for the sole purpose of causing a hash collision (likely plenty of bytes to play with).
- scoutt 7y agoYes, but... > this new version would have to contain the desired hostile code, still function as a working floppy driver, and not look like an obfuscated C code contest entry It's still plausible that one can pull a trick like that to introduce malicious code into the repo, but improbable.
- est31 7y agoThe shattered collision attack featured two pdfs with the same sha1 and wait for it, the same length. Also note that even with normal sha1, the length is hashed into the final sha1 hash already, that's what the merkle damgard scheme is about. You can read about it on Wikipedia. Reusing the precise collision from the shattered attack is made impossible by initializing the state with anything other than the prefix from the shattered attack. But the cost for mounting such an attack yourself is only 11k USD. However, as git uses the sha1collisiondetection library, such an attack would be detected by current git. Thus, this library is a much better protection than the length encoding.
- nnx 7y agoSurprising they didn't go with Blake3 instead since it has much higher performance and Git's performance-oriented ethos.
- Ayesh 7y agoLinux also has the ethos to choose boring technology. SHA2 has been here for so long and battle tested. For the majority of us, it is the natural choice. I'm not implying anything negative about SHA3/Blake/Keccak.
- dchest 7y agoBLAKE3 was released a month ago! The decision for new hash in git was made about two years ago. BLAKE2 was considered, though. SHA-256 is fine. The biggest problem is switching to it...
- fanf2 7y agoThey made the choice years ago and blake3 was announced last month.
- nullc 7y ago> Git's performance-oriented ethos Than sha256 will likely be preferable in the long run: It's faster with SHA-NI than blake3. If you're not developing on a system with sha-ni, get with the program. Zen2 is freeking awesome. :)
- k5hp 7y agoJust in case: http://archive.is/omsjJ http://archive.is/omsjJ
- GlitchMr 7y agoI wonder if it would make sense to use `concat(sha1, sha256)` hash algorithm. This wouldn't change the prefixes while improving strength of an algorithm (by including SHA256 in a hash).
- dchest 7y agoSomething to remember about the security of concatenated hashes: https://crypto.stackexchange.com/a/63543/291 https://crypto.stackexchange.com/a/63543/291
- GlitchMr 7y agoI'm well aware concatenation wouldn't necessarily improve the strength. However, the idea is, even if SHA-1 was hopelessly broken. CONCAT(SHA1(x), SHA256(x)) would be at least as strong as SHA-256 (where "at least" means it may have the same strength).
- Double_a_92 7y agoIf you know that it's a concatenation, couldn't you only look at the SHA1 part and completely bypass any other strong hash? On second thought probably not, because you might find any possible collision, that isn't a collition on all the other hash algorithms. If you bruteforce through a password list it would still apply though.
- GlitchMr 7y agoThis doesn't work for collision resistance attacks. git commits aren't password hashes. Specifically, the attacker's goal in this case is to find different values a and b for which hash(a) = hash(b), rather than finding a value of m in h = hash(m) for known h.
- pwagland 7y agoThis would help if you _only_ shared the prefix, however git would still use the full hash. The proposed method would have the advantage of keeping existing known abbreviations, which are _already_ less secure than SHA-1, while keeping the security of the second hash. It also has the disadvantage that the full hash would become excessively large and unwieldy, so pros and cons.
- official151 7y agohttp://www.jobsfinderuae.com/ http://www.jobsfinderuae.com/
- velox_io 7y agoUnless I'm missing something, why not just allow repositories to be upgraded to SHA2 hashes? The only problem is ensuring everyone's tooling supports it.
- majewsky 7y agoThis question is exactly what a major portion of the article covers.
- velox_io 7y agoIt isn't the easiest article to read, plus they over complicate things by talking about things such as truncating SHA2 hashes. I don't see why changing the hashing algorithm is so problematic, hence the reason why I asked the question. Converting a repository to SHA2 should be straight forward (the only issue is everyone's tooling), you could also run the repositories side-by-side. I'm genuinely interested as I think Git & Bittorrent are quite elegant solutions to complex problems.
- majewsky 7y ago> the only issue is everyone's tooling Exactly! If you've ever worked in a corporate environment, you know the fun of having to support 10-year-old versions of your favorite cutting-edge software.
- londons_explore 7y agoI don't think it's that unreasonable to release git binaries today with sha256 support, then wait 5 years, then make all new commits use sha256. Anyone who tries to use a git client more than 5 years old wouldn't be able to pull+push to a new repo. Sounds reasonable to me. Git clients more than a few years old are pretty broken already due to TLS changes. Keeping around a dual hash system forever sounds like baggage and complexity that outweighs the benefits.
- powerapple 7y agois it a real problem for git? Do we merge code based on hashes instead of looking at the code.
- donatj 7y agoThe problem is in if you can make evil code with the same hash as innocuous code, you can poison people who pull from a given repo you have access to. It would allow you to make changes to the history without merging anything or anyone being the wiser. It makes the distributed aspect of git untrustworthy, as previously you knew if you pulled from anywhere and the hash was good, you’d pulled the correct code. With SHA1 being functionally broken that’s no longer necessarily the case.
- donatj 7y agoExcuse my ignorance, but couldn’t they just add a SHA256 hash to commit objects (or some new commit-verify object) of the entire trees current concatenated content, leave everything else SHA1 and get the same benefit without rewriting the entire thing from the ground up? Git could even do that as part of the git gc step slowly over time - tag commits with a secondary hash. Rewriting the whole thing including every git repos history seems like throwing the baby out with the bathwater, when you could just add a secondary transparent verification instead. Just seems like there has to be a better way.
- kzrdude 7y agoHashing everything in one go doesn't scale well. When making a new commit you want to only hash a proportional part of the repository, and the tree structure of git allows that, only the files and "tree" objects (directory listings) that change are hashed again.
- wongarsu 7y agoYou can't change past commits to add that hash (without changing all commit hashes), so this method could only protect new commits. For any existing repo this would lead to a very weird security model: We admit that sha1 hashes are broken, and only guarantee that commits made by git versions newer than git x.x.x are safe from after-the-fact modification (or alternatively only commits made after date X).
- deleted 7y ago[deleted]
- arve0 7y agoI’m not known with the internal data structure of git, but couldn’t you add the new hash as a commit in a new format “on the side”, leaving the original commit as is?
- WorldMaker 7y agoGit does have an commit-related object called a note that you can attach as a separate object. [1] Presumably the proposed "hash translation store" could use an approach similar to notes, and include the hash translations as objects in the git database (hopefully in a way that could be signed by a tag). [1] http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes.html http://alblue.bandlem.com/2011/11/git-tip-of-week-git-notes....
- angrygoat 7y agoThis article is via an LWN subscriber link; a cheerful reminder that LWN are good and they are worth subscribing to :) https://lwn.net/subscribe/ https://lwn.net/subscribe/
- john-radio 7y agoOP's link says it is "subscription-only content," but it is still publicly available. It says that it has been "made available by an LWN subscriber." How does that work?
- robjan 7y agoSubscribers receive a sharing link which can be used to share articles with friends. They tolerate sharing on HN because it brings in new customers.
- globuous 7y agoDamn, lwn is sweeet !! :)
- john-radio 7y agoThat's one smart model.
- cesarb 7y agoIt's a "subscriber link": https://lwn.net/op/FAQ.lwn#slinks https://lwn.net/op/FAQ.lwn#slinks
- brobdingnagians 7y agoI was interested in how fossil handled the SHA1 transition, and found this nicely explained as below: https://fossil-scm.org/home/doc/trunk/www/hashpolicy.wiki https://fossil-scm.org/home/doc/trunk/www/hashpolicy.wiki
- Tyr42 7y agoAh, so it uses "Hardened SHA1", which detects if you are trying to exploit SHA1, and then produces a longer, unambiguous hash. But otherwise Hardened SHA1 has the same output as SHA1, so it's a drop in replacement. Then it also has a similar looking-ish migration to SHA3-256.
- velcrovan 7y agoFossil defaults to SHA3-256 since 2.10 (released in October 2019). But it has had SHA3-256 since March 2017, and generally any repos/clones managed with a Fossil version since then have been seamlessly updated to SHA3-256 in the background.
- velcrovan 7y agoFossil's main author is chiming in the discussion of this on Fossil's forums: (https://fossil-scm.org/forum/forumpost/50a5bea5fb https://fossil-scm.org/forum/forumpost/50a5bea5fb) > That's appalling. Fossil's implementation doesn't require a conversion. “This is a key point, that I want to highlight. I'm sorry that it wasn't made more clear in the LWN posting nor in the HN discussion. “With Fossil, to begin using the new SHA3 hash algorithm, you just upgrade your fossil binary. No further actions, workflow changes, disruptions, or thought are required on the part of the user. * “Old check-ins with SHA1 hashes continue to use their SHA1 hash names.” * “New check-ins automatically get more secure SHA3 hash names.” * “No repository conversions need to occur” * “Given a hash prefix, Fossil automatically figures out whether it is dealing with a SHA1 or a SHA3 hash” * “No human brain-cycles are wasted trying to navigate through a hash-algorithm cut-over.” “Contrast this to Git, where a repository must be either all-SHA1 or all-SHA2. Hence, to cut-over a repository requires rebuilding the repository and in the process renaming all historical artifacts -- essentially rebasing the entire repository. The historical artifact renaming means that external links to historical check-ins (such as in tickets) are broken. And during the transition period, users have to be constantly aware of whether they are using SHA1 or SHA2 hash names. It is a big mess. It is no wonder, then, that few people have been eager to transition their repositories over to the newer SHA2 format.”
- cm2187 7y agoStating the obvious but the hash is a hex, that leaves lots of characters for a one character prefix for sha256 hashes. Like the character "s" for instance.
- pkilgore 7y agoI love LWN's technical writing--its worth the cost of a subscription!
- deleted 7y ago[deleted]
- throwaway-q2233 7y agoCan't just take Sha 1 of Sha 256?
- loeg 7y agoNope.
- ericfrederich 7y agoI'll have to update my program which generates vanity hashes. I do enjoy starting projects with an obligatory "Initial Commit" with a deadbeef SHA-1
- bmn__ 7y agoI like to start a repo with an "empty" commit, that is to say its tree is the magic 4b825dc. https://news.ycombinator.com/item?id=18342763 https://news.ycombinator.com/item?id=18342763 I wonder if it would still be practically possible to manipulate the commit id.
- loeg 7y agoYep. You can inject arbitrary metadata into the git commit object and the git cli ignores it, other than including it in the hash. E.g., https://github.com/kevinwallace/gitbrute https://github.com/kevinwallace/gitbrute , https://github.com/kevinwallace/gitbrute/commit/0001111 https://github.com/kevinwallace/gitbrute/commit/0001111 .
- wyoung2 7y agoWow! I wouldn't have guessed that Git had that vulnerability. Fossil solves it easily: creating a new repo involves generating a random project code (a nonce) which goes into the hash of the first commit, so that even two identical commit sequences won't produce identical blockchains. Fossil lets you force the project ID on creating the repo, but the capability only exists for special purposes.
- kzrdude 7y agoIt doesn't seem to be a vulnerability at all
- PaulHoule 7y agoI am not a fan of SHA-256, you are better off with SHA-386 or SHA-256/512 which resist prefix attacks and are actually a little fast on 64 bit machines.
- alkonaut 7y agoI didn't get the argument against just converting? Sure some code bases are large and spread out, but any git repo needs to have one blessed central point, and everyone needs to be able to just re-clone from the central repository whenever history is rewritten for whatever reason (could be that a huge file is trimmed from the past etc). Why can't all commits in the Kernel history be rewritten to SHA256? (Other than that it would be an annoying interruption in the development)?
- corbet 7y agoThe kernel doesn't really have the one central blessed point of which you speak. Sure you can grab mainline releases from Linus's repository, but that's not where the development actually happens. It really is a distributed project, and having to delete all those old repositories would really hurt.
- alkonaut 7y agoIf 2 separate copies of the same repository does the same rewrite to sha256, their histories are still compatible and equal up to the point where they diverge. So other than that the rewrite needs to happen in more places, it should still be doable. Needs to happen at more or less the same time however.
- velcrovan 7y agoThe whole point of git is that there doesn't need to be a blessed central point.
- RichardCA 7y agoMost development shops are using the traditional client-server model, or self-host using Gitlab. I personally would never allow a repo with two hashing algorithms to exist on my watch. If you have ever had to use a tool like BFG to prune large objects from a repo you'll see it's not that bad, but it does require users to re-clone. I would want to use the same process for SHA256 - that is let it be the default for new projects and then convert older projects based on need. But there needs to be a BFG style conversion tool that spits out an object id map as output. Here's more info on BFG: https://rtyley.github.io/bfg-repo-cleaner/ https://rtyley.github.io/bfg-repo-cleaner/
- strenholme 7y agoI’m already seeing a lot of discussion both here and over at LWN about which hash algorithm to use. The Git team made the right choice: SHA2-256 is the best choice here; it has been around for 19 years and is still secure, in the sense that there are no known attacks against it. Both BLAKE[2/3] and SHA-3 (Keccak) have been around for 12 years and are both secure; just as BLAKE2 and BLAKE3 are faster reduced round variants of BLAKE, Keccak/SHA-3 has the official faster reduced round Kangaroo12 and Marsupilami14 variants. BLAKE is faster when using software to perform the hash; Keccak is faster when using hardware to perform the hash. I prefer the Keccak approach because it gives us more room for improved performance once CPU makers create specialized instructions to run it, while being fast enough in software. And, yes, SHA-3 has the advantage of being the official successor to SHA-2.
- jayflux 7y ago> BLAKE is faster when using software to perform the hash Is BLAKE 3 still faster than sha-256 when using the cpu speciliazed instructions? I think most modern desktop CPUs has built-in instructions for SHA256. I’m guessing when people compare BLAKE 3 to SHA 256 they’re comparing software to software, but this wouldn’t be the case in reality?
- strenholme 7y agoI haven’t seen any benchmarks for BLAKE3 vs. the Intel/AMD SHA extensions. My guess is that Intel hardware accelerated SHA-256 will be faster than BLAKE3 running in software for most real world uses. I can tell you this much: It is only with Ice Lake, which was released in the last year, that mainstream Intel chips finally got native hi speed SHA-NI support. Coffee Lake and Comet Lake, which are still the CPUs in a lot of new laptops being sold right now, do not support SHA-NI.
- wahern 7y agoAMD Zen supports SHA extensions across all SKUs. Here are `openssl speed` numbers on an AMD EPYC 3201: type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes blake2s256 46720.33k 187461.21k 305314.65k 373840.55k 398207.66k 401528.15k blake2b512 38423.44k 155318.81k 422325.08k 592401.75k 674843.31k 681743.70k sha256 84620.44k 279840.47k 723573.76k 1199678.81k 1484693.50k 1510484.65k sha512 33854.38k 135674.20k 275343.70k 444872.36k 545802.92k 554166.95k sha3-256 26146.35k 103860.27k 253944.92k 308119.21k 347477.33k 351906.47k sha3-512 26349.83k 105590.85k 144236.03k 173082.62k 189448.19k 189814.10k It's possible that Blake3 might be faster than accelerated SHA-256 on large inputs, where Blake3 can maximally leverage its SIMD friendliness. OTOH, Blake3 really pushes the envelope in terms of minimal security margin. Performance isn't everything. SHA-3 is so slow because NIST wanted a failsafe. OpenSSL info: OpenSSL 1.1.1c 28 May 2019 built on: Tue Aug 20 11:46:33 2019 UTC options:bn(64,64) rc4(8x,int) des(int) aes(partial) blowfish(ptr) compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-D7S1fy/openssl-1.1.1c=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2 NOTE: /proc/cpuinfo shows sha_ni detection, and the apt-get source of this version of OpenSSL confirms SHA extension support in the source code, but I didn't confirm that it was actually being used at runtime.
- zackmorris 7y agoSummary of hashing function security in bits, for convenience: https://en.wikipedia.org/wiki/Secure_Hash_Algorithms https://en.wikipedia.org/wiki/Secure_Hash_Algorithms Since collision resistance is roughly half the number of bits, it seems unconscionable to me that anything below 256 bit hashes even exist, because 64 bits is crackable but 128 bits effectively never will be. This was well-understood even in the 90s when MD5 and SHA were first published. Just thinking about this for the first time, I don't buy any argument about storage or performance, since those become less important as time goes on. It feels like Linus made a mistake here, and offloaded the inevitable work of upgrading repositories onto the general public (socialized the cost) which is something that all programmers should work harder to avoid. Said as an armchair warrior who has never accomplished anything of any importance, I realize.
- mathnmusic 7y agoAlso relevant: Multihash is a format for self-describing hashes that helps with data portability and future-proofing: https://github.com/multiformats/multihash https://github.com/multiformats/multihash
- kazinator 7y ago> There is, of course, a way to unambiguously give a hash value in the new Git code, and they can even be mixed on the command line; this example comes from the transition document: git --output-format=sha1 log abac87a^{sha1}..f787cac^{sha256} > For a Git user interface this is relatively straightforward and concise No, it isn't. It's a complete and utter user interface clusterfuck. Just say no to this insanity.
- microtherion 7y agoNote the qualifier "for a Git user interface". The average git command is along the lines of "git ph-nglui --mglw=nafh Cthulhu...R'lyeh -- wgah^nagl fhtagn"
- kazinator 7y agoThat cute rhetoric will not fool anyone. Common git workflows use fairly succinct git commands: git diff git commit -p git rebase -i HEAD~3 The command quoted in my original comment is just this we strip away the SHA256 garbage: git log abac87a..f787cac (Or maybe it is: git log abac87a^..f787cac^ I cannot guess whether the ^ operator still has the same meaning or whether it is part of this ^{sha...} notation.) The hashes will typically be copy and pasted, so you type just the git log, .. and spaces. The fixed parts of convoluted git syntax can be hidden behind shell functions and aliases. But notations for referencing objects are not fixed; they will end up as arguments.
- jolmg 7y ago> I cannot guess whether the ^ operator still has the same meaning or whether it is part of this ^{sha...} notation.) This isn't the first ^{...} notation. The manpage gitrevisions(7) also mentions <rev>^{/<text>} for referencing a commit based on a regular expression of its commit message, like git checkout 'add-search^{/finished query builder}' Though, this new notation is probably more in-line with the notation <rev>^{<type>}, which lets you disambiguate what you put in <rev> as in deadbeef^{tag}, so that it's not confused with deadbeef^{commit}. EDIT: The article doesn't mention it, but I imagine one interpretation would take precedence and cause git to issue a warning when it's ambiguous. Right now, if I tag a commit with the hash of another commit, its interpretation as a tag takes precedence and I get a warning at the top, "warning: refname '368bc6e' is ambiguous." That would mean you'd only ever write ^{sha256} when the provided part of a sha256 hash is ambiguous with an existing sha1 hash or something else like a tag. That's also vice versa with ^{sha1}.
- kazinator 7y agoI'm completely against this security theater nonsense; please keep my git SHA-1. Please fork git for this and call it something else, like git6, and ensure that git6 cannot push to git repos.
- speedgoose 7y ago>…a simple command like: > git convert-repo --to-hash=sha-256 --frobnicate-blobs --climb-subtrees --liability-waiver=none --use-shovels --carbon-offsets Is it sarcasm ?
- andrewflnr 7y agoYes.
- sunil_saini 7y agoThe above article suggests that Sha-1 collision is infeasible because attacker has to come up with code that not only generate same hash but also benefit him. But can't he just add some malicious code and add some random text in comments to produce same hash?
- pornel 7y ago"produce same (specific) hash" is a pre-image attack, which is very very hard. So hard, that even MD5 isn't broken for pre-image, and there's only a theoretical pre-image attack against MD4. We know only collision attacks which is "produce 2 files with the same hash, but you can't control what hash". So you can't target any existing repo. You need to use social engineering to get one of your special files into a repo.
- zokier 7y agoDoes anyone know if a standard format for sort of tagged-union hash type, something similar as crypt format for passwords? Feels like everyone is needing to support multiple hash types at some point, and basically needs to reinvent that particular wheel again and again.
- loeg 7y agoIt isn't too bad to just exhaustively look up provided hashes in all your databases (at least, for Git). You should probably only support 1 primary hash at a time, and 1 additional legacy hash for migration purposes. This makes lookup twice as expensive; for git, this is not usually the slow part (the slow part is 'git status' having to compare the entire local filesystem checkout to the repo).
- themaxdavitt 7y agoMultihash? https://multiformats.io/multihash/ https://multiformats.io/multihash/
- nsajko 7y agoDisappointed they went with an ARX based hash, instead of KangarooTwelve, which uses the Keccak permutation. A lot of people on this thread think that SHA2 is more secure because it is older, but it is my understanding that that is completely wrong. Keccak is not only standardized, to get to that it had to win the SHA3 competition, during and after which it received, as far as I understand, unprecedented levels of scrutiny. And not only that, but, according to what I read, the Keccak-like cryptographic constructions (including the hash) are much more amenable to mathematical/cryptographical analysis because of not using addition (word-wise, instead of bit-wise, to be more correct). The idea is that a resourceful/moneyed attacker (like the NSA or China, etc.) could create successful attacks on an ARX hash without the public being able to come to the same developments because of no researchers having access to similar levels of resources. The sad thing is that the ARX BLAKEx functions seem to be gaining undeserved amounts of hype. I do not think they are getting comparable scrutiny from researchers, seeing as BLAKEx hashes are ARX, and also changed considerably since the SHA3 contest (so it is far from clear that the scrutiny that BLAKE did receive translates to BLAKE2 or BLAKE3).
- nsajko 7y agoOne thing that should also be noted is that ARX hashes are relatively less well suited to silicon implementations. The Keccak team published a short and poignant relevant blog post back in 2017 as an answer to that notorious "Maybe skip SHA3" blog post: https://keccak.team/2017/not_arx.html https://keccak.team/2017/not_arx.html A HN commenter from 2017 explained ARX's safety downside better than I: https://news.ycombinator.com/item?id=15292103 https://news.ycombinator.com/item?id=15292103 > The nuance that's being made here is that the public cryptanalytic results we have are from researchers that need to publish. However blackhats (be it government or private) have no such need. Thus, they do not care if the analysis is elegant or neat. > This means that ARX functions will have less published analysis, but may still be successfully attacked. > This isn't even a new argument they're making here. It's been well understood that simple cipher designs are better, because they are easier to understand. If you can understand it well, yet not break it, that gives confidence. If you don't understand it, it might break as soon as you do.
- cestith 7y agoI just want to add something the article couldn't cover. I know bmc and he's both a software geek's software geek and one of the friendliest, most helpful, and most genuine people I've ever met.
- lokedhs 7y agoHow will rehashing work for commits that are signed? Do all the commits need to be re-signed?