System.Hash.THashSHA2

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

THashSHA2 = record

C++

struct DECLSPEC_DRECORD THashSHA2
{
public:
    enum DECLSPEC_DENUM TSHA2Version : unsigned char { SHA224, SHA256, SHA384, SHA512, SHA512_224, SHA512_256 };
private:
    static _DELPHI_CONST System::Int8 CBuffer32Length = System::Int8(0x40);
    static _DELPHI_CONST System::Byte CBuffer64Length = System::Byte(0x80);
    System::StaticArray<System::Byte, 128> FBuffer;
    unsigned __int64 FBitLength;
    unsigned FIndex;
    bool FFinalized;
    void __fastcall Initialize(TSHA2Version AVersion);
    void __fastcall CheckFinalized();
    void __fastcall Compress();
    void __fastcall Compress32();
    void __fastcall Compress64();
    void __fastcall Finalize();
    void __fastcall Finalize32();
    void __fastcall Finalize64();
    System::Sysutils::TBytes __fastcall GetDigest();
    void __fastcall Update(const System::PByte AData, unsigned ALength)/* overload */;
public:
    static THashSHA2 __fastcall Create(TSHA2Version AHashVersion = (TSHA2Version)(0x1));
    void __fastcall Reset();
    void __fastcall Update(const void *AData, unsigned ALength)/* overload */;
    void __fastcall Update(const System::Sysutils::TBytes AData, unsigned ALength = (unsigned)(0x0))/* overload */;
    void __fastcall Update(const System::UnicodeString Input)/* overload */;
    int __fastcall GetBlockSize();
    int __fastcall GetHashSize();
    System::Sysutils::TBytes __fastcall HashAsBytes();
    System::UnicodeString __fastcall HashAsString();
    static System::Sysutils::TBytes __fastcall GetHashBytes(const System::UnicodeString AData, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
    static System::UnicodeString __fastcall GetHashString(const System::UnicodeString AString, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
    static System::Sysutils::TBytes __fastcall GetHashBytes(System::Classes::TStream* const AStream, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
    static System::UnicodeString __fastcall GetHashString(System::Classes::TStream* const AStream, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
    static System::Sysutils::TBytes __fastcall GetHashBytesFromFile(const System::Sysutils::TFileName AFileName, TSHA2Version AHashVersion = (TSHA2Version)(0x1));
    static System::UnicodeString __fastcall GetHashStringFromFile(const System::Sysutils::TFileName AFileName, TSHA2Version AHashVersion = (TSHA2Version)(0x1));
    static System::UnicodeString __fastcall GetHMAC(const System::UnicodeString AData, const System::UnicodeString AKey, TSHA2Version AHashVersion = (TSHA2Version)(0x1));
    static System::Sysutils::TBytes __fastcall GetHMACAsBytes(const System::UnicodeString AData, const System::UnicodeString AKey, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
    static System::Sysutils::TBytes __fastcall GetHMACAsBytes(const System::UnicodeString AData, const System::Sysutils::TBytes AKey, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
    static System::Sysutils::TBytes __fastcall GetHMACAsBytes(const System::Sysutils::TBytes AData, const System::UnicodeString AKey, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
    static System::Sysutils::TBytes __fastcall GetHMACAsBytes(const System::Sysutils::TBytes AData, const System::Sysutils::TBytes AKey, TSHA2Version AHashVersion = (TSHA2Version)(0x1))/* overload */;
private:
    TSHA2Version FVersion;
    union
    {
        struct
        {
            System::StaticArray<unsigned __int64, 8> FHash64;
        };
        struct
        {
            System::StaticArray<unsigned, 8> FHash;
        };
    };
};

Properties

Type Visibility Source Unit Parent
record
struct
public
System.Hash.pas
System.Hash.hpp
System.Hash System.Hash

Description

A record that implements the SHA-2 hash type.

THashSHA2 provides methods such as:

  • Update: Updates the hash value with the provided data.
  • GetHashString: Returns hash value of the provided String.
  • GetHashStringFromFile: Returns hash value of the provided file.
  • GetHMAC: Returns a String representation associated with the HMAC authentication (Hash-based message authentication code).

See Also