Lazarus Pascal
Lazarus Pascal
Example: Http.DownloadHash method
Demonstrates theDownloadHash method.
Chilkat Lazarus Pascal Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.Http;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
http: THttp;
url: string;
encodedHash: string;
begin
http := THttp.Create;
url := 'https://chilkatdownload.com/11.1.0/chilkat2-python-3.13-x64.zip';
encodedHash := http.DownloadHash(url,'sha256','hex_lower');
if (http.LastMethodSuccess = False) then
begin
WriteLn(http.LastErrorText);
Exit;
end;
// Expected value: 32583182374888c7761e7c15b998fd1d326c439c704d59380d34599f4be9b63a
WriteLn('sha256 = ' + encodedHash);
http.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.