パッケージ org.iplass.mtp.impl.util
クラス HashUtil
java.lang.Object
org.iplass.mtp.impl.util.HashUtil
-
メソッドの概要
修飾子とタイプメソッド説明static String指定のByte配列のHashを取得する。static String指定の文字列のHashを取得する。static String指定の文字列のHashを取得する。static voidhexDigit(StringBuilder sb, byte byte0) 指定のByteの文字列表記を引数sbに詰め込みます。static StringhexToString(StringBuilder sb, byte[] data)
-
メソッドの詳細
-
digest
指定の文字列のHashを取得する。
Hashを作成するには、String -> byte[]に変換する必要がある。本メソッドではデフォルトのエンコーディングを利用しているので、 文字コードを指定したい場合は、文字コードを引数に持つメソッドを利用すること。- パラメータ:
target- Hashを作成する文字列algorithm- Hashのアルゴリズム- 戻り値:
- Hashの文字列表現
- 例外:
NoSuchAlgorithmException- 関連項目:
-
digest
public static String digest(String target, String algorithm, String charsetName) throws NoSuchAlgorithmException, UnsupportedEncodingException 指定の文字列のHashを取得する。- パラメータ:
target- Hashを作成する文字列algorithm- Hashのアルゴリズム- 戻り値:
- Hashの文字列表現
- 例外:
UnsupportedEncodingExceptionNoSuchAlgorithmException- 関連項目:
-
digest
指定のByte配列のHashを取得する。
本メソッドでは、大きなデータに対してのHash作成には対応していない。もし大きいファイル当のHashを作成するときは、独自の実装をしてください。- パラメータ:
target- Hashを取得するByte配列algorithm- アルゴリズム- 戻り値:
- 例外:
NoSuchAlgorithmException
-
hexToString
-
hexDigit
指定のByteの文字列表記を引数sbに詰め込みます。- パラメータ:
sb- 詰め込むStringBuilderbyte- 変換するByte
-