다음을 통해 공유


HashAlgorithm 클래스

모든 암호화 해시 알고리즘의 구현이 파생되어야 하는 기본 클래스를 나타냅니다.

네임스페이스: System.Security.Cryptography
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<ComVisibleAttribute(True)> _
Public MustInherit Class HashAlgorithm
    Implements ICryptoTransform, IDisposable
‘사용 방법
Dim instance As HashAlgorithm
[ComVisibleAttribute(true)] 
public abstract class HashAlgorithm : ICryptoTransform, IDisposable
[ComVisibleAttribute(true)] 
public ref class HashAlgorithm abstract : ICryptoTransform, IDisposable
/** @attribute ComVisibleAttribute(true) */ 
public abstract class HashAlgorithm implements ICryptoTransform, IDisposable
ComVisibleAttribute(true) 
public abstract class HashAlgorithm implements ICryptoTransform, IDisposable

설명

해시 함수는 현대 암호화의 토대를 이룹니다. 해시 함수는 임의의 길이의 이진 문자열을 해시 값으로 알려진 고정된 길이의 작은 이진 문자열에 매핑합니다. 암호화 해시 함수에는 같은 값으로 해시하는 두 개의 다른 입력을 찾는 실행 불가능한 속성이 있습니다. 해시 함수는 디지털 서명과 데이터 무결성에 주로 사용됩니다.

해시는 많은 용량의 데이터를 나타내는 고정된 크기의 고유 값으로 사용됩니다. 두 데이터 집합의 해시는 해당하는 데이터도 일치할 경우에 일치해야 합니다. 데이터가 약간만 달라져도 해시에는 예측할 수 없는 큰 변화가 발생합니다.

상속자 참고 사항 HashAlgorithm 클래스에서 상속하는 경우 HashCoreHashFinal 멤버를 재정의해야 합니다.

예제

다음 코드 예제에서는 배열에 대해 SHA1CryptoServiceProvider 해시를 계산합니다. 이 예제에서는 미리 정의된 바이트 배열 dataArray[]가 있는 것으로 가정합니다. SHA1CryptoServiceProviderHashAlgorithm의 파생 클래스입니다.

Dim sha As New SHA1CryptoServiceProvider()
Dim result As Byte() = sha.ComputeHash(dataArray)
HashAlgorithm sha = new SHA1CryptoServiceProvider();
byte[] result = sha.ComputeHash(dataArray);
HashAlgorithm^ sha = gcnew SHA1CryptoServiceProvider;
array<Byte>^ result = sha->ComputeHash( dataArray );
HashAlgorithm sha = new SHA1CryptoServiceProvider();
ubyte result[] = sha.ComputeHash(dataArray);

상속 계층 구조

System.Object
  System.Security.Cryptography.HashAlgorithm
     파생 클래스

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0에서 지원

참고 항목

참조

HashAlgorithm 멤버
System.Security.Cryptography 네임스페이스

기타 리소스

암호화 서비스