如何将短语和单词转换为MD5哈希? [英] How to transform phrases and words into MD5 hash?
问题描述
任何人都可以向我解释如何将我想买一些牛奶这样的短语转换成MD5吗?我读了关于MD5的维基百科文章,但是给出的解释超出了我的理解范围:
$ b
MD5处理可变长度
消息转换为
128位的固定长度输出,输入消息被破坏
分成512位块
(16个32位小端b $ b整数)块
16个32位小端序列对我来说已经很难了。我检查了维基文章中的小端,并且没有明白。
然而,Wiki文章中的一些短语和MD5散列的例子非常好:
MD5(快速棕色狐狸跳过
懒狗)=
9e107d9d372bb6826bd81d3542a419d6
MD5(快速棕色狐狸跳过
懒狗。)=
e4d909c290d0fb1ca068ffaddf22cbd0
请问任何人,请向我解释一下这个MD5算法是如何工作的?
另外,也许你知道一些软件或代码可以将短语转换成他们的MD5。如果是,请告诉我。
忘记endians:这只是一种方式来编码信息的方式。
让我们按照wikipedia MD5 文章。你从一个输入消息开始。它可以是任意长的:对于2GB ISO文件,MD5散列是常规创建的,就像十几个字符长的字符串的散列(例如对于密码)一样。
包含在寄存器 a
中, b
, c
和 d
。这些寄存器被初始化为特殊值( h0-h3
)。
字节块(16个32位小端字),并应用特定的逻辑操作(函数 F
, G
, H
和 I
)的部分输入和寄存器的当前状态 a
, b
, c
和 d
。它为每个16个4字节的块组执行64次。
当所有的块都被处理时,,
b
, c
和 d
是最后一个散列,可以通过调用 md5sum testfile.txt
。
更新:
如果你只是想计算一个哈希,你自己实现它是没有意义的,因为它已经完成并测试了可能每种重要语言:
Python :
import md5
md5.new(没有人检查垃圾邮件重复)digest()
SQL( Java : 等。 Can anyone, please, explain to me how to transform a phrase like "I want to buy some milk" into MD5? I read Wikipedia article on MD5, but the explanation given there is beyond my comprehension: "MD5 processes a variable-length
message into a fixed-length output of
128 bits. The input message is broken
up into chunks of 512-bit blocks
(sixteen 32-bit little endian
integers)" "sixteen 32-bit little endian integers" is already hard for me. I checked the Wiki article on little endians and didn't understand a bit. However, the examples of some phrases and their MD5 hashes in that Wiki article are very nice: MD5("The quick brown fox jumps over
the lazy dog") =
9e107d9d372bb6826bd81d3542a419d6 MD5("The quick brown fox jumps over
the lazy dog.") =
e4d909c290d0fb1ca068ffaddf22cbd0 Can anyone, please, explain to me how this MD5 algorithm works using some very simple example? And also, perhaps you know some software or a code that would transform phrases into their MD5. If yes, please, let me know. Forget about the endians: it's just a way name for a way to encode information. Let's follow the wikipedia MD5 article. You start with an input message. It can be arbitrarily long: MD5 hashes for 2GB ISO files are routinely created, just like hashes for strings a dozen characters long (e.g. for passwords). The hash will be contained in registers The algorithm breaks the input into 16 4-byte chunks ("sixteen 32-bit little-endian words") and applies specific logical operations (functions When all of the chunks are processed, what remains in Update: If you just want to be able to calculate a hash, implementing it yourself makes no sense because it's been done and tested for probably every significant language out there: SQL (MySQL): Java: etc. 这篇关于如何将短语和单词转换为MD5哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
SELECT MD5('没有人检查垃圾邮件重复')
String s =没有人检查垃圾邮件的重复;
MessageDigest m = MessageDigest.getInstance(MD5);
m.update(s.getBytes(),0,s.length());
System.out.println(new BigInteger(1,m.digest())。toString(16));
a
, b
, c
and d
. These registers are initialized with special values (h0-h3
).F
, G
, H
and I
) on parts of the input and the current state of registers a
, b
, c
and d
. It does this 64 times for each set of 16 4-byte chunks.a
, b
, c
and d
is the final hash, the one you might get by invoking md5sum testfile.txt
.import md5
md5.new("Nobody inspects the spammish repetition").digest()
SELECT MD5('Nobody inspects the spammish repetition')
String s="Nobody inspects the spammish repetition";
MessageDigest m=MessageDigest.getInstance("MD5");
m.update(s.getBytes(),0,s.length());
System.out.println(new BigInteger(1,m.digest()).toString(16));