Md5加密是对称还是非对称?
对于我的 iPhone 应用程序,Apple 想知道我的密码加密 (md5) 是否大于 64 位对称或大于 1024 位对称。我在网上没找到,所以想问问有没有人知道答案。此外,这是否被认为是一种合适的密码加密技术,或者我应该使用不同的技术?
感谢您的帮助!
For my iPhone application, Apple wants to know if my password encryption (md5) is greater then 64-bit symmetric or greater then 1024-bit symmetric. I have not been able to find it online, so I am wondering if anyone knows the answer. In addition, is this considered an appropriate encryption technology for passwords, or should I use something different?
Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
MD5 是一种散列函数,因此根据定义它是不可逆的。加密(无论是对称还是非对称)的情况并非如此,加密必须可逆才能有用。
更准确地说,哈希是单向函数,因为无限数量的输入可以映射到单个输出,因此不可能确定地获得导致给定输出的精确输入。
然而,有可能找到散列到相同输出的不同输入。这称为碰撞。
一般来说,对密码进行哈希处理而不是存储纯文本(甚至加密的)是一个好主意。 (如果使用盐就更好了)但是,MD5 有已知的弱点(以及有助于查找冲突的大量彩虹表),因此切换到 SHA-1 或 SHA-2 之一是个好主意哈希值家族。
然而,要回答你原来的问题,确实没有办法将 MD5 或任何散列与任何类型的加密进行比较;它们没有对应的东西,因为这就像比较苹果和橘子一样。
MD5 is a hashing function, thus by definition it is not reversible. This is not the case for encryption (either symmetric or asymmetric), which has to be reversible to be useful.
To be more precise, hashes are one-way functions, in that an infinite number of inputs can map to a single output, thus it is impossible to obtain the exact input, with certainty, that resulted in a given output.
However, it may be possible to find a different input that hashes to the same output. This is called a collision.
Generally, hashing passwords instead of storing the plain text (even encrypted) is a good idea. (Even better if using a salt) However, MD5 has known weaknesses (and large collections of rainbow tables that aid in finding collisions), thus it would be a good idea to switch to something like SHA-1 or one of the SHA-2 family of hashes.
However, to answer your original question, there is really is no way to compare MD5 or any hash against any type of encryption; they have no equivalents because it's like comparing apples and oranges.
md5 并不是真正的对称或非对称加密,因为它无论对称还是非对称都是不可逆的。这是一种消息摘要(安全哈希)算法。
md5 isn't really symmetric or asymmetric encryption because it isn't reversible either symmetrically or asymmetrically. It's a Message Digest (secure hash) algorithm.
这不是加密,而是摘要。如果你没有加盐,那就不是特别安全,但他们问了你错误的问题。
你到底用 MD5 和密码做什么?这里有一些标准的做事方法,并且使用一种方法总是更好,但是如果不知道您想要做什么,就很难为您指出相关的标准。
It's not encryption, it's a digest. If you didn't salt it, it's not particularly secure, but they're asking you the wrong question.
What exactly are you doing with MD5 and passwords? There are standard ways of doing things here, and it's always better to use one, but without knowing what you want to do it's hard to point you at a relevant standard.
它根本不是加密。
It is NOT encryption at all.
Apple 询问有关使用 MD5 哈希密码的问题,以了解是否需要商务部/工业安全局的出口授权。
为此目的的答案是,根据 15 CFR 第 774 部分的技术说明,补充 1,ECCN 5A002,a.1 段,使用 MD5 进行密码保护并不作为强加密(如超过 64 位的对称算法)进行控制。 ,它描述了使用加密来保护密码。然而,它仍可能受 ECCN 5A992 的控制。
http://www.bis.doc.gov/encryption/ccl5pt2.pdf
其他答案对于为什么提出这个问题没有帮助。
此外,您还可以致电商务部/工业安全局:202-482-0707,询问您的具体申请。
Apple asks the question about the use of MD5 for hashing passwords to see if it requires authorization for export from the Department of Commerce/Bureau of Industry and Security.
The answer for that purpose is that using MD5 for password protection is not controlled as strong encryption (like symmetric algorithms in excess of 64 bits) in accord with the Technical Note to 15 CFR part 774, Supplement 1, ECCN 5A002, paragraph a.1, which describes using encryption for password protection. However, it may still be controlled under ECCN 5A992.
http://www.bis.doc.gov/encryption/ccl5pt2.pdf
The other answers are not helpful in the context of why the question was asked.
Also, you may want to call the Department of Commerce/Bureau of Industry and Security at 202-482-0707 and ask about your specific application.
哈希函数大多数时候是一种压缩数据的方法。它们是单向哈希函数,这意味着很难逆转(哈希函数=消息摘要,很难找到转换为特定哈希值的原始消息)。另一方面,它们非常容易实现,因为不需要任何类型的密钥。
它不是对称或非对称算法。此类算法用于加密而不是散列数据。出于保密原因使用加密,以防止攻击者尝试读取某人的数据。
加密或密码算法需要密钥来执行其任务,而散列则不需要任何类型的密钥。使用哈希不是出于保密原因,而是出于完整性原因,即使它们没有足够的强度。 MD5 是哈希函数的一种类型,由于 MD5 不够强大,因此存在许多其他类型的哈希函数
Hash function most of times is a way to compress your data. They are one-way hash functions, meaning that are difficult to reversed(having the hash function=digest of a message it is difficult to find the original message that is converted to the specific hash value). On the other hand, are very easy to implemented because there is no need of any type of key.
It is not a symmetric or asymmetric algorithm. These kind of algorithms are used to encrypt and not to hash data. Encryption is used for confidentiality reasons, to protect data from attackers where they try to read someone's.
Encryption or cipher algorithms need keys to perform their tasks in contrast to hashes where they do not need any kind of key. Hashes are not used for confidentiality reasons but for integrity reasons even if they do not have enough strength. MD5 is one type of a hash function where exists many others because MD5 is not strong enough
我认为MD5用于更好的安全性......如果我们讲述任何加密或解密算法,它们只是将任何纯文本转换为密文......但另一方面MD5提供了纯文本的唯一性将由任何来源(Alice)发送...因此我们可以说,为了更好的安全性或在纯文本上提供信封,应在使用任何加密算法(对称或非对称)之前使用 MD5。
I think MD5 is used for better security.... if we tell about any encryption or decryption algorithm, they are just for converting any plain text into cipher text... but on the other hand MD5 provides an uniqueness on that plain text that would be sent by any source(Alice)...so we can say that for better security or for providing envelop on plain text MD5 should be used before using any encryption algothim(symmetric or asymmetric).
正如这里的许多其他人提到的,MD5 不是对称或非对称算法。
相反,它属于密码学的不同分支。它是 .Net 框架中可用的最小哈希算法之一。其密钥大小仅为 16 字节,应该是 128 位。一些你用来学习面包和黄油的东西。
所以是的,它大于 64 位,大小仅为 8 个字节。
常见 symm' enc' algs 使用的最大密钥大小是 256 位(Rijndael 托管)。
如果您想查看大于该值的密钥大小,则可以使用支持可变密钥大小的 RC2 symm' enc' algs。你可以尝试一些东西吗?
如果您想要高于 1024 位,那么您需要查看 Asymm' Enc' Algs,例如 RSACryptoServiceProvider 类,我认为该类支持高达 16K 位的密钥大小?
如果你想使用密码,那么你需要使用 Keyed Hashing Algs,就像任何 HMAC 的东西一样,它们应该是 Keyed Hashing Algorithms 或 MacTripleDes。这些都使用密钥来加密从您提供的数据生成的哈希值。密钥是通过 RFC2898DerivesBytes 类使用密码和盐值创建的。 <-- 不要忘记,RC2、Rijndael、AES、DES 等都可以设置为使用密码来帮助导出密钥。如果您认为本段的开头句有点误导。所以我添加这个只是为了确保散列不是您完全需要的。
*请记住,.net 的加密命名空间中有独特的继承层次结构。
因此,MD5 是所有 MD5 派生类都派生自的抽象基类。 .Net 提供了一种此类派生类,称为 MD5CryptoServiceProvider 类。它本质上是一个托管包装类,用于调用 Windows 非托管加密库 API。 MD5 在 MS 官方教科书中被称为非键控哈希算法。 *
有很多选项可供您选择。
: ) 享受 !
As the numerous other guys on here have mentioned, MD5 is not a symmetric or an asymmetric algorithm.
Instead it comes under a different branch in cryptography all together. It's one of the smallest hashing algorithms available in the .Net framework. At a mere 16bytes for its keysizes, which should be 128 bit. Something that you learn your bread and butter with.
So yes it is greater than 64bit which is only 8bytes in size.
The maximum key size the common symm' enc' algs use is 256bit (Rijndael Managed).
If you want to be looking at keysizes greater than that, then you can use the RC2 symm' enc' algs which supports variable key sizes. Something that you can experiment with?
If you want higher than 1024bit, then you need to be looking at Asymm' Enc' Algs like the RSACryptoServiceProvider class which supports key sizes going upto 16K in Bits I think?
If you want to use passwords, then you need to use Keyed Hashing Algs, like anything HMAC' something, they should be Keyed Hashing Algorithms or MacTripleDes. These all use secret keyes to encrypt the hash that is generated from the data you supply. The keys are created by using passwords and salt values via the RFC2898DerivesBytes class. <-- Don't forget that RC2, Rijndael, AES, DES and etc all can be set-up to use passwords to help derive the secret keys. In case you are thinking that the opening sentence of this paragraph is a little misleading. So i added this just to be sure in the event that hashing is not what you need altogether.
*REMEMBER THAT THERE ARE UNIQUE INHERITANCE HIERARCHIES IN .net's Cryptography NameSpace.
So MD5 is the base Abstract class all MD5 Derived classes are to derive from. .Net provides one such derived class that is called MD5CryptoServiceProvider class. Which is essentially a managed wrapper class that makes call to windows unmanaged Crypto-Libraries API. MD5 is known in MS official textbooks under the umbrella term as a Non-Keyed Hashing Algorithm. *
There are plenty of options available to you.
: ) Enjoy !