RIPEMD160Managed クラス
アセンブリ: mscorlib (mscorlib.dll 内)


RIPEMD-160 は、160 ビットの暗号ハッシュ関数です。128 ビットのハッシュ関数 MD4、MD5、および RIPEMD をより安全にしたものです。RIPEMD は、EU プロジェクト RIPE (RACE Integrity Primitives Evaluation、1988 ~ 1992) の一環として開発されました。

RIPEMD160Managed クラスを使用してファイルをエンコードしたり、エンコード済みのファイルをデコードしたりする方法を次のコード例に示します。
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.Security.Cryptography.HashAlgorithm
System.Security.Cryptography.RIPEMD160
System.Security.Cryptography.RIPEMD160Managed


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


RIPEMD160Managed コンストラクタ
アセンブリ: mscorlib (mscorlib.dll 内)


ハッシュは、大量のデータを表す固定サイズの一意の値として使用されます。2 つのデータ セットのハッシュが一致するのは、対応するデータも一致する場合だけです。データを少し変更しただけでも、ハッシュは予測できないほど大幅に変更されてしまいます。

ディレクトリ内のすべてのファイルについて、RIPEMD160Managed クラスのハッシュを計算する方法を次のコード例に示します。
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

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


RIPEMD160Managed フィールド

名前 | 説明 | |
---|---|---|
![]() | HashSizeValue | 計算されたハッシュ コードのサイズをビット単位で表します。 ( HashAlgorithm から継承されます。) |
![]() | HashValue | 計算されたハッシュ コードの値を表します。 ( HashAlgorithm から継承されます。) |
![]() | State | ハッシュ計算の状態を表します。 ( HashAlgorithm から継承されます。) |

RIPEMD160Managed プロパティ

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

RIPEMD160Managed メソッド

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

名前 | 説明 | |
---|---|---|
![]() | Dispose | HashAlgorithm によって使用されているアンマネージ リソースを解放し、オプションでマネージ リソースも解放します。 ( HashAlgorithm から継承されます。) |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | HashCore | オーバーライドされます。 派生クラスでオーバーライドされると、ハッシュを計算するために、オブジェクトに書き込まれたデータを RIPEMD160 ハッシュ アルゴリズムにルーティングします。 |
![]() | HashFinal | オーバーライドされます。 派生クラスでオーバーライドされると、暗号ストリーム オブジェクトによって最後のデータが処理された後に、ハッシュ計算を終了します。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

RIPEMD160Managed メンバ
マネージ ライブラリを使用して、入力データの RIPEMD160 ハッシュを計算します。
RIPEMD160Managed データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | 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 クラスに固有の実装を作成します。 (RIPEMD160 から継承されます。) |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | Initialize | オーバーライドされます。 マネージ ライブラリを使用して、RIPEMD160Managed クラスのインスタンスを初期化します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
![]() | TransformBlock | 入力バイト配列の指定した領域のハッシュ値を計算し、結果ハッシュ値を出力バイト配列の指定した領域にコピーします。 (HashAlgorithm から継承されます。) |
![]() | TransformFinalBlock | 指定したバイト配列の指定した領域のハッシュ値を計算します。 (HashAlgorithm から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Dispose | HashAlgorithm によって使用されているアンマネージ リソースを解放し、オプションでマネージ リソースも解放します。 (HashAlgorithm から継承されます。) |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | HashCore | オーバーライドされます。 派生クラスでオーバーライドされると、ハッシュを計算するために、オブジェクトに書き込まれたデータを RIPEMD160 ハッシュ アルゴリズムにルーティングします。 |
![]() | HashFinal | オーバーライドされます。 派生クラスでオーバーライドされると、暗号ストリーム オブジェクトによって最後のデータが処理された後に、ハッシュ計算を終了します。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からRIPEMD160Managedを検索する場合は、下記のリンクをクリックしてください。

- RIPEMD160Managedのページへのリンク