Sign in Join
Wiki copytemporary

HashLib4Pascal: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

Title: HashLib4Pascal hashlib4pascal

OldNewLine
1-**HashLib4Pascal** is a Delphi/FreePascal compatible library that provides an easy to use interface for computing hashes and checksums of strings (with a specified encoding), files, streams, byte arrays and untyped data to mention but a few. It also supports Incremental Hashing.
2-
3-### Supported Algorithms
4-
5-non-cryptographic 32-bits hash algorithms
6-AP, BKDR, Bernstein, Bernstein1, DEK, DJB, ELF, FNV, FNV1a, JS, Jenkins3, Murmur2, MurmurHash3_x86_32, OneAtTime, PJW, RS, Rotating, SDBM, ShiftAndXor, SuperFast, XXHash32.
7-
8-non-cryptographic 64-bits algorithms
9-FNV, FNV1a, Murmur2_64, SipHash2_4, XXHash64.
10-
11-non-cryptographic 128-bits algorithms
12-MurmurHash3_x86_128, MurmurHash3_x64_128.
13-
14-checksum algorithms
15-Adler32, All CRC Variants from CRC3 to CRC64.
16-
17-cryptographic algorithms
18-GOST, Grindahl, HAS160, Haval, MD2, MD4, MD5, Panama, RadioGatun, RIPEMD, RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320, SHA0, SHA1, SHA2-224, SHA2-256, SHA2-384, SHA2-512, SHA2-512-224, SHA2-512-256, SHA3-224, SHA3-256, SHA3-384, SHA3-512, Keccak-224, Keccak-256, Keccak-288, Keccak-384, Keccak-512, Snefru128, Snefru256, Tiger, Tiger2, WhirlPool, Blake2B, Blake2S, Streebog (GOST3411_2012_256, GOST3411_2012_512), Shake_128, Shake_256.
19-
20-HMAC for any of the above.
21-
22-PBKDF2_HMAC for any of the above.
23-
24-PBKDF_Argon2 (2i, 2d and 2id variants).
25-
26-PBKDF_Scrypt.
27-
28-### Supported Compilers
29-
30-- FreePascal 3.0.0 and above.
31-- Delphi 2010 and above.
32-
33-### Installing the Library
34-
35-- Method one: use the provided packages in the "Packages" folder.
36-- Method two: add the Library path and Sub path to your project Search Path.
37-
38-### Example
39-
40-HashLib4Pascal is not a visual component, so you won't click it off the component list. To add an installed non-visual component to your project, click on menu "Project \> Project inspector ...". In the newly opened window, add a new dependency: "Add \> New requirement" and you select "HashLib4PascalPackage" and click "OK" - now you can close the "Project inspector" window. Then in the "uses" section you need to add the modules needed to generate HMAC:
41-
42-``` pascal
43-uses
44- //...
45- HlpIHashInfo, HlpConverters, HlpHashFactory;
46-```
47-
48-And the code that generates the HMAC looks something like this:
49-
50-``` pascal
51-procedure TForm1.Button1Click(Sender: TObject);
52-var
53- LHMAC: IHMAC;
54- tekst, secret_key, hmac512_value: String;
55-begin
56- tekst := 'test';
57- secret_key := '123';
58- LHMAC := THashFactory.THMAC.CreateHMAC(THashFactory.TCrypto.CreateSHA2_512);
59- LHMAC.Key := TConverters.ConvertStringToBytes(secret_key, TEncoding.UTF8);
60- hmac512_value := LHMAC.ComputeString(tekst, TEncoding.UTF8).ToString();
61- ShowMessage(hmac512_value);
62-end;
63-```
64-
65-### Unit Tests
66-
67-#### For FPC
68-
69-Simply compile and run "HashLib.Tests" project in "FreePascal.Tests" Folder.
70-
71-#### For Delphi
72-
73-Method one, using DUnit Test Runner: to build and run the unit tests for Delphi 10 Seattle (should be similar for other versions)
74-
75-- Open Project Options of Unit Test (HashLib.Tests) in "Delphi.Tests" Folder.
76-- Change Target to All Configurations (Or "Base" In Older Delphi Versions.)
77-- In Output directory add ".\\\$(Platform)\\\$(Config)" without the quotes.
78-- In Search path add "\$(BDS)\Source\DUnit\src" without the quotes.
79-- In Unit output directory add "." without the quotes.
80-- In Unit scope names (If Available), Delete "DUnitX" from the List.
81-
82-Press Ok and save, then build and run.
83-
84-Method two (using TestInsight, preferred).
85-
86-- Download and Install TestInsight.
87-- Open Project Options of Unit Test (HashLib.Tests.TestInsight) in **Delphi.Tests** Folder.
88-- Change Target to All Configurations (Or "Base" In Older Delphi Versions.)
89-- In Unit scope names (If Available), Delete "DUnitX" from the List.
90-- To Use TestInsight, right-click on the project, then select **Enable for TestInsight** or **TestInsight Project**. Save Project then Build and Run Test Project through TestInsight.
91-
92-### License
93-
94-Licensed Under MIT License.
95-
96-### Download
97-
98-- <https://github.com/Xor-el/HashLib4Pascal>
99-
100----
101-*From the Free Pascal wiki, page "HashLib4Pascal", as it stood on 2024-04-16 after a change by Alextp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
102-Category: Libraries
1+#REDIRECT [[HashLib4Pascal]]

Back to history