Encoding¶
Encoding & Hashing
EHashAlgo¶
type EHashAlgo = enum(SHA1, SHA256, SHA384, SHA512, MD5);
Note
This enum is scoped, so must be used like EHashAlgo.SHA512
EBaseEncoding¶
type EBaseEncoding = enum(b64URL, b64, b32, b32Hex, b16);
Note
This enum is scoped, so must be used like EBaseEncoding.b64
HashData¶
function HashData(Algo: EHashAlgo; Buf: PByte; Len: Int32): String;
HashString¶
function HashString(Algo: EHashAlgo; S: String): String;
HashFile¶
function HashFile(Algo: EHashAlgo; FileName: String): String;
Hash32¶
function Hash32(Data: Pointer; Len: Int32; Seed: UInt32 = 0): UInt32;
Computes a UInt32 hash of data using xxhash32 algorithm. https://xxhash.com/
Hash32¶
function Hash32(S: String; Seed: UInt32 = 0): UInt32;
Computes a UInt32 hash of string using xxhash32 algorithm. https://xxhash.com/
BaseEncode¶
function BaseEncode(Encoding: EBaseEncoding; const Data: String): String;
BaseDecode¶
function BaseDecode(Encoding: EBaseEncoding; const Data: String): String;
ECompressAlgo¶
type ECompressAlgo = enum(ZLIB, SYNLZ, GZ);
Note
This enum is scoped, so must be used like ECompressAlgo.ZLIB
CompressData¶
procedure CompressData(Algo: ECompressAlgo; InData: Pointer; InSize: Int64; out OutData: Pointer; out OutSize: Int64);
DecompressData¶
procedure DecompressData(Algo: ECompressAlgo; InData: Pointer; InSize: Int64; out OutData: Pointer; out OutSize: Int64);
CompressBytes¶
function CompressBytes(Algo: ECompressAlgo; Bytes: TByteArray): TByteArray;
DecompressBytes¶
function DecompressBytes(Algo: ECompressAlgo; Bytes: TByteArray): TByteArray;
CompressString¶
function CompressString(Algo: ECompressAlgo; Encoding: EBaseEncoding; Str: String): String;
DecompressString¶
function DecompressString(Algo: ESimbaCompressAlgo; Encoding: EBaseEncoding; Str: String): String;
HOTPCalculateToken¶
function HOTPCalculateToken(const Secret: String; const Counter: Integer): Integer;
function TOTPCalculateToken(const Secret: String): Integer;
HOTP and TOTP One-time password algorithms. Compatible with Google Authenticator.