-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSCrypt.pas
More file actions
46 lines (33 loc) · 821 Bytes
/
JSCrypt.pas
File metadata and controls
46 lines (33 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
unit JSCrypt;
interface
uses
windows, sysutils, crc32, md5, System.Hash;
function _md5(str: string): string;
function _crc32(str: string): dword;
function GetStrHashSHA1(str: string): string;
function _md5file(filename: string): string;
implementation
function GetStrHashSHA1(str: string): string;
var
HashSHA: THashSHA1;
begin
HashSHA := THashSHA1.Create;
HashSHA.GetHashString(str);
result := HashSHA.GetHashString(str);
end;
function _md5(str: string): string;
begin
result := THashMD5.GetHashString(str);
end;
function _crc32(str: string): dword;
begin
result := CalcStringCRC32(str);
end;
function _md5file(filename: string): string;
var
digest: Tmd5digest;
begin
digest := MD5File(filename);
result := MD5DigestToStr(digest);
end;
end.