Discourage use of broken hashes like SHA1
- Dominant language
- Go
- Stars
- 17.1k
- Forks
- 3.2k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 11
Description
## Problem
> Suggestion extracted from https://github.com/ipfs/go-ipfs/issues/8650
[SHA1 is considered to be broken](https://en.wikipedia.org/wiki/SHA-1#Attacks), and systems like git moved away from it.
IPFS makes migration wa easy thanks to abstraction provided by Multihash. go-ipfs switched the defaults in `ipfs add` to SHA2-256, but in theory, one can still use SHA1 to add new files if they opt-in.
We should have a mechanism to discourage users from using broken legacy functions like sha1 for adding new files.
## Solution
There should be a list of "legacy/deprecated" hash functions like SHA1 which would be discouraged by requiring explicit `--force` flag:
```console
$ ipfs add --hash=sha1 file
Error: selected hash function is no longer secure; use --hash=sha2-256 or pass --force
$ ipfs add --hash=sha1 file
Added ...
```
Note: this could be a part of a bigger refactor related to https://github.com/ipfs/go-ipfs/issues/4371
Contributor guide
Assessment
This issue has not been assessed yet.