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") 返回什么特定的哈希算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:MessageDigest.getInstance(“SHA") 返回什么特定的哈

基础教程推荐