SHA256 Hashing with two blocks:第一个块的哈希应该输入哪里?
SHA256 Hashing with two blocks: Where should the hash of the first block be inputed?
我刚刚实现了 SHA256 生成器,但遇到了多块问题。请问有谁能帮忙解答下这个问题吗?
为了便于检查,我们使用这个特定的文本输入:“致地球上的每一只野兽,每一只鸟”
因为这正好是448位,所以必须根据填充规则将其分成2块(长度字段只是少了一位)。
我一步一步的输出如下:
二进制的原始消息是:0,1,0,0,0,0,0,1,0,1,1,0,1,1,1,0,0,1,1,0 ,0,1,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,0,1 ,1,1,1,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,1,0,1,1,1,0,1 ,1,0,0,1,1,0,0,1,0,1,0,1,1,1,0,0,1,0,0,1,1,1,1,0,0 ,1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,1,1,0,0,1,0,1 ,0,1,1,0,0,0,0,1,0,1,1,1,0,0,1,1,0,1,1,1,0,1,0,0,0 ,0,1,0,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1,0,0,1,1,0,0,0 ,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,0,1,0,0,0,0,1,1 ,0,0,1,0,1,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,1,0,1,1,0 ,0,0,0,1,0,1,1,1,0,0,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1 ,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0 ,0,1,0,1,1,0,1,1,1,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0 ,0,0,1,1,1,0,1,0,0,0,1,1,0,1,1,1,1,0,0,1,0,0,0,0,0 ,0,1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1,0 ,1,1,1,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,1 ,1,0,0,1,1,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1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1,0,1 ,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1 ,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,0 ,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0
区块长度:512
区块1的SHA256哈希值为:2,1,8,2,5,A,3,D,F,3,1,C,E,E,3,9,3,6,A ,D,A,F,C,3,6,0,F,8,0,F,9,8,8,0,C,5,8,D,2,F,F,E,C,3 ,4,4,A,8,2,9,D,F,6,8,2,F,2,5,D,F,6,D,C,D
谁能帮我解释一下这两个问题:
Block 1 的哈希值是否正确?
如果Block 1 hash全部正确无误,那么在Block 2 hashing即将开始的时候,这个hash number 21825A3D...应该输入哪里呢?
非常感谢您的帮助!
- Is the hash number for the Block 1 correct?
是的。恭喜。虽然这不是一个数字;它只是一个散列 value,因为二进制不代表单个数值。
- If Block 1 hash is all correct and good, where should this hash number
21825A3D...
be inputed when Block 2 hashing is about to start?
有这些初始散列值,有时也称为常量。它们被命名为 h0..h7 in the pseudo-code of Wikipedia。您找到的中间散列应该替换它们。 h0..h7 也是最终哈希的输出(不幸的是,因为没有对哈希的最终操作允许长度扩展攻击)。
我刚刚实现了 SHA256 生成器,但遇到了多块问题。请问有谁能帮忙解答下这个问题吗?
为了便于检查,我们使用这个特定的文本输入:“致地球上的每一只野兽,每一只鸟”
因为这正好是448位,所以必须根据填充规则将其分成2块(长度字段只是少了一位)。
我一步一步的输出如下:
二进制的原始消息是:0,1,0,0,0,0,0,1,0,1,1,0,1,1,1,0,0,1,1,0 ,0,1,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,0,1 ,1,1,1,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,1,0,1,1,1,0,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,E,C,3 ,4,4,A,8,2,9,D,F,6,8,2,F,2,5,D,F,6,D,C,D
谁能帮我解释一下这两个问题:
Block 1 的哈希值是否正确?
如果Block 1 hash全部正确无误,那么在Block 2 hashing即将开始的时候,这个hash number 21825A3D...应该输入哪里呢?
非常感谢您的帮助!
- Is the hash number for the Block 1 correct?
是的。恭喜。虽然这不是一个数字;它只是一个散列 value,因为二进制不代表单个数值。
- If Block 1 hash is all correct and good, where should this hash number
21825A3D...
be inputed when Block 2 hashing is about to start?
有这些初始散列值,有时也称为常量。它们被命名为 h0..h7 in the pseudo-code of Wikipedia。您找到的中间散列应该替换它们。 h0..h7 也是最终哈希的输出(不幸的是,因为没有对哈希的最终操作允许长度扩展攻击)。