MessageDigest.getInstance(“SHA") 返回什么特定的哈希算法?

What specific hash algorithm does MessageDigest.getInstance(quot;SHAquot;) return?(MessageDigest.getInstance(“SHA) 返回什么特定的哈希算法?)
本文介绍了MessageDigest.getInstance(“SHA") 返回什么特定的哈希算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

MessageDigest.getInstance("SHA") 似乎工作并给了我一个 MessageDigest,但我不知道它给了我什么算法.

MessageDigest.getInstance("SHA") seems to work and gives me a MessageDigest, but I can't tell what algorithm it's giving me.

是 SHA-1 还是 SHA-0 还是 ..?

Is it SHA-1 or SHA-0 or ..?

我对我的机器上发生的事情不感兴趣.我想知道它是否会为所有有效的 Java 实现返回 sha0 或 sha1(或者它是未定义的).

I'm not interested in what happens on my machine. I want to know whether it will return sha0 or sha1 for all valid implementations of Java (or it's undefined).

推荐答案

JCE 规范 列出了实现应该支持的标准名称.指定了SHA-1",以及 SHA-256、SHA-384 和 SHA-512.SHA"、SHA-0"和SHA-2"不是标准名称,因此可能根本不受支持.您不能保证SHA"会返回什么,如果有的话,因为它不在标准中.

The JCE Specification lists standard names that an implementation is expected to support. "SHA-1" is specified, as are SHA-256, SHA-384, and SHA-512. "SHA", "SHA-0" and SHA-2" are not standard names and therefore may not be supported at all. You cannot guarantee what "SHA" will return, if anything at all, because it is not in the standard.

这篇关于MessageDigest.getInstance(“SHA") 返回什么特定的哈希算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Reliable implementation of PBKDF2-HMAC-SHA256 for JAVA(PBKDF2-HMAC-SHA256 for JAVA 的可靠实现)
Correct way to sign and verify signature using bouncycastle(使用 bouncycastle 签名和验证签名的正确方法)
Creating RSA Public Key From String(从字符串创建 RSA 公钥)
Why java.security.NoSuchProviderException No such provider: BC?(为什么 java.security.NoSuchProviderException 没有这样的提供者:BC?)
Generating X509 Certificate using Bouncy Castle Java(使用 Bouncy Castle Java 生成 X509 证书)
How can I get a PublicKey object from EC public key bytes?(如何从 EC 公钥字节中获取 PublicKey 对象?)