4 ms·
Instead of just migrating everything to a new hashing function when something gets bad, why not migrate to something that would be future-proof and easy to swit
by diggan 10y ago
Instead of just migrating everything to a new hashing function when something gets bad, why not migrate to something that would be future-proof and easy to switch out? Multihash[0] is one solution, where a hash contains information about what hash-function was used when generating the hash, so you can have the same input, multiple hashes.
- [0] https://github.com/multiformats/multihash https://github.com/multiformats/multihash
- SadWebDeveloper 10y agoDidn't know about this spec/format (i know they called a protocol, m not so sure it can be accurately called that way) seems cool until you have to realize that you must support all hashes or at least a handful of that in your app which is convenient from the developer POV but wasteful from the database-administrator because you must either future-proof that column size or drop performance altogether and start using "document-db" for authentication which is kinda odd. IMHO you should not "future-proof" password hashes, collision attacks for passwords are more difficult to achieve than many people realize. What you should as a developer do, is stop using the hash and only migrate systems that actually required in a case by case basis.
- dom0 10y agoThis makes the output length rather odd (not even divisible by 4 bytes), although that wouldn't matter much in non-performance critical applications. Also to keep in mind; when using hashes as a key for something (file name, hash table), here you'll need to take bits from the end, not the beginning, when splitting it up (eg. for using multiple directory levels).
- niftich 10y agoMultihash is nice, but it solves exactly two out of many problems with migrating to a new hash. First, it carries the information of which hash function was used to produce the digest "in-band", so that this information does not need to be obtained out-of-band, or from a different input, or inferred from context. Second, because it carries this information inside one data item, it essentially domain-segregates the information space of the digest by hash function, which ensures that two digests generated by two different hash functions never collide into the same value. While this property seems very useful, in truth this can only happen if the two different hash functions in question generate digests of the same length, and because the hash functions are different, you can't mount a collision attack, so you must work backwards from one of the outputs to try to break the other [1]. This then shows that the hard part about "migrating hashes" isn't usually the data structures, but rather the policies and practices on how you affect access or treatment of data items identified by or checksummed by the now-insecure hash; whether you have enough data and knowledge contained within the closed system that seamless migration is possible internally; how you communicate changes in content-addressing to users such that they can evaluate the trust and risks (similar to "seamlessly" upgrading HTTP to HTTPS), etc. [1] I'm not a crypto expert so I'll avoid commenting in precise, technical terms [2] of which exact attack this would entail. [2] http://web.cs.ucdavis.edu/~rogaway/papers/relates.pdf http://web.cs.ucdavis.edu/~rogaway/papers/relates.pdf