パッケージ org.iplass.mtp.impl.util

クラス HashUtil

java.lang.Object
org.iplass.mtp.impl.util.HashUtil

public final class HashUtil extends Object
  • メソッドの詳細

    • digest

      public static String digest(String target, String algorithm) throws NoSuchAlgorithmException
      指定の文字列の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の文字列表現
      例外:
      UnsupportedEncodingException
      NoSuchAlgorithmException
      関連項目:
    • digest

      public static String digest(byte[] target, String algorithm) throws NoSuchAlgorithmException
      指定のByte配列のHashを取得する。
      本メソッドでは、大きなデータに対してのHash作成には対応していない。もし大きいファイル当のHashを作成するときは、独自の実装をしてください。
      パラメータ:
      target - Hashを取得するByte配列
      algorithm - アルゴリズム
      戻り値:
      例外:
      NoSuchAlgorithmException
    • hexToString

      public static String hexToString(StringBuilder sb, byte[] data)
    • hexDigit

      public static void hexDigit(StringBuilder sb, byte byte0)
      指定のByteの文字列表記を引数sbに詰め込みます。
      パラメータ:
      sb - 詰め込むStringBuilder
      byte - 変換するByte