如何设置MessageDigest种子? [英] How to set MessageDigest seed?

查看:243
本文介绍了如何设置MessageDigest种子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MessageDigest类实现SHA-1算法(以及许多其他算法)。 SHA-1算法允许使用不同的种子或初始摘要。请参阅 SHA-1 Psuedocode

The MessageDigest class implements the SHA-1 algorithm (among many others). The SHA-1 algorithm allows one to use different "seeds" or initial digests. See SHA-1 Psuedocode

算法初始化变量或种子:

The algorithm initializes variables, or the seed:

Initialize variables:
h0 = 0x67452301
h1 = 0xEFCDAB89
h2 = 0x98BADCFE
h3 = 0x10325476
h4 = 0xC3D2E1F0

然而,MessageDigest类,如在线Java手册,没有提供用于设置这些初始变量的API。实际上,它没有说明初始变量的值。

However the MessageDigest class, as described in the Online Java Manual, provides no API for setting these initial variables. In fact, it doesn't state the value of the initial variables.

如何设置SHA-1算法的初始种子?

Java中SHA-1的示例在哪里,使用初始种子

(我正在寻找SHA-1实现,除非该示例使用<$ c带有替代初始种子的$ c> MessageDigest 。)

Where is an example of SHA-1 in Java, USING AN INITIAL SEED?
(I'm looking for the SHA-1 implementation, unless the example uses MessageDigest with an alternative initial seed.)

推荐答案

无法提供Java函数最初的种子。

The Java function cannot be supplied with an initial seed.

我复制了SHA-1算法的C实现并修改它以允许更改初始种子值。

I copied a C implementation of SHA-1 algorithm and modified it to allow changing of the initial seed values.

这篇关于如何设置MessageDigest种子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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