SHA-256或MD5用于文件完整性 [英] SHA-256 or MD5 for file integrity

查看:524
本文介绍了SHA-256或MD5用于文件完整性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道SHA-256在安全性等方面比MD5更受青睐,但是,如果我要使用一种方法来检查文件完整性(即与密码加密无关),那么是否使用SHA-256的好处是什么?



由于MD5是128位而SHA-256是256位(因此是两倍大)...


  1. 加密需要两倍的时间吗?

  2. 如果时间不是本质的,比如在备份程序中,并且文件完整性是需要的,那么任何人都会反对MD5针对不同的算法,甚至提出不同的技术?
  3. 使用MD5产生校验和吗?

  4. > SHA256和MDA5都是哈希算法。他们把你的输入数据,在这种情况下,你的文件,并输出一个256/128位数字。这个数字是一个校验和。没有加密发生,因为无限数量的输入可以产生相同的哈希值,但实际上碰撞很少。

    SHA256需要更多的时间来计算MD5,根据这个答案



    非手,我会说MD5可能适合您的需求。


    I know that SHA-256 is favored over MD5 for security, etc., but, if I am to use a method to only check file integrity (that is, nothing to do with password encryption, etc.), is there any advantage of using SHA-256?

    Since MD5 is 128-bit and SHA-256 is 256-bit (therefore twice as big)...

    1. Would it take up to twice as long to encrypt?

    2. Where time is not of essence, like in a backup program, and file integrity is all that is needed, would anyone argue against MD5 for a different algorithm, or even suggest a different technique?

    3. Does using MD5 produce a checksum?

    解决方案

    Both SHA256 and MDA5 are hashing algorithms. They take your input data, in this case your file, and output a 256/128-bit number. This number is a checksum. There is no encryption taking place because an infinite number of inputs can result in the same hash value, although in reality collisions are rare.

    SHA256 takes somewhat more time to calculate than MD5, according to this answer.

    Offhand, I'd say that MD5 would be probably be suitable for what you need.

    这篇关于SHA-256或MD5用于文件完整性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆