Use a combination of SHA1 + MD5

I am trying to use a safe way to create a checksum for files (over 10 GB!).

SHA256 is safe enough for me, but this algorithm is so expensive and not suitable. Well, I know that SHA1 and MD5 checksums are unsafe due to collisions.

So, I believe that the fastest and safest way is combining MD5 with SHA1, for example: SHA1 + MD5, and I don’t think there is a way to get a file (Collision) with the same MD5 and SHA1 at the same time.

So, is SHA1 + MD5 safe enough for a checksum file? or is there any attack, such as a collision?

I use C # mono in two ways (Bufferstream and without Bufferedstream)

    public static string GetChecksum(string file)
    {
        using (FileStream stream = File.OpenRead(file))
        {
            var sha = new SHA256Managed();
            byte[] checksum = sha.ComputeHash(stream);
            return BitConverter.ToString(checksum).Replace("-", String.Empty);
        }
    }

    public static string GetChecksumBuffered(Stream stream)
    {
        using (var bufferedStream = new BufferedStream(stream, 1024 * 32))
        {
            var sha = new SHA256Managed();
            byte[] checksum = sha.ComputeHash(bufferedStream);
            return BitConverter.ToString(checksum).Replace("-", String.Empty);
        }
    }

1:   SHA1 + MD5. SHA1 , MD5 , .

2:

@zaph, (# MONO) , , ! 4,6 () 12 8. ~ , sha1 + md5 100 . - SHA256 .

+4
2

SHA-256 MD5 + SHA1 .

- :

:
SHA-256: 200 MB/s
MD5: 470 MB/s
SHA1: 500 MB/s (updated, previously incorrect)
MD5+SHA1 240 MB/s

, . 1 10 . "C", Apple Common Crypto. Intel Xeon 2.8 (2010 MacPro, ).

23% MD5 + SHA1.

. Intel , . .

, sha256sum.

+1

SHA1 + MD5 SHA-1 , MD5, , , .

SHA-1 MD5 - , Pigeonhole , , . :

  • SHA-1
  • 160- SHA-1 MD5

, . . - , SHA-1 .

:

?

MD5 , ?

+1

Source: https://habr.com/ru/post/1648376/


All Articles