RIPEMD-160とは? わかりやすく解説

RIPEMD160 クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

MD160 ハッシュ アルゴリズムすべての実装継承する抽象クラス表します

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public MustInherit Class
 RIPEMD160
    Inherits HashAlgorithm
[ComVisibleAttribute(true)] 
public abstract class RIPEMD160 : HashAlgorithm
[ComVisibleAttribute(true)] 
public ref class RIPEMD160 abstract : public
 HashAlgorithm
/** @attribute ComVisibleAttribute(true) */ 
public abstract class RIPEMD160 extends HashAlgorithm
ComVisibleAttribute(true) 
public abstract class RIPEMD160 extends
 HashAlgorithm
解説解説
使用例使用例

ディレクトリ内のすべてのファイルについてRIPEMD160ハッシュ計算する方法次のコード例示します

using System;
using System.IO;
using System.Security.Cryptography;

    public class HashDirectory
    {
        // Print the byte array in a readable format.
        public static void
 PrintByteArray(byte[] array)
        {
            int i;
            for (i = 0; i < array.Length; i++)
            {
                Console.Write(String.Format("{0:X2}",array[i]));
                if ((i % 4) == 3) Console.Write(" ");
            }
                          Console.WriteLine();
        }

        public static void
 Main(String[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Usage: hashdir <directory>");
                return;
            }
            try
            {
                // Create a DirectoryInfo object representing the specified
 directory.
                DirectoryInfo dir = new DirectoryInfo(args[0]);
                // Get the FileInfo objects for every file in the directory.
                FileInfo[] files = dir.GetFiles();
                // Initialize a RIPE160 hash object.
                RIPEMD160 myRIPEMD160 = RIPEMD160Managed.Create();
                byte[] hashValue;
                // Compute and print the hash values for each file in
 directory.
                foreach (FileInfo fInfo in
 files)
                {
                    // Create a fileStream for the file.
                    FileStream fileStream = fInfo.Open(FileMode.Open);
                    // Compute the hash of the fileStream.
                    hashValue = myRIPEMD160.ComputeHash(fileStream);
                    // Write the name of the file to the Console.
                    Console.Write(fInfo.Name + ": ");
                    // Write the hash value to the Console.
                    PrintByteArray(hashValue);
                    // Close the file.
                    fileStream.Close();
                }
                return;
            }
            catch (DirectoryNotFoundException)
            {
                Console.WriteLine("Error: The directory specified could not
 be found.");
            }
            catch (IOException)
            {
                Console.WriteLine("Error: A file in the directory
 could not be accessed.");
            }
        }
    }
using namespace System;
using namespace System::IO;
using namespace System::Security::Cryptography;

// Print the byte array in a readable format.
void PrintByteArray( array<Byte>^array )
{
   int i;
   for ( i = 0; i < array->Length; i++ )
   {
      Console::Write( String::Format( "{0:X2}", array[ i ] ) );
      if ( (i % 4) == 3 )
            Console::Write( " " );

   }
   Console::WriteLine();
}

int main()
{
   array<String^>^args = Environment::GetCommandLineArgs();
   if ( args->Length < 2 )
   {
      Console::WriteLine( "Usage: hashdir <directory>" );
      return 0;
   }

   try
   {
      
      // Create a DirectoryInfo object representing the specified directory.
      DirectoryInfo^ dir = gcnew DirectoryInfo( args[ 1 ] );
      
      // Get the FileInfo objects for every file in the directory.
      array<FileInfo^>^files = dir->GetFiles();
      
      // Initialize a RIPE160 hash object.
      RIPEMD160 ^ myRIPEMD160 = RIPEMD160Managed::Create();
      array<Byte>^hashValue;
      
      // Compute and print the hash values for each file in directory.
      System::Collections::IEnumerator^ myEnum = files->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         FileInfo^ fInfo = safe_cast<FileInfo^>(myEnum->Current);
         
         // Create a fileStream for the file.
         FileStream^ fileStream = fInfo->Open( FileMode::Open );
         
         // Compute the hash of the fileStream.
         hashValue = myRIPEMD160->ComputeHash( fileStream );
         
         // Write the name of the file to the Console.
         Console::Write( "{0}: ", fInfo->Name );
         
         // Write the hash value to the Console.
         PrintByteArray( hashValue );
         
         // Close the file.
         fileStream->Close();
      }
      return 0;
   }
   catch ( DirectoryNotFoundException^ ) 
   {
      Console::WriteLine( "Error: The directory specified could not be found."
 );
   }
   catch ( IOException^ ) 
   {
      Console::WriteLine( "Error: A file in the directory
 could not be accessed." );
   }

}

import System.*;
import System.IO.*;
import System.Security.Cryptography.*;

public class HashDirectory
{
    // Print the byte array in a readable format.
    public static void PrintByteArray(ubyte
 array[])
    {
        int i;
        for (i = 0; i < array.get_Length(); i++) {
            Console.Write(String.Format("{0:X2}", array.get_Item(i)));
            if (i % 4 == 3) {
                Console.Write(" ");
            }
        }
        Console.WriteLine();
    } //PrintByteArray

    public static void main(String[]
 args)
    {        
        if (args.get_Length() < 1) {
            Console.WriteLine("Usage: hashdir <directory>");
            return;
        }
        try {
            // Create a DirectoryInfo object representing the specified
 
            // directory.
            DirectoryInfo dir = new DirectoryInfo(args[0]);
            // Get the FileInfo objects for every file in the directory.
            FileInfo files[] = dir.GetFiles();
            // Initialize a RIPE160 hash object.
            RIPEMD160 myRIPEMD160 = RIPEMD160Managed.Create();
            ubyte hashValue[];
            FileInfo fInfo = null;
            for (int iCtr = 0; iCtr < files.get_Length();
 iCtr++) {
                // Compute and print the hash values for each file in
 directory.
                fInfo = files[iCtr];
                // Create a fileStream for the file.
                FileStream fileStream = fInfo.Open(FileMode.Open);
                // Compute the hash of the fileStream.
                hashValue = myRIPEMD160.ComputeHash(fileStream);
                // Write the name of the file to the Console.
                Console.Write(fInfo.get_Name() + ": ");
                // Write the hash value to the Console.
                PrintByteArray(hashValue);
                // Close the file.
                fileStream.Close();
            }
            return;
        }
        catch (DirectoryNotFoundException exp) {
            Console.WriteLine("Error: The directory specified could"
                + "not be found.");
        }
        catch (IOException exp) {
            Console.WriteLine("Error: A file in the directory
 could not "
                + "be accessed.");
        }
    } //main
} //HashDirectory
継承階層継承階層
System.Object
   System.Security.Cryptography.HashAlgorithm
    System.Security.Cryptography.RIPEMD160
       System.Security.Cryptography.RIPEMD160Managed
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

RIPEMD160 コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

RIPEMD160 クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説
使用例使用例

ディレクトリ内のすべてのファイルについてRIPEMD160 ハッシュ計算する方法次のコード例示します

using System;
using System.IO;
using System.Security.Cryptography;

    public class HashDirectory
    {
        // Print the byte array in a readable format.
        public static void
 PrintByteArray(byte[] array)
        {
            int i;
            for (i = 0; i < array.Length; i++)
            {
                Console.Write(String.Format("{0:X2}",array[i]));
                if ((i % 4) == 3) Console.Write(" ");
            }
                          Console.WriteLine();
        }

        public static void
 Main(String[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Usage: hashdir <directory>");
                return;
            }
            try
            {
                // Create a DirectoryInfo object representing the specified
 directory.
                DirectoryInfo dir = new DirectoryInfo(args[0]);
                // Get the FileInfo objects for every file in the directory.
                FileInfo[] files = dir.GetFiles();
                // Initialize a RIPE160 hash object.
                RIPEMD160 myRIPEMD160 = RIPEMD160Managed.Create();
                byte[] hashValue;
                // Compute and print the hash values for each file in
 directory.
                foreach (FileInfo fInfo in
 files)
                {
                    // Create a fileStream for the file.
                    FileStream fileStream = fInfo.Open(FileMode.Open);
                    // Compute the hash of the fileStream.
                    hashValue = myRIPEMD160.ComputeHash(fileStream);
                    // Write the name of the file to the Console.
                    Console.Write(fInfo.Name + ": ");
                    // Write the hash value to the Console.
                    PrintByteArray(hashValue);
                    // Close the file.
                    fileStream.Close();
                }
                return;
            }
            catch (DirectoryNotFoundException)
            {
                Console.WriteLine("Error: The directory specified could not
 be found.");
            }
            catch (IOException)
            {
                Console.WriteLine("Error: A file in the directory
 could not be accessed.");
            }
        }
    }
using namespace System;
using namespace System::IO;
using namespace System::Security::Cryptography;

// Print the byte array in a readable format.
void PrintByteArray( array<Byte>^array )
{
   int i;
   for ( i = 0; i < array->Length; i++ )
   {
      Console::Write( String::Format( "{0:X2}", array[ i ] ) );
      if ( (i % 4) == 3 )
            Console::Write( " " );

   }
   Console::WriteLine();
}

int main()
{
   array<String^>^args = Environment::GetCommandLineArgs();
   if ( args->Length < 2 )
   {
      Console::WriteLine( "Usage: hashdir <directory>" );
      return 0;
   }

   try
   {
      
      // Create a DirectoryInfo object representing the specified directory.
      DirectoryInfo^ dir = gcnew DirectoryInfo( args[ 1 ] );
      
      // Get the FileInfo objects for every file in the directory.
      array<FileInfo^>^files = dir->GetFiles();
      
      // Initialize a RIPE160 hash object.
      RIPEMD160 ^ myRIPEMD160 = RIPEMD160Managed::Create();
      array<Byte>^hashValue;
      
      // Compute and print the hash values for each file in directory.
      System::Collections::IEnumerator^ myEnum = files->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         FileInfo^ fInfo = safe_cast<FileInfo^>(myEnum->Current);
         
         // Create a fileStream for the file.
         FileStream^ fileStream = fInfo->Open( FileMode::Open );
         
         // Compute the hash of the fileStream.
         hashValue = myRIPEMD160->ComputeHash( fileStream );
         
         // Write the name of the file to the Console.
         Console::Write( "{0}: ", fInfo->Name );
         
         // Write the hash value to the Console.
         PrintByteArray( hashValue );
         
         // Close the file.
         fileStream->Close();
      }
      return 0;
   }
   catch ( DirectoryNotFoundException^ ) 
   {
      Console::WriteLine( "Error: The directory specified could not be found."
 );
   }
   catch ( IOException^ ) 
   {
      Console::WriteLine( "Error: A file in the directory
 could not be accessed." );
   }

}

import System.*;
import System.IO.*;
import System.Security.Cryptography.*;

public class HashDirectory
{
    // Print the byte array in a readable format.
    public static void PrintByteArray(ubyte
 array[])
    {
        int i;
        for (i = 0; i < array.get_Length(); i++) {
            Console.Write(String.Format("{0:X2}", array.get_Item(i)));
            if (i % 4 == 3) {
                Console.Write(" ");
            }
        }
        Console.WriteLine();
    } //PrintByteArray

    public static void main(String[]
 args)
    {        
        if (args.get_Length() < 1) {
            Console.WriteLine("Usage: hashdir <directory>");
            return;
        }
        try {
            // Create a DirectoryInfo object representing the specified
 
            // directory.
            DirectoryInfo dir = new DirectoryInfo(args[0]);
            // Get the FileInfo objects for every file in the directory.
            FileInfo files[] = dir.GetFiles();
            // Initialize a RIPE160 hash object.
            RIPEMD160 myRIPEMD160 = RIPEMD160Managed.Create();
            ubyte hashValue[];
            FileInfo fInfo = null;
            for (int iCtr = 0; iCtr < files.get_Length();
 iCtr++) {
                // Compute and print the hash values for each file in
 directory.
                fInfo = files[iCtr];
                // Create a fileStream for the file.
                FileStream fileStream = fInfo.Open(FileMode.Open);
                // Compute the hash of the fileStream.
                hashValue = myRIPEMD160.ComputeHash(fileStream);
                // Write the name of the file to the Console.
                Console.Write(fInfo.get_Name() + ": ");
                // Write the hash value to the Console.
                PrintByteArray(hashValue);
                // Close the file.
                fileStream.Close();
            }
            return;
        }
        catch (DirectoryNotFoundException exp) {
            Console.WriteLine("Error: The directory specified could"
                + "not be found.");
        }
        catch (IOException exp) {
            Console.WriteLine("Error: A file in the directory
 could not "
                + "be accessed.");
        }
    } //main
} //HashDirectory
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

RIPEMD160 フィールド


プロテクト フィールドプロテクト フィールド

  名前 説明
プロテクト フィールド HashSizeValue  計算されハッシュ コードサイズビット単位表します。 ( HashAlgorithm から継承されます。)
プロテクト フィールド HashValue  計算されハッシュ コードの値を表します。 ( HashAlgorithm から継承されます。)
プロテクト フィールド State  ハッシュ計算の状態を表します。 ( HashAlgorithm から継承されます。)
参照参照

関連項目

RIPEMD160 クラス
System.Security.Cryptography 名前空間

その他の技術情報

暗号サービス

RIPEMD160 プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ CanReuseTransform  現在の変換再利用できるかどうかを示す値を取得します。 ( HashAlgorithm から継承されます。)
パブリック プロパティ CanTransformMultipleBlocks  派生クラスオーバーライドされると、複数ブロック変換できるかどうかを示す値を取得します。 ( HashAlgorithm から継承されます。)
パブリック プロパティ Hash  計算されハッシュ コードの値を取得します。 ( HashAlgorithm から継承されます。)
パブリック プロパティ HashSize  計算されハッシュ コードサイズビット単位取得します。 ( HashAlgorithm から継承されます。)
パブリック プロパティ InputBlockSize  派生クラスオーバーライドされると、入力ブロック サイズ取得します。 ( HashAlgorithm から継承されます。)
パブリック プロパティ OutputBlockSize  派生クラスオーバーライドされると、出力ブロック サイズ取得します。 ( HashAlgorithm から継承されます。)
参照参照

関連項目

RIPEMD160 クラス
System.Security.Cryptography 名前空間

その他の技術情報

暗号サービス

RIPEMD160 メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Clear  HashAlgorithm クラスによって使用されているすべてのリソース解放します。 ( HashAlgorithm から継承されます。)
パブリック メソッド ComputeHash  オーバーロードされます入力データハッシュ値計算します。 ( HashAlgorithm から継承されます。)
パブリック メソッド Create オーバーロードされます。 RIPEMD160 クラス固有の実装作成します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド Initialize  HashAlgorithm クラス実装初期化します。 ( HashAlgorithm から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
パブリック メソッド TransformBlock  入力バイト配列指定した領域ハッシュ値計算し結果ハッシュ値出力バイト配列指定した領域コピーします。 ( HashAlgorithm から継承されます。)
パブリック メソッド TransformFinalBlock  指定したバイト配列指定した領域ハッシュ値計算します。 ( HashAlgorithm から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

RIPEMD160 クラス
System.Security.Cryptography 名前空間

その他の技術情報

暗号サービス

RIPEMD160 メンバ

MD160 ハッシュ アルゴリズムすべての実装継承する抽象クラス表します

RIPEMD160 データ型公開されるメンバを以下の表に示します


プロテクト コンストラクタプロテクト コンストラクタ
  名前 説明
プロテクト メソッド RIPEMD160 RIPEMD160 クラス新しインスタンス初期化します。
プロテクト フィールドプロテクト フィールド
  名前 説明
プロテクト フィールド HashSizeValue  計算されハッシュ コードサイズビット単位表します。(HashAlgorithm から継承されます。)
プロテクト フィールド HashValue  計算されハッシュ コードの値を表します。(HashAlgorithm から継承されます。)
プロテクト フィールド State  ハッシュ計算の状態を表します。(HashAlgorithm から継承されます。)
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ CanReuseTransform  現在の変換再利用できるかどうかを示す値を取得します。(HashAlgorithm から継承されます。)
パブリック プロパティ CanTransformMultipleBlocks  派生クラスオーバーライドされると、複数ブロック変換できるかどうかを示す値を取得します。(HashAlgorithm から継承されます。)
パブリック プロパティ Hash  計算されハッシュ コードの値を取得します。(HashAlgorithm から継承されます。)
パブリック プロパティ HashSize  計算されハッシュ コードサイズビット単位取得します。(HashAlgorithm から継承されます。)
パブリック プロパティ InputBlockSize  派生クラスオーバーライドされると、入力ブロック サイズ取得します。(HashAlgorithm から継承されます。)
パブリック プロパティ OutputBlockSize  派生クラスオーバーライドされると、出力ブロック サイズ取得します。(HashAlgorithm から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Clear  HashAlgorithm クラスによって使用されているすべてのリソース解放します。 (HashAlgorithm から継承されます。)
パブリック メソッド ComputeHash  オーバーロードされます入力データハッシュ値計算します。 (HashAlgorithm から継承されます。)
パブリック メソッド Create オーバーロードされます。 RIPEMD160 クラス固有の実装作成します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド Initialize  HashAlgorithm クラス実装初期化します。 (HashAlgorithm から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
パブリック メソッド TransformBlock  入力バイト配列指定した領域ハッシュ値計算し結果ハッシュ値出力バイト配列指定した領域コピーします。 (HashAlgorithm から継承されます。)
パブリック メソッド TransformFinalBlock  指定したバイト配列指定した領域ハッシュ値計算します。 (HashAlgorithm から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

RIPEMD160 クラス
System.Security.Cryptography 名前空間

その他の技術情報

暗号サービス

RIPEMD

(RIPEMD-160 から転送)

出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2022/11/19 09:11 UTC 版)

RIPEMD
一般
設計者 Hans Dobbertin, Antoon Bosselaers, Bart Preneel
初版発行日 1996
認証 RIPEMD-160: CRYPTREC(運用監視)
詳細
ダイジェスト長 128, 160, 256, 320 bits
RIPEMD 160の圧縮関数のサブブロック

RIPEMD (RACE Integrity Primitives Evaluation Message Digest) は、1996年にルーヴェン・カトリック大学COSIC英語版のHans Dobbertin、Antoon Bosselaers、Bart Preneelによって開発された暗号学的ハッシュ関数である。RIPEMDはMD4の設計原理に基づいたものであり、SHA-1と同程度のパフォーマンスを有している。

SHA-1SHA-2NSAによって開発されたのと対照的に、RIPEMDはオープンな学術コミュニティによって開発され、特許による制限を受けない。RIPEMD-160は、オリジナルのRIPEMDでは128ビットであるハッシュ長を160ビットにしたうえで改良を加えたものであり、RIPEMDのファミリーの中で最も広く用いられているが、SHA-1ほどは用いられていない。

160ビットだけでなく128、256、320ビットの変種もあり、それぞれRIPEMD-128RIPEMD-256RIPEMD-320と呼ばれている。128ビットであるRIPEMD-128は、同じく128ビットでありセキュリティ面での問題点が発見されていたオリジナルのRIPEMDを置き換えることのみを意図したものである。256および320ビットであるRIPEMD-256、RIPEMD-320はハッシュの衝突の可能性を小さくするのみであり、原像攻撃への耐性といったセキュリティレベルはRIPEMD-128やRIPEMD-160と同程度である。

2004年8月に、オリジナルのRIPEMDについてハッシュの衝突が報告された[1]。これはRIPEMD-160などには影響を及ぼさない[2]

RIPEMD-160 のハッシュ値

RIPEMD-160によるハッシュ値は、十六進法で40桁となる。以下は、43バイトのASCII文字列を入力とした時のRIPEMD-160によるハッシュ値である。

 RIPEMD-160("The quick brown fox jumps over the lazy dog") =
 37f332f68db77bd9d7edd4969571ad671cf9dd3b

入力メッセージのわずかな違いも、出力されるハッシュ値には大きな違いをもたらす。dc に変えた場合には以下のようになる。

 RIPEMD-160("The quick brown fox jumps over the lazy cog") =
 132072df690933835eb8b6ad0b77e7b6f14acad7

空の入力に対するハッシュ値は以下のようになる。

 RIPEMD-160("") = 
 9c1185a5c5e9fc54612808977ee8f548b2258d31

実装ライブラリ

RIPEMDをサポートしているライブラリは以下の通り。

関連項目

脚注

  1. ^ Xiaoyun Wang (2004年8月17日). “Collisions for Hash Functions MD4, MD5, HAVAL-128 and RIPEMD”. 2013年12月28日閲覧。
  2. ^ Florian Mendel (2006年). “On the Collision Resistance of RIPEMD-160”. 2014年11月7日閲覧。

外部リンク



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「RIPEMD-160」の関連用語

RIPEMD-160のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RIPEMD-160のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.
ウィキペディアウィキペディア
All text is available under the terms of the GNU Free Documentation License.
この記事は、ウィキペディアのRIPEMD (改訂履歴)の記事を複製、再配布したものにあたり、GNU Free Documentation Licenseというライセンスの下で提供されています。 Weblio辞書に掲載されているウィキペディアの記事も、全てGNU Free Documentation Licenseの元に提供されております。

©2025 GRAS Group, Inc.RSS