简体   繁体   English

将SecureRandom与SHA-256一起使用

[英]Using SecureRandom with SHA-256

I have been using SecureRandom with a seeded SHA1PRNG algorithm to create shared randomness between two processes. 我一直在使用带有种子SHA1PRNG算法的SecureRandom来创建两个进程之间的共享随机性。 I recently learned that SHA1 is being deprecated according to NIST's standards, so we are making an effort to switch to SHA256. 我最近了解到SHA1根据NIST的标准被弃用,所以我们正在努力切换到SHA256。 The problem I've discovered is that SecureRandom ONLY supports SHA1PRNG, at least according to Oracle's documentation . 我发现的问题是SecureRandom仅支持SHA1PRNG,至少根据Oracle的文档 I was wondering if there's a way to use SecureRandom with SHA256, or probably better, what is a suitable alternative to using SecureRandom? 我想知道是否有办法将SecureRandom与SHA256一起使用,或者可能更好,什么是使用SecureRandom的合适替代方案?

David, as I understand you are referring to this document: http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf 大卫,据我所知你指的是这个文件: http//csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf

May be, I am missing something. 可能是,我错过了什么。 However, what it says: 然而,它说:

From January 1, 2011 through December 31, 2013, the use of SHA-1 is deprecated 
for digital signature generation. The user must accept risk when SHA-1 is used, 
particularly when approaching the December 31, 2013 upper limit.

However, below it says 但是,它下面说

For all other hash function applications, the use of SHA-1 is acceptable. The 
other applications include HMAC, Key Derivation Functions (KDFs), Random Number 
Generation (RNGs and RBGs), and hash-only applications (e.g., hashing passwords 
and using SHA-1 to compute a checksum, such as the approved integrity technique 
specified in Section 4.6.1 of [FIPS 140-2]). 

So, as I understand SHA1 is ok for random number generation. 所以,据我所知,SHA1可以生成随机数。

I agree to Victor's statement overall. 我同意维克多的声明。 But as a further clarification, section 4 of NIST SP800-131a has a table that separates RNGs NOT using RBGs as mentioned in NIST SP800-90 or ANSI X9.62-2005 will time out in 2015. 但作为进一步的澄清,NIST SP800-131a的第4部分有一个表格,用于分隔不使用RBG的RNG,如NIST SP800-90或ANSI X9.62-2005中提到的将在2015年超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM