Subversion Repositories fastphp

Rev

Rev 67 | Rev 75 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 67 Rev 71
Line 20... Line 20...
20
function FileSystemCaseSensitive: boolean;
20
function FileSystemCaseSensitive: boolean;
21
function HighColorWindows: boolean;
21
function HighColorWindows: boolean;
22
function GetTempDir: string;
22
function GetTempDir: string;
23
function GetSpecialFolder(const aCSIDL: Integer): string;
23
function GetSpecialFolder(const aCSIDL: Integer): string;
24
function GetMyDocumentsFolder: string;
24
function GetMyDocumentsFolder: string;
25
function StrHash(const st:string): cardinal;
25
function md5(value: string): string;
26
 
26
 
27
implementation
27
implementation
28
 
28
 
29
uses
29
uses
30
  ShlObj; // Needed for the CSIDL constants
30
  ShlObj, // Needed for the CSIDL constants
-
 
31
  IdGlobal, IdHash, IdHashMessageDigest; // used for MD5 calculation
31
 
32
 
32
function GetDosOutput(CommandLine: string; Work: string = ''; ContentCallBack: TContentCallBack=nil): string;
33
function GetDosOutput(CommandLine: string; Work: string = ''; ContentCallBack: TContentCallBack=nil): string;
33
var
34
var
34
  SA: TSecurityAttributes;
35
  SA: TSecurityAttributes;
35
  SI: TStartupInfo;
36
  SI: TStartupInfo;
Line 325... Line 326...
325
function GetMyDocumentsFolder: string;
326
function GetMyDocumentsFolder: string;
326
begin
327
begin
327
  Result := GetSpecialFolder(CSIDL_PERSONAL);
328
  Result := GetSpecialFolder(CSIDL_PERSONAL);
328
end;
329
end;
329
 
330
 
330
function StrHash(const st:string): cardinal;
331
function md5(value: string): string;
331
var
332
var
332
  i:integer;
333
  hashMessageDigest5 : TIdHashMessageDigest5;
333
begin
334
begin
334
  // https://stackoverflow.com/a/41400477/488539
335
  hashMessageDigest5 := nil;
335
  result := 0;
336
  try
336
  for i := 1 to length(st) do
337
    hashMessageDigest5 := TIdHashMessageDigest5.Create;
-
 
338
    Result := IdGlobal.IndyLowerCase(hashMessageDigest5.HashStringAsHex(value));
-
 
339
  finally
337
    result := result*$20844 xor byte(st[i]);
340
    hashMessageDigest5.Free;
-
 
341
  end;
338
end;
342
end;
339
 
343
 
340
end.
344
end.