다음을 통해 공유


SHA1 클래스

입력 데이터에 대한 SHA1 해시를 계산합니다.

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

구문

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

설명

해시는 많은 용량의 데이터를 나타내는 고정된 크기의 고유 값으로 사용됩니다. 두 데이터 집합의 해시는 해당하는 데이터도 일치할 경우에 일치해야 합니다. 데이터에 작은 변경이 있으면 해시에 예측할 수 없는 커다란 변경이 발생합니다.

SHA1 알고리즘에 대한 해시 크기는 160비트입니다.

예제

다음 예제에서는 dataSHA1 해시를 계산하여 이를 result에 저장합니다. 이 예제에서는 미리 정의된 상수 DATA_SIZE가 있는 것으로 가정합니다.

Dim data(DATA_SIZE) As Byte
Dim result() As Byte
       
Dim sha As New SHA1CryptoServiceProvider()
' This is one implementation of the abstract class SHA1.
result = sha.ComputeHash(data)
byte[] data = new byte[DATA_SIZE];
byte[] result; 
 
SHA1 sha = new SHA1CryptoServiceProvider(); 
// This is one implementation of the abstract class SHA1.
result = sha.ComputeHash(data);
array<Byte>^ data = gcnew array<Byte>( DATA_SIZE );
array<Byte>^ result;

SHA1^ sha = gcnew SHA1CryptoServiceProvider;
// This is one implementation of the abstract class SHA1.
result = sha->ComputeHash( data );
ubyte data[] = new ubyte[data_Size];
ubyte result[];
SHA1 sha = new SHA1CryptoServiceProvider();

// This is one implementation of the abstract class SHA1.
result = sha.ComputeHash(data);

상속 계층 구조

System.Object
   System.Security.Cryptography.HashAlgorithm
    System.Security.Cryptography.SHA1
       System.Security.Cryptography.SHA1CryptoServiceProvider
       System.Security.Cryptography.SHA1Managed

스레드로부터의 안전성

이 형식의 모든 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에서 지원

참고 항목

참조

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

기타 리소스

암호화 서비스