System.Hash.THashSHA1
Delphi
THashSHA1 = record
private
FHash: array[0..4] of Cardinal;
FBitLength: Int64;
FBuffer: array [0..63] of Byte;
FIndex: Integer;
FFinalized: Boolean;
procedure Initialize;
procedure CheckFinalized;
procedure Compress;
procedure Finalize;
function GetDigest: TBytes;
procedure Update(const AData: PByte; ALength: Cardinal); overload;
public
class function Create: THashSHA1; static; inline;
procedure Reset; inline;
procedure Update(const AData; ALength: Cardinal); overload;
procedure Update(const AData: TBytes; ALength: Cardinal = 0); overload; inline;
procedure Update(const Input: string); overload; inline;
function GetBlockSize: Integer; inline;
function GetHashSize: Integer; inline;
function HashAsBytes: TBytes; inline;
function HashAsString: string; inline;
class function GetHashBytes(const AData: string): TBytes; static;
class function GetHashString(const AString: string): string; static;
class function GetHMAC(const AData, AKey: string): string; static; inline;
class function GetHMACAsBytes(const AData, AKey: string): TBytes; overload; static;
class function GetHMACAsBytes(const AData: string; const AKey: TBytes): TBytes; overload; static;
class function GetHMACAsBytes(const AData: TBytes; const AKey: string): TBytes; overload; static;
class function GetHMACAsBytes(const AData, AKey: TBytes): TBytes; overload; static;
end;
C++
struct DECLSPEC_DRECORD THashSHA1
{
private:
System::StaticArray<unsigned, 5> FHash;
__int64 FBitLength;
System::StaticArray<System::Byte, 64> FBuffer;
int FIndex;
bool FFinalized;
void __fastcall Initialize(void);
void __fastcall CheckFinalized(void);
void __fastcall Compress(void);
void __fastcall Finalize(void);
#ifndef _WIN64
System::DynamicArray<System::Byte> __fastcall GetDigest(void);
#else /* _WIN64 */
System::TArray__1<System::Byte> __fastcall GetDigest(void);
#endif /* _WIN64 */
void __fastcall Update(const System::PByte AData, unsigned ALength)/* overload */;
public:
static THashSHA1 __fastcall Create();
void __fastcall Reset(void);
void __fastcall Update(const void *AData, unsigned ALength)/* overload */;
#ifndef _WIN64
void __fastcall Update(const System::DynamicArray<System::Byte> AData, unsigned ALength = (unsigned)(0x0))/* overload */;
#else /* _WIN64 */
void __fastcall Update(const System::TArray__1<System::Byte> AData, unsigned ALength = (unsigned)(0x0))/* overload */;
#endif /* _WIN64 */
void __fastcall Update(const System::UnicodeString Input)/* overload */;
int __fastcall GetBlockSize(void);
int __fastcall GetHashSize(void);
#ifndef _WIN64
System::DynamicArray<System::Byte> __fastcall HashAsBytes(void);
#else /* _WIN64 */
System::TArray__1<System::Byte> __fastcall HashAsBytes(void);
#endif /* _WIN64 */
System::UnicodeString __fastcall HashAsString(void);
#ifndef _WIN64
static System::DynamicArray<System::Byte> __fastcall GetHashBytes(const System::UnicodeString AData);
#else /* _WIN64 */
static System::TArray__1<System::Byte> __fastcall GetHashBytes(const System::UnicodeString AData);
#endif /* _WIN64 */
static System::UnicodeString __fastcall GetHashString(const System::UnicodeString AString);
static System::UnicodeString __fastcall GetHMAC(const System::UnicodeString AData, const System::UnicodeString AKey);
#ifndef _WIN64
static System::DynamicArray<System::Byte> __fastcall GetHMACAsBytes(const System::UnicodeString AData, const System::UnicodeString AKey)/* overload */;
static System::DynamicArray<System::Byte> __fastcall GetHMACAsBytes(const System::UnicodeString AData, const System::DynamicArray<System::Byte> AKey)/* overload */;
static System::DynamicArray<System::Byte> __fastcall GetHMACAsBytes(const System::DynamicArray<System::Byte> AData, const System::UnicodeString AKey)/* overload */;
static System::DynamicArray<System::Byte> __fastcall GetHMACAsBytes(const System::DynamicArray<System::Byte> AData, const System::DynamicArray<System::Byte> AKey)/* overload */;
#else /* _WIN64 */
static System::TArray__1<System::Byte> __fastcall GetHMACAsBytes(const System::UnicodeString AData, const System::UnicodeString AKey)/* overload */;
static System::TArray__1<System::Byte> __fastcall GetHMACAsBytes(const System::UnicodeString AData, const System::TArray__1<System::Byte> AKey)/* overload */;
static System::TArray__1<System::Byte> __fastcall GetHMACAsBytes(const System::TArray__1<System::Byte> AData, const System::UnicodeString AKey)/* overload */;
static System::TArray__1<System::Byte> __fastcall GetHMACAsBytes(const System::TArray__1<System::Byte> AData, const System::TArray__1<System::Byte> AKey)/* overload */;
#endif /* _WIN64 */
};
Eigenschaften
Typ | Sichtbarkeit | Quelle | Unit | Übergeordnet |
---|---|---|---|---|
record struct |
public | System.Hash.pas System.Hash.hpp |
System.Hash | System.Hash |
Beschreibung
Ein Record, der den SHA-1-Hashtyp implementiert.
THashSHA1 stellt Methoden wie die folgenden bereit:
- Update: Aktualisiert den Hashwert mit den angegebenen Daten.
- GetHashString: Gibt den Hashwert des angegebenen Strings zurück.
- GetHMAC: Gibt eine String-Repräsentation zurück, die der HMAC-Authentifizierung (Hash-Based Message Authentication Code) zugeordnet ist.