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;

Hash32

function Hash32(S: String; Seed: UInt32 = 0): UInt32;

Hash64

function Hash64(Data: PByte; Len: Int32; Seed: UInt64 = 0): UInt64;

Hash64

function Hash64(S: String; Seed: UInt64 = 0): UInt64;

BaseEncode

function BaseEncode(Encoding: EBaseEncoding; const Data: String): String;

BaseDecode

function BaseDecode(Encoding: EBaseEncoding; const Data: String): String;

HOTPCalculateToken

function HOTPCalculateToken(const Secret: String; const Counter: Integer): Integer;

TOTPCalculateToken

function TOTPCalculateToken(const Secret: String): Integer;

CompressBytes

function CompressBytes(Bytes: TByteArray): TByteArray;

Note

Zlib compression is used.


DecompressBytes

function DecompressBytes(Bytes: TByteArray): TByteArray;

Note

Zlib compression is used.


CompressString

function CompressString(Data: String; Encoding: EBaseEncoding = EBaseEncoding.b64): String;

Note

Zlib compression is used.


DecompressBytes

function DeCompressString(Data: String; Encoding: EBaseEncoding = EBaseEncoding.b64): String;

Note

Zlib compression is used.


FastCompress

function FastCompress(Src: Pointer; Size: Integer; Dest: Pointer): Integer;

FastDecompress

function FastDecompress(Src: Pointer; Size: Integer; Dest: Pointer): Integer;

FastCompressDestLen

function FastCompressDestLen(Len: Integer): Integer;

FastDecompressDestLen

function FastDecompressDestLen(Src: Pointer): Integer;

FastCompressImage

procedure FastCompressImages(Images: TSimbaImageArray; var Data: Pointer; out DataSize: SizeUInt);

FastDecompressImages

function FastDecompressImages(Data: Pointer; DataLen: SizeUInt): TSimbaImageArray;