久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

JDK 中可用的 MessageDigest 完整列表

Complete list of MessageDigest available in the JDK(JDK 中可用的 MessageDigest 完整列表)
本文介紹了JDK 中可用的 MessageDigest 完整列表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我已經(jīng)為此搜索了高低,但我似乎無法得到一個直接的答案.

I've searched high and low for this, but I can't seem to get a straight answer.

在 Java 中,可用的 MessageDigest 取決于您配置/安裝的安全提供程序.但是假設(shè)只是一個普通的 JDK8 安裝(在我的例子中是 1.8.0_11),可用的哈希算法列表是什么?從文檔中的示例中,很明顯 MD5、SHA1 和 SHA-256 可用,但我似乎無法獲得完整的權(quán)威列表.

In Java, the available MessageDigests are determined by which security providers you have configured/installed. But assuming just a normal JDK8 install (1.8.0_11 in my case), what's the list of hash algorithms that are available? From examples in the docs, it's obvious MD5, SHA1 and SHA-256 are available, but I can't seem to get a complete, authoritative list.

此列表是否存在,或者我該如何查找我的特定安裝?

Does this list exist, or how do I go about finding out for my particular install?

推薦答案

除了 JB 的回答,我想提出一個解決方案,查詢運行時可用的算法.這種方法當然很容易轉(zhuǎn)換為 CipherSecureRandomMacKeyAgreementKeyFactory 的方法 或任何其他類型的算法.

In addition to JB's answer, I would like to propose a solution that queries the runtime for available algorithms. This method is of course easily converted to one for Cipher, SecureRandom, Mac, KeyAgreement, KeyFactory or any other type of algorithm.

import java.security.MessageDigest;
import java.security.Provider;
import java.security.Provider.Service;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public class ShowHashAlgorithms {

    private static final void showHashAlgorithms(Provider prov, Class<?> typeClass) {
        String type = typeClass.getSimpleName();

        List<Service> algos = new ArrayList<>();

        Set<Service> services = prov.getServices();
        for (Service service : services) {
            if (service.getType().equalsIgnoreCase(type)) {
                algos.add(service);
            }
        }

        if (!algos.isEmpty()) {
            System.out.printf(" --- Provider %s, version %.2f --- %n", prov.getName(), prov.getVersion());
            for (Service service : algos) {
                String algo = service.getAlgorithm();
                System.out.printf("Algorithm name: "%s"%n", algo);


            }
        }

        // --- find aliases (inefficiently)
        Set<Object> keys = prov.keySet();
        for (Object key : keys) {
            final String prefix = "Alg.Alias." + type + ".";
            if (key.toString().startsWith(prefix)) {
                String value = prov.get(key.toString()).toString();
                System.out.printf("Alias: "%s" -> "%s"%n",
                        key.toString().substring(prefix.length()),
                        value);
            }
        }
    }

    public static void main(String[] args) {
        Provider[] providers = Security.getProviders();
        for (Provider provider : providers) {
            showHashAlgorithms(provider, MessageDigest.class);
        }
    }
}

太陽提供者輸出

此代碼將為 Java 1.8 生成以下輸出.請注意,由于 API 提供者的一些舊錯誤,提供者版本僅以 double 的形式出現(xiàn).因此無法區(qū)分 1.80 版還是 1.8.0 版.

Sun provider output

This code will generate the following output for Java 1.8. Note that because of some old mistake by the API providers, the provider version is only present as a double. It is not possible to distinguish between version 1.80 or version 1.8.0 because of this.

別名低于實際實現(xiàn).其中一些別名是對象標識符或點符號中的OID.這些 OID 用于指示 ASN.1 編碼數(shù)據(jù)格式中的算法,例如 SSL/TLS 中使用的 X5.09v3 證書.例如,1.3.14.3.2.26{iso(1) identify-organization(3) oiw(14) secsig(3) algorithms(2) hashAlgorithmIdentifier(26) 的點符號} 和 SHA/SHA-1 的別名.

The aliases are below the actual implementations. Some of these aliases are Object Identifiers or OID's in dot notation. These OID's are used to indicate algorithms from within ASN.1 encoded data formats such as X5.09v3 certificates as used within SSL/TLS. For instance, 1.3.14.3.2.26 is the dot notation for {iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) hashAlgorithmIdentifier(26)} and the alias for SHA/SHA-1.

 --- Provider SUN, version 1.80 --- 
Algorithm name: "MD2"
Algorithm name: "MD5"
Algorithm name: "SHA"
Algorithm name: "SHA-224"
Algorithm name: "SHA-256"
Algorithm name: "SHA-384"
Algorithm name: "SHA-512"
Alias: "SHA-1" -> "SHA"
Alias: "OID.1.3.14.3.2.26" -> "SHA"
Alias: "1.3.14.3.2.26" -> "SHA"
Alias: "OID.2.16.840.1.101.3.4.2.4" -> "SHA-224"
Alias: "OID.2.16.840.1.101.3.4.2.3" -> "SHA-512"
Alias: "OID.2.16.840.1.101.3.4.2.2" -> "SHA-384"
Alias: "OID.2.16.840.1.101.3.4.2.1" -> "SHA-256"
Alias: "2.16.840.1.101.3.4.2.4" -> "SHA-224"
Alias: "2.16.840.1.101.3.4.2.3" -> "SHA-512"
Alias: "2.16.840.1.101.3.4.2.2" -> "SHA-384"
Alias: "2.16.840.1.101.3.4.2.1" -> "SHA-256"
Alias: "SHA1" -> "SHA"

Bouncy Castle 提供程序輸出

充氣城堡的輸出(未要求,包含用于比較):

Bouncy Castle provider output

Output for Bouncy Castle (not asked for, included for comparison):

 --- Provider BC, version 1.51 --- 
Algorithm name: "GOST3411"
Algorithm name: "MD2"
Algorithm name: "MD4"
Algorithm name: "MD5"
Algorithm name: "SHA-1"
Algorithm name: "RIPEMD128"
Algorithm name: "RIPEMD160"
Algorithm name: "RIPEMD256"
Algorithm name: "RIPEMD320"
Algorithm name: "SHA-224"
Algorithm name: "SHA-256"
Algorithm name: "SHA-384"
Algorithm name: "SHA-512"
Algorithm name: "SHA-512/224"
Algorithm name: "SHA-512/256"
Algorithm name: "SHA3-224"
Algorithm name: "SHA3-256"
Algorithm name: "SHA3-384"
Algorithm name: "SHA3-512"
Algorithm name: "Skein-256-128"
Algorithm name: "Skein-256-160"
Algorithm name: "Skein-256-224"
Algorithm name: "Skein-256-256"
Algorithm name: "Skein-512-128"
Algorithm name: "Skein-512-160"
Algorithm name: "Skein-512-224"
Algorithm name: "Skein-512-256"
Algorithm name: "Skein-512-384"
Algorithm name: "Skein-512-512"
Algorithm name: "Skein-1024-384"
Algorithm name: "Skein-1024-512"
Algorithm name: "Skein-1024-1024"
Algorithm name: "SM3"
Algorithm name: "TIGER"
Algorithm name: "WHIRLPOOL"
Alias: "SHA256" -> "SHA-256"
Alias: "SHA224" -> "SHA-224"
Alias: "1.3.36.3.2.3" -> "RIPEMD256"
Alias: "1.3.36.3.2.2" -> "RIPEMD128"
Alias: "1.3.36.3.2.1" -> "RIPEMD160"
Alias: "1.2.156.197.1.401" -> "SM3"
Alias: "SHA512" -> "SHA-512"
Alias: "SHA1" -> "SHA-1"
Alias: "GOST" -> "GOST3411"
Alias: "2.16.840.1.101.3.4.2.6" -> "SHA-512/256"
Alias: "2.16.840.1.101.3.4.2.5" -> "SHA-512/224"
Alias: "2.16.840.1.101.3.4.2.4" -> "SHA-224"
Alias: "2.16.840.1.101.3.4.2.3" -> "SHA-512"
Alias: "2.16.840.1.101.3.4.2.2" -> "SHA-384"
Alias: "2.16.840.1.101.3.4.2.1" -> "SHA-256"
Alias: "1.2.643.2.2.9" -> "GOST3411"
Alias: "1.3.14.3.2.26" -> "SHA-1"
Alias: "SHA512/224" -> "SHA-512/224"
Alias: "GOST-3411" -> "GOST3411"
Alias: "SHA512256" -> "SHA-512/256"
Alias: "SHA384" -> "SHA-384"
Alias: "SM3" -> "SM3"
Alias: "SHA" -> "SHA-1"
Alias: "1.2.840.113549.2.5" -> "MD5"
Alias: "1.2.840.113549.2.4" -> "MD4"
Alias: "1.2.840.113549.2.2" -> "MD2"

這篇關(guān)于JDK 中可用的 MessageDigest 完整列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Java Remove Duplicates from an Array?(Java從數(shù)組中刪除重復(fù)項?)
How to fix Invocation failed Unexpected Response from Server: Unauthorized in Android studio(如何修復(fù)調(diào)用失敗來自服務(wù)器的意外響應(yīng):在 Android 工作室中未經(jīng)授權(quán))
AES encryption, got extra trash characters in decrypted file(AES 加密,解密文件中有多余的垃圾字符)
AES Error: Given final block not properly padded(AES 錯誤:給定的最終塊未正確填充)
Detecting incorrect key using AES/GCM in JAVA(在 JAVA 中使用 AES/GCM 檢測不正確的密鑰)
AES-256-CBC in Java(Java 中的 AES-256-CBC)
主站蜘蛛池模板: 欧美日韩国产在线观看 | 日韩久久久久 | 日本不卡免费新一二三区 | 91在线免费视频 | 男人天堂网av | 羞羞的视频免费看 | 欧美男人天堂 | 日韩中文字幕高清 | 一区二区在线 | 福利av在线 | 精品久久成人 | 欧美一区二区三区高清视频 | 色av一区二区三区 | 免费一区二区三区 | 日干夜干 | 欧美精品二区 | 久久99国产精品 | 一区二区三区四区在线视频 | 欧美精品在线一区 | 久久极品 | 亚洲www| 亚洲精品www久久久久久广东 | www.日韩av.com | 一本一道久久a久久精品综合蜜臀 | 黑人性hd | 中文字幕国产一区 | 国产亚洲欧美在线视频 | 国产精品色哟哟网站 | 国产三区在线观看视频 | h视频在线观看免费 | 国产精品99久久久久久人 | 国产精品自拍视频网站 | 国产高清在线精品一区二区三区 | 性国产丰满麻豆videosex | 99免费在线视频 | 91久久精品| 国产日韩精品在线 | 欧美性a视频 | 在线播放国产一区二区三区 | 国产精品久久久久久久久久东京 | 亚洲日韩欧美一区二区在线 |