この記事では、Javaが実装したAESキー生成アルゴリズムについて説明します。次のように、参照のために共有してください。
java.security.nosuchalgorithmexception; Impont java.security.securerandom; Impont javax.crygenerator; import javax.crypto.secretkey; {try {keygenerator kg = keygenerator.getInstance( "aes"); //ここでは、secretkey()b = sk.getEncoded()を生成しますバイナリキーは「+s.length()*4);} catch(nosuchalgorithmexception e){e.printstacktrace(); System.out.println( "Noこのアルゴリズム。");ここでは、128、192、または256 // SecurerAndomは、安全な乱数シーケンスを生成することです。 kg.init(passiol.getBytes());バイナリキーの長さは「+s.length()*4);} catch(nosuchalgorithmexception e){e.printstacktrace(); System.out.println( "No This Algorithm。"); Byte Arrayはhex string * @return * / public static string(bytes [] bytes){stringbuffer sb = new string exstring(bytes [i]); if(strhex.length()<2){sb. strhex)}}}}PS:暗号化と復号化に興味がある友人は、このサイトのオンラインツールを参照することもできます。
パスワードセキュリティオンライン検出:
http://tools.vevb.com/password/my_password_safe
高強度パスワードジェネレーター:
http://tools.vevb.com/password/createstrongpassword
Thunder、Express、およびTornado URL暗号化/復号化ツール:
http://tools.vevb.com/password/urlrethunder
オンラインハッシュ/ハッシュアルゴリズム暗号化ツール:
http://tools.vevb.com/password/hash_encrypt
オンラインMD5/ハッシュ/SHA-1/SHA-2/SHA-256/SHA-512/SHA-3/RIPEMD-160暗号化ツール:
http://tools.vevb.com/password/hash_md5_sha
オンラインSHA1/SHA224/SHA256/SHA384/SHA512暗号化ツール:
http://tools.vevb.com/password/sha_encode
この記事がみんなのJavaプログラミングに役立つことを願っています。