├── xxHashPascal Normal ├── xxHashNormal.dpr ├── src │ └── Main │ │ ├── xxHash32.pas │ │ └── xxHash64.pas └── xxHashNormal.dproj ├── xxHashPascal ReferenceCounted ├── xxHashPascalReferenceCounted.dpr ├── src │ └── Main │ │ ├── xxHash32.pas │ │ └── xxHash64.pas └── xxHashPascalReferenceCounted.dproj ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── README.md ├── xxHash.Test ├── xxHashTest.dpr ├── src │ ├── xxHash32NormalTest.pas │ └── xxHash64NormalTest.pas └── xxHashTest.dproj └── xxHash.groupproj /xxHashPascal Normal/xxHashNormal.dpr: -------------------------------------------------------------------------------- 1 | program xxHashNormal; 2 | 3 | uses 4 | Vcl.Forms, 5 | xxHash32 in 'src\Main\xxHash32.pas', 6 | xxHash64 in 'src\Main\xxHash64.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.Run; 13 | 14 | end. 15 | -------------------------------------------------------------------------------- /xxHashPascal ReferenceCounted/xxHashPascalReferenceCounted.dpr: -------------------------------------------------------------------------------- 1 | program xxHashPascalReferenceCounted; 2 | 3 | uses 4 | Vcl.Forms, 5 | xxHash32 in 'src\Main\xxHash32.pas', 6 | xxHash64 in 'src\Main\xxHash64.pas'; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.Run; 13 | 14 | end. 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Mmaduekwe Ugochukwu (ugo4brain@gmail.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### Please considering porting over to [HashLib4Pascal](https://github.com/Xor-el/HashLib4Pascal) as XXHash is already implemented there and this repo is no longer maintained. 2 | 3 | #xxHashPascal# 4 | 5 | **This is a Port of [xxHash](https://github.com/Cyan4973/xxHash) to Delphi/Pascal.** 6 | 7 | 8 | #### Building 9 | This project was created using Delphi 10 Seattle Update 1 but should compile in 10 | any Delphi version from XE3 and FreePascal 2.6.4 Upwards. 11 | This Library has two variants (Reference Counted version and Non Reference counted version). 12 | 13 | 14 | * FreePascal Users should disable Range and Overflow Checks.. 15 | 16 | ###Code Examples 17 | 18 | The Unit Tests show examples on how to use both variants. 19 | 20 | ###Unit Tests 21 | 22 | Unit Tests can be found in xxHash.Test Folder. 23 | The unit tests makes use of DUnitX and TestInsight. 24 | 25 | ###License 26 | 27 | This "Software" is Licensed Under **`MIT License (MIT)`** . 28 | 29 | #### Tip Jar 30 | * :dollar: **Bitcoin**: `1MhFfW7tDuEHQSgie65uJcAfJgCNchGeKf` 31 | * :euro: **Ethereum**: `0x6c1DC21aeC49A822A4f1E3bf07c623C2C1978a98` 32 | * :pound: **Pascalcoin**: `345367-40` 33 | 34 | ###Conclusion 35 | 36 | 37 | Special Thanks to [Yann Collet](https://github.com/Cyan4973/) for [this](https://github.com/Cyan4973/xxHash) awesome library. 38 | (Thanks to the developers of [DUnitX Testing Framework](https://github.com/VSoftTechnologies/DUnitX/) and [TestInsight](https://bitbucket.org/sglienke/testinsight/wiki/Home/) for making tools that simplifies unit testing. 39 | -------------------------------------------------------------------------------- /xxHash.Test/xxHashTest.dpr: -------------------------------------------------------------------------------- 1 | program xxHashTest; 2 | 3 | {$IFNDEF TESTINSIGHT} 4 | {$APPTYPE CONSOLE} 5 | {$ENDIF}{$STRONGLINKTYPES ON} 6 | 7 | uses 8 | SysUtils, 9 | {$IFDEF TESTINSIGHT} 10 | TestInsight.DUnitX, 11 | {$ENDIF } 12 | DUnitX.Loggers.Console, 13 | DUnitX.Loggers.Xml.NUnit, 14 | DUnitX.TestFramework, 15 | xxHash32NormalTest in 'src\xxHash32NormalTest.pas', 16 | xxHash64NormalTest in 'src\xxHash64NormalTest.pas', 17 | xxHash32 in '..\xxHashPascal ReferenceCounted\src\Main\xxHash32.pas', 18 | xxHash64 in '..\xxHashPascal ReferenceCounted\src\Main\xxHash64.pas'; 19 | 20 | var 21 | runner: ITestRunner; 22 | results: IRunResults; 23 | logger: ITestLogger; 24 | nunitLogger: ITestLogger; 25 | 26 | begin 27 | {$IFDEF TESTINSIGHT} 28 | TestInsight.DUnitX.RunRegisteredTests; 29 | exit; 30 | {$ENDIF} 31 | try 32 | // Check command line options, will exit if invalid 33 | TDUnitX.CheckCommandLine; 34 | // Create the test runner 35 | runner := TDUnitX.CreateRunner; 36 | // Tell the runner to use RTTI to find Fixtures 37 | runner.UseRTTI := True; 38 | // tell the runner how we will log things 39 | // Log to the console window 40 | logger := TDUnitXConsoleLogger.Create(True); 41 | runner.AddLogger(logger); 42 | // Generate an NUnit compatible XML File 43 | nunitLogger := TDUnitXXMLNUnitFileLogger.Create 44 | (TDUnitX.Options.XMLOutputFile); 45 | runner.AddLogger(nunitLogger); 46 | runner.FailsOnNoAsserts := False; 47 | // When true, Assertions must be made during tests; 48 | 49 | // Run tests 50 | results := runner.Execute; 51 | if not results.AllPassed then 52 | System.ExitCode := EXIT_ERRORS; 53 | 54 | {$IFNDEF CI} 55 | // We don't want this happening when running under CI. 56 | if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then 57 | begin 58 | System.Write('Done.. press key to quit.'); 59 | System.Readln; 60 | end; 61 | {$ENDIF} 62 | except 63 | on E: Exception do 64 | System.Writeln(E.ClassName, ': ', E.Message); 65 | end; 66 | 67 | end. 68 | -------------------------------------------------------------------------------- /xxHash.groupproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | {0D5F2C20-B2CF-4FED-B6EC-70D72CF36EB4} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Default.Personality.12 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 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /xxHash.Test/src/xxHash32NormalTest.pas: -------------------------------------------------------------------------------- 1 | unit xxHash32NormalTest; 2 | 3 | interface 4 | 5 | uses 6 | DUnitX.TestFramework, 7 | System.SysUtils, 8 | System.Classes, 9 | Vcl.Forms, 10 | xxHash32; 11 | 12 | type 13 | 14 | [TestFixture] 15 | TxxHash32NormalTest = class(TObject) 16 | protected Const 17 | DictionaryPath = 'Res\xxHash32_Dict.txt'; 18 | class var FStringList: TStringList; 19 | 20 | public 21 | [Setup] 22 | procedure Setup; 23 | [TearDown] 24 | procedure TearDown; 25 | 26 | (* &&&&&&&&&&&&&&&&&&&&&&& xxHash32 Test &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 27 | 28 | [Test] 29 | procedure xxHashTest32NoRefCountedANSI(); 30 | [Test] 31 | procedure xxHashTest32RefCountedANSI(); 32 | [Test] 33 | procedure xxHash32SimpleANSI(); 34 | [Test] 35 | procedure xxHash32SimpleANSIPointerVersion(); 36 | end; 37 | 38 | implementation 39 | 40 | procedure TxxHash32NormalTest.Setup; 41 | var 42 | ExePath, SubbedPath, FixedPath: String; 43 | begin 44 | ExePath := Application.ExeName; 45 | SubbedPath := ExtractFileDir(ExtractFileDir(ExtractFileDir(ExePath))); 46 | SubbedPath := StringReplace(SubbedPath, 'xxHash.Test', '', [rfReplaceAll]); 47 | FixedPath := SubbedPath + DictionaryPath; 48 | if not FileExists(FixedPath) then 49 | raise Exception.Create('Dictionary File not Found in ' + FixedPath); 50 | FStringList := TStringList.Create; 51 | try 52 | FStringList.LoadFromFile(FixedPath, TEncoding.ANSI); 53 | except 54 | raise Exception.Create('Error Loading Dictionary File'); 55 | end; 56 | end; 57 | 58 | procedure TxxHash32NormalTest.TearDown; 59 | begin 60 | FStringList.Free; 61 | end; 62 | 63 | (* &&&&&&&&&&&&&&&&&&&&&&& xxHash32 Test &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 64 | 65 | procedure TxxHash32NormalTest.xxHashTest32NoRefCountedANSI(); 66 | var 67 | tempByteArray: TArray; 68 | tempStr: String; 69 | hash: TxxHash32; 70 | loopCount: Integer; 71 | tempStrArray: TArray; 72 | tempString: String; 73 | begin 74 | for loopCount := 0 to FStringList.Count - 1 do 75 | begin 76 | tempString := FStringList.Strings[loopCount]; 77 | tempStrArray := tempString.Split([':'], None); 78 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 79 | hash := TxxHash32.Create; 80 | try 81 | hash.Init(); // Initialize with Seed else (0) is used by default 82 | hash.Update(tempByteArray[Low(tempByteArray)], Length(tempByteArray)); 83 | tempStr := UIntToStr(hash.Digest); 84 | finally 85 | hash.Free; 86 | end; 87 | 88 | Assert.AreEqual(tempStr, tempStrArray[1], 89 | Format('Assertion was called with Hash of %s and Plain Value %s', 90 | [tempStrArray[0], tempStrArray[1]])); 91 | end; 92 | end; 93 | 94 | procedure TxxHash32NormalTest.xxHashTest32RefCountedANSI(); 95 | var 96 | tempByteArray: TArray; 97 | tempStr: String; 98 | hash: IIxxHash32; 99 | loopCount: Integer; 100 | tempStrArray: TArray; 101 | tempString: String; 102 | 103 | begin 104 | for loopCount := 0 to FStringList.Count - 1 do 105 | begin 106 | tempString := FStringList.Strings[loopCount]; 107 | tempStrArray := tempString.Split([':'], None); 108 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 109 | hash := TxxHash32.Create; 110 | hash.Init(); // Initialize with Seed else (0) is used by default 111 | hash.Update(tempByteArray[Low(tempByteArray)], Length(tempByteArray)); 112 | tempStr := UIntToStr(hash.Digest); 113 | 114 | Assert.AreEqual(tempStr, tempStrArray[1], 115 | Format('Assertion was called with Hash of %s and Plain Value %s', 116 | [tempStrArray[0], tempStrArray[1]])); 117 | end; 118 | 119 | end; 120 | 121 | procedure TxxHash32NormalTest.xxHash32SimpleANSI(); 122 | var 123 | tempByteArray: TArray; 124 | tempStr: String; 125 | loopCount: Integer; 126 | tempStrArray: TArray; 127 | tempString: String; 128 | begin 129 | for loopCount := 0 to FStringList.Count - 1 do 130 | begin 131 | tempString := FStringList.Strings[loopCount]; 132 | tempStrArray := tempString.Split([':'], None); 133 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 134 | tempStr := UIntToStr(TxxHash32.CalculateHash32(tempByteArray 135 | [Low(tempByteArray)], Length(tempByteArray))); 136 | Assert.AreEqual(tempStr, tempStrArray[1], 137 | Format('Assertion was called with Hash of %s and Plain Value %s', 138 | [tempStrArray[0], tempStrArray[1]])); 139 | end; 140 | end; 141 | 142 | procedure TxxHash32NormalTest.xxHash32SimpleANSIPointerVersion(); 143 | var 144 | tempByteArray: TArray; 145 | tempStr: String; 146 | loopCount: Integer; 147 | tempStrArray: TArray; 148 | tempString: String; 149 | begin 150 | for loopCount := 0 to FStringList.Count - 1 do 151 | begin 152 | tempString := FStringList.Strings[loopCount]; 153 | tempStrArray := tempString.Split([':'], None); 154 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 155 | tempStr := UIntToStr(TxxHash32.CalculateHash32(Pointer(tempByteArray)^, 156 | Length(tempByteArray))); 157 | Assert.AreEqual(tempStr, tempStrArray[1], 158 | Format('Assertion was called with Hash of %s and Plain Value %s', 159 | [tempStrArray[0], tempStrArray[1]])); 160 | end; 161 | end; 162 | 163 | initialization 164 | 165 | TDUnitX.RegisterTestFixture(TxxHash32NormalTest); 166 | 167 | end. 168 | -------------------------------------------------------------------------------- /xxHash.Test/src/xxHash64NormalTest.pas: -------------------------------------------------------------------------------- 1 | unit xxHash64NormalTest; 2 | 3 | interface 4 | 5 | uses 6 | DUnitX.TestFramework, 7 | System.SysUtils, 8 | System.Classes, 9 | Vcl.Forms, 10 | xxHash64; 11 | 12 | type 13 | 14 | [TestFixture] 15 | TxxHash64NormalTest = class(TObject) 16 | protected Const 17 | DictionaryPath = 'Res\xxHash64_Dict.txt'; 18 | class var FStringList: TStringList; 19 | 20 | public 21 | [Setup] 22 | procedure Setup; 23 | [TearDown] 24 | procedure TearDown; 25 | 26 | (* &&&&&&&&&&&&&&&&&&&&&&& xxHash64 Test &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 27 | 28 | [Test] 29 | procedure xxHashTest64NoRefCountedANSI(); 30 | [Test] 31 | procedure xxHashTest64RefCountedANSI(); 32 | [Test] 33 | procedure xxHash64SimpleANSI(); 34 | [Test] 35 | procedure xxHash64SimpleANSIPointerVersion(); 36 | end; 37 | 38 | implementation 39 | 40 | procedure TxxHash64NormalTest.Setup; 41 | var 42 | ExePath, SubbedPath, FixedPath: String; 43 | begin 44 | ExePath := Application.ExeName; 45 | SubbedPath := ExtractFileDir(ExtractFileDir(ExtractFileDir(ExePath))); 46 | SubbedPath := StringReplace(SubbedPath, 'xxHash.Test', '', [rfReplaceAll]); 47 | FixedPath := SubbedPath + DictionaryPath; 48 | if not FileExists(FixedPath) then 49 | raise Exception.Create('Dictionary File not Found in ' + FixedPath); 50 | FStringList := TStringList.Create; 51 | try 52 | FStringList.LoadFromFile(FixedPath, TEncoding.ANSI); 53 | except 54 | raise Exception.Create('Error Loading Dictionary File'); 55 | end; 56 | end; 57 | 58 | procedure TxxHash64NormalTest.TearDown; 59 | begin 60 | FStringList.Free; 61 | end; 62 | 63 | (* &&&&&&&&&&&&&&&&&&&&&&& xxHash64 Test &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) 64 | 65 | procedure TxxHash64NormalTest.xxHashTest64NoRefCountedANSI(); 66 | var 67 | tempByteArray: TArray; 68 | tempStr: String; 69 | hash: TxxHash64; 70 | loopCount: Integer; 71 | tempStrArray: TArray; 72 | tempString: String; 73 | begin 74 | for loopCount := 0 to FStringList.Count - 1 do 75 | begin 76 | tempString := FStringList.Strings[loopCount]; 77 | tempStrArray := tempString.Split([':'], None); 78 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 79 | hash := TxxHash64.Create; 80 | try 81 | hash.Init(); // Initialize with Seed else (0) is used by default 82 | hash.Update(tempByteArray[Low(tempByteArray)], Length(tempByteArray)); 83 | tempStr := UIntToStr(hash.Digest); 84 | finally 85 | hash.Free; 86 | end; 87 | 88 | Assert.AreEqual(tempStr, tempStrArray[1], 89 | Format('Assertion was called with Hash of %s and Plain Value %s', 90 | [tempStrArray[0], tempStrArray[1]])); 91 | end; 92 | end; 93 | 94 | procedure TxxHash64NormalTest.xxHashTest64RefCountedANSI(); 95 | var 96 | tempByteArray: TArray; 97 | tempStr: String; 98 | hash: IIxxHash64; 99 | loopCount: Integer; 100 | tempStrArray: TArray; 101 | tempString: String; 102 | 103 | begin 104 | for loopCount := 0 to FStringList.Count - 1 do 105 | begin 106 | tempString := FStringList.Strings[loopCount]; 107 | tempStrArray := tempString.Split([':'], None); 108 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 109 | hash := TxxHash64.Create; 110 | hash.Init(); // Initialize with Seed else (0) is used by default 111 | hash.Update(tempByteArray[Low(tempByteArray)], Length(tempByteArray)); 112 | tempStr := UIntToStr(hash.Digest); 113 | 114 | Assert.AreEqual(tempStr, tempStrArray[1], 115 | Format('Assertion was called with Hash of %s and Plain Value %s', 116 | [tempStrArray[0], tempStrArray[1]])); 117 | end; 118 | 119 | end; 120 | 121 | procedure TxxHash64NormalTest.xxHash64SimpleANSI(); 122 | var 123 | tempByteArray: TArray; 124 | tempStr: String; 125 | loopCount: Integer; 126 | tempStrArray: TArray; 127 | tempString: String; 128 | begin 129 | for loopCount := 0 to FStringList.Count - 1 do 130 | begin 131 | tempString := FStringList.Strings[loopCount]; 132 | tempStrArray := tempString.Split([':'], None); 133 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 134 | tempStr := UIntToStr(TxxHash64.CalculateHash64(tempByteArray 135 | [Low(tempByteArray)], Length(tempByteArray))); 136 | Assert.AreEqual(tempStr, tempStrArray[1], 137 | Format('Assertion was called with Hash of %s and Plain Value %s', 138 | [tempStrArray[0], tempStrArray[1]])); 139 | end; 140 | end; 141 | 142 | procedure TxxHash64NormalTest.xxHash64SimpleANSIPointerVersion(); 143 | var 144 | tempByteArray: TArray; 145 | tempStr: String; 146 | loopCount: Integer; 147 | tempStrArray: TArray; 148 | tempString: String; 149 | begin 150 | for loopCount := 0 to FStringList.Count - 1 do 151 | begin 152 | tempString := FStringList.Strings[loopCount]; 153 | tempStrArray := tempString.Split([':'], None); 154 | tempByteArray := TEncoding.ANSI.GetBytes(tempStrArray[0]); 155 | tempStr := UIntToStr(TxxHash64.CalculateHash64(Pointer(tempByteArray)^, 156 | Length(tempByteArray))); 157 | Assert.AreEqual(tempStr, tempStrArray[1], 158 | Format('Assertion was called with Hash of %s and Plain Value %s', 159 | [tempStrArray[0], tempStrArray[1]])); 160 | end; 161 | end; 162 | 163 | initialization 164 | 165 | TDUnitX.RegisterTestFixture(TxxHash64NormalTest); 166 | 167 | end. 168 | -------------------------------------------------------------------------------- /xxHashPascal Normal/src/Main/xxHash32.pas: -------------------------------------------------------------------------------- 1 | unit xxHash32; 2 | 3 | 4 | {$POINTERMATH ON} 5 | 6 | {$IFDEF FPC} 7 | {$mode delphi} 8 | {$ENDIF} 9 | 10 | interface 11 | 12 | uses 13 | {$IFDEF FPC} 14 | SysUtils 15 | {$ELSE} 16 | System.SysUtils 17 | {$ENDIF}; 18 | 19 | type 20 | TxxHash32 = class 21 | strict private 22 | 23 | class function RotateLeft32(value: LongWord; count: Integer): LongWord; 24 | static; inline; 25 | 26 | type 27 | 28 | TXXH_State = Record 29 | 30 | private 31 | 32 | total_len: UInt64; 33 | seed: LongWord; 34 | v1: LongWord; 35 | v2: LongWord; 36 | v3: LongWord; 37 | v4: LongWord; 38 | memsize: LongWord; 39 | ptrmemory: Pointer; 40 | 41 | end; 42 | 43 | class var 44 | const 45 | PRIME32_1: LongWord = 2654435761; 46 | PRIME32_2: LongWord = 2246822519; 47 | PRIME32_3: LongWord = 3266489917; 48 | PRIME32_4: LongWord = 668265263; 49 | PRIME32_5: LongWord = 374761393; 50 | 51 | protected 52 | F_state: TXXH_State; 53 | 54 | public 55 | constructor Create(); 56 | destructor Destroy(); Override; 57 | procedure Init(seed: LongWord = 0); 58 | function Update(const input; len: Integer): Boolean; 59 | class function CalculateHash32(const HashData; len: Integer = 0; 60 | seed: LongWord = 0): LongWord; static; 61 | function Digest(): LongWord; 62 | 63 | end; 64 | 65 | implementation 66 | 67 | constructor TxxHash32.Create(); 68 | begin 69 | inherited Create; 70 | 71 | end; 72 | 73 | destructor TxxHash32.Destroy(); 74 | begin 75 | 76 | FreeMem(F_state.ptrmemory, 16); 77 | inherited Destroy; 78 | end; 79 | 80 | procedure TxxHash32.Init(seed: LongWord = 0); 81 | begin 82 | 83 | F_state.seed := seed; 84 | F_state.v1 := seed + PRIME32_1 + PRIME32_2; 85 | F_state.v2 := seed + PRIME32_2; 86 | F_state.v3 := seed + 0; 87 | F_state.v4 := seed - PRIME32_1; 88 | F_state.total_len := 0; 89 | F_state.memsize := 0; 90 | GetMem(F_state.ptrmemory, 16); 91 | 92 | end; 93 | 94 | function TxxHash32.Update(const input; len: Integer): Boolean; 95 | var 96 | v1, v2, v3, v4: LongWord; 97 | ptrBuffer, ptrTemp, ptrEnd, ptrLimit: Pointer; 98 | 99 | begin 100 | 101 | ptrBuffer := @input; 102 | 103 | F_state.total_len := F_state.total_len + UInt64(len); 104 | 105 | if ((F_state.memsize + UInt32(len)) < UInt32(16)) then 106 | begin 107 | 108 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 109 | 110 | Move(ptrBuffer^, ptrTemp^, len); 111 | 112 | F_state.memsize := F_state.memsize + UInt32(len); 113 | 114 | result := True; 115 | Exit; 116 | end; 117 | 118 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + UInt32(len)); 119 | 120 | if F_state.memsize > 0 then 121 | begin 122 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 123 | Move(ptrBuffer^, ptrTemp^, 16 - F_state.memsize); 124 | 125 | F_state.v1 := PRIME32_1 * RotateLeft32(F_state.v1 + PRIME32_2 * 126 | PLongWord(F_state.ptrmemory)^, 13); 127 | F_state.v2 := PRIME32_1 * RotateLeft32(F_state.v2 + PRIME32_2 * 128 | PLongWord(NativeUInt(F_state.ptrmemory) + 4)^, 13); 129 | F_state.v3 := PRIME32_1 * RotateLeft32(F_state.v3 + PRIME32_2 * 130 | PLongWord(NativeUInt(F_state.ptrmemory) + 8)^, 13); 131 | F_state.v4 := PRIME32_1 * RotateLeft32(F_state.v4 + PRIME32_2 * 132 | PLongWord(NativeUInt(F_state.ptrmemory) + 12)^, 13); 133 | 134 | ptrBuffer := Pointer(NativeUInt(ptrBuffer) + (16 - F_state.memsize)); 135 | F_state.memsize := 0; 136 | end; 137 | 138 | if NativeUInt(ptrBuffer) <= (NativeUInt(ptrEnd) - 16) then 139 | begin 140 | v1 := F_state.v1; 141 | v2 := F_state.v2; 142 | v3 := F_state.v3; 143 | v4 := F_state.v4; 144 | 145 | ptrLimit := Pointer(NativeUInt(ptrEnd) - 16); 146 | repeat 147 | v1 := PRIME32_1 * RotateLeft32(v1 + PRIME32_2 * 148 | PLongWord(ptrBuffer)^, 13); 149 | v2 := PRIME32_1 * RotateLeft32(v2 + PRIME32_2 * 150 | PLongWord(NativeUInt(ptrBuffer) + 4)^, 13); 151 | v3 := PRIME32_1 * RotateLeft32(v3 + PRIME32_2 * 152 | PLongWord(NativeUInt(ptrBuffer) + 8)^, 13); 153 | v4 := PRIME32_1 * RotateLeft32(v4 + PRIME32_2 * 154 | PLongWord(NativeUInt(ptrBuffer) + 12)^, 13); 155 | Inc(NativeUInt(ptrBuffer), 16); 156 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 157 | 158 | F_state.v1 := v1; 159 | F_state.v2 := v2; 160 | F_state.v3 := v3; 161 | F_state.v4 := v4; 162 | end; 163 | 164 | if NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) then 165 | begin 166 | ptrTemp := F_state.ptrmemory; 167 | Move(ptrBuffer^, ptrTemp^, NativeUInt(ptrEnd) - NativeUInt(ptrBuffer)); 168 | F_state.memsize := NativeUInt(ptrEnd) - NativeUInt(ptrBuffer); 169 | end; 170 | 171 | result := True; 172 | 173 | end; 174 | 175 | class function TxxHash32.CalculateHash32(const HashData; len: Integer = 0; 176 | seed: LongWord = 0): LongWord; 177 | var 178 | v1, v2, v3, v4: LongWord; 179 | ptrLimit, ptrEnd, ptrBuffer: Pointer; 180 | begin 181 | ptrBuffer := @HashData; 182 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + UInt32(len)); 183 | 184 | if len >= 16 then 185 | begin 186 | ptrLimit := Pointer(NativeUInt(ptrEnd) - 16); 187 | v1 := seed + PRIME32_1 + PRIME32_2; 188 | v2 := seed + PRIME32_2; 189 | v3 := seed; 190 | v4 := seed - PRIME32_1; 191 | 192 | repeat 193 | v1 := PRIME32_1 * RotateLeft32(v1 + PRIME32_2 * 194 | PLongWord(ptrBuffer)^, 13); 195 | v2 := PRIME32_1 * RotateLeft32(v2 + PRIME32_2 * 196 | PLongWord(NativeUInt(ptrBuffer) + 4)^, 13); 197 | v3 := PRIME32_1 * RotateLeft32(v3 + PRIME32_2 * 198 | PLongWord(NativeUInt(ptrBuffer) + 8)^, 13); 199 | v4 := PRIME32_1 * RotateLeft32(v4 + PRIME32_2 * 200 | PLongWord(NativeUInt(ptrBuffer) + 12)^, 13); 201 | Inc(NativeUInt(ptrBuffer), 16); 202 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 203 | 204 | result := RotateLeft32(v1, 1) + RotateLeft32(v2, 7) + RotateLeft32(v3, 12) + 205 | RotateLeft32(v4, 18); 206 | end 207 | else 208 | result := seed + PRIME32_5; 209 | 210 | Inc(result, UInt32(len)); 211 | 212 | while (NativeUInt(ptrBuffer) + 4) <= (NativeUInt(ptrEnd)) do 213 | begin 214 | result := result + PLongWord(ptrBuffer)^ * PRIME32_3; 215 | result := RotateLeft32(result, 17) * PRIME32_4; 216 | Inc(NativeUInt(ptrBuffer), 4); 217 | end; 218 | 219 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 220 | begin 221 | result := result + PByte(ptrBuffer)^ * PRIME32_5; 222 | result := RotateLeft32(result, 11) * PRIME32_1; 223 | Inc(NativeUInt(ptrBuffer)); 224 | end; 225 | 226 | result := result xor (result shr 15); 227 | result := result * PRIME32_2; 228 | result := result xor (result shr 13); 229 | result := result * PRIME32_3; 230 | result := result xor (result shr 16); 231 | end; 232 | 233 | function TxxHash32.Digest: LongWord; 234 | var 235 | ptrBuffer, ptrEnd: Pointer; 236 | begin 237 | if F_state.total_len >= UInt64(16) then 238 | result := RotateLeft32(F_state.v1, 1) + RotateLeft32(F_state.v2, 7) + 239 | RotateLeft32(F_state.v3, 12) + RotateLeft32(F_state.v4, 18) 240 | else 241 | result := F_state.seed + PRIME32_5; 242 | Inc(result, F_state.total_len); 243 | 244 | ptrBuffer := F_state.ptrmemory; 245 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + F_state.memsize); 246 | while (NativeUInt(ptrBuffer) + 4) <= (NativeUInt(ptrEnd)) do 247 | begin 248 | result := result + PLongWord(ptrBuffer)^ * PRIME32_3; 249 | result := RotateLeft32(result, 17) * PRIME32_4; 250 | Inc(NativeUInt(ptrBuffer), 4); 251 | end; 252 | 253 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 254 | begin 255 | result := result + PByte(ptrBuffer)^ * PRIME32_5; 256 | result := RotateLeft32(result, 11) * PRIME32_1; 257 | Inc(NativeUInt(ptrBuffer)); 258 | end; 259 | 260 | result := result xor (result shr 15); 261 | result := result * PRIME32_2; 262 | result := result xor (result shr 13); 263 | result := result * PRIME32_3; 264 | result := result xor (result shr 16); 265 | end; 266 | 267 | class function TxxHash32.RotateLeft32(value: LongWord; count: Integer) 268 | : LongWord; 269 | begin 270 | 271 | result := (value shl count) or (value shr (32 - count)); 272 | 273 | end; 274 | 275 | {$POINTERMATH OFF} 276 | 277 | end. 278 | -------------------------------------------------------------------------------- /xxHashPascal ReferenceCounted/src/Main/xxHash32.pas: -------------------------------------------------------------------------------- 1 | unit xxHash32; 2 | 3 | {$POINTERMATH ON} 4 | {$IFDEF FPC} 5 | {$mode delphi} 6 | {$ENDIF} 7 | 8 | interface 9 | 10 | uses 11 | {$IFDEF FPC} 12 | SysUtils 13 | {$ELSE} 14 | System.SysUtils 15 | {$ENDIF}; 16 | 17 | type 18 | 19 | IIxxHash32 = interface 20 | ['{E3747A4F-7C89-4643-BF4C-EAE1F6E0DA48}'] 21 | 22 | procedure Init(seed: LongWord = 0); 23 | function Update(const input; len: Integer): Boolean; 24 | function Digest(): LongWord; 25 | 26 | end; 27 | 28 | TxxHash32 = class(TInterfacedObject, IIxxHash32) 29 | strict private 30 | 31 | class function RotateLeft32(value: LongWord; count: Integer): LongWord; 32 | static; inline; 33 | 34 | type 35 | 36 | TXXH_State = Record 37 | 38 | private 39 | 40 | total_len: UInt64; 41 | seed: LongWord; 42 | v1: LongWord; 43 | v2: LongWord; 44 | v3: LongWord; 45 | v4: LongWord; 46 | memsize: LongWord; 47 | ptrmemory: Pointer; 48 | 49 | end; 50 | 51 | class var 52 | const 53 | PRIME32_1: LongWord = 2654435761; 54 | PRIME32_2: LongWord = 2246822519; 55 | PRIME32_3: LongWord = 3266489917; 56 | PRIME32_4: LongWord = 668265263; 57 | PRIME32_5: LongWord = 374761393; 58 | 59 | protected 60 | F_state: TXXH_State; 61 | 62 | public 63 | constructor Create(); 64 | destructor Destroy(); Override; 65 | procedure Init(seed: LongWord = 0); 66 | function Update(const input; len: Integer): Boolean; 67 | class function CalculateHash32(const HashData; len: Integer = 0; 68 | seed: LongWord = 0): LongWord; static; 69 | function Digest(): LongWord; 70 | 71 | end; 72 | 73 | implementation 74 | 75 | constructor TxxHash32.Create(); 76 | begin 77 | inherited Create; 78 | 79 | end; 80 | 81 | destructor TxxHash32.Destroy(); 82 | begin 83 | 84 | FreeMem(F_state.ptrmemory, 16); 85 | inherited Destroy; 86 | end; 87 | 88 | procedure TxxHash32.Init(seed: LongWord = 0); 89 | begin 90 | 91 | F_state.seed := seed; 92 | F_state.v1 := seed + PRIME32_1 + PRIME32_2; 93 | F_state.v2 := seed + PRIME32_2; 94 | F_state.v3 := seed + 0; 95 | F_state.v4 := seed - PRIME32_1; 96 | F_state.total_len := 0; 97 | F_state.memsize := 0; 98 | GetMem(F_state.ptrmemory, 16); 99 | 100 | end; 101 | 102 | function TxxHash32.Update(const input; len: Integer): Boolean; 103 | var 104 | v1, v2, v3, v4: LongWord; 105 | ptrBuffer, ptrTemp, ptrEnd, ptrLimit: Pointer; 106 | 107 | begin 108 | 109 | ptrBuffer := @input; 110 | 111 | F_state.total_len := F_state.total_len + UInt64(len); 112 | 113 | if ((F_state.memsize + UInt32(len)) < UInt32(16)) then 114 | begin 115 | 116 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 117 | 118 | Move(ptrBuffer^, ptrTemp^, len); 119 | 120 | F_state.memsize := F_state.memsize + UInt32(len); 121 | 122 | result := True; 123 | Exit; 124 | end; 125 | 126 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + UInt32(len)); 127 | 128 | if F_state.memsize > 0 then 129 | begin 130 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 131 | Move(ptrBuffer^, ptrTemp^, 16 - F_state.memsize); 132 | 133 | F_state.v1 := PRIME32_1 * RotateLeft32(F_state.v1 + PRIME32_2 * 134 | PLongWord(F_state.ptrmemory)^, 13); 135 | F_state.v2 := PRIME32_1 * RotateLeft32(F_state.v2 + PRIME32_2 * 136 | PLongWord(NativeUInt(F_state.ptrmemory) + 4)^, 13); 137 | F_state.v3 := PRIME32_1 * RotateLeft32(F_state.v3 + PRIME32_2 * 138 | PLongWord(NativeUInt(F_state.ptrmemory) + 8)^, 13); 139 | F_state.v4 := PRIME32_1 * RotateLeft32(F_state.v4 + PRIME32_2 * 140 | PLongWord(NativeUInt(F_state.ptrmemory) + 12)^, 13); 141 | 142 | ptrBuffer := Pointer(NativeUInt(ptrBuffer) + (16 - F_state.memsize)); 143 | F_state.memsize := 0; 144 | end; 145 | 146 | if NativeUInt(ptrBuffer) <= (NativeUInt(ptrEnd) - 16) then 147 | begin 148 | v1 := F_state.v1; 149 | v2 := F_state.v2; 150 | v3 := F_state.v3; 151 | v4 := F_state.v4; 152 | 153 | ptrLimit := Pointer(NativeUInt(ptrEnd) - 16); 154 | repeat 155 | v1 := PRIME32_1 * RotateLeft32(v1 + PRIME32_2 * 156 | PLongWord(ptrBuffer)^, 13); 157 | v2 := PRIME32_1 * RotateLeft32(v2 + PRIME32_2 * 158 | PLongWord(NativeUInt(ptrBuffer) + 4)^, 13); 159 | v3 := PRIME32_1 * RotateLeft32(v3 + PRIME32_2 * 160 | PLongWord(NativeUInt(ptrBuffer) + 8)^, 13); 161 | v4 := PRIME32_1 * RotateLeft32(v4 + PRIME32_2 * 162 | PLongWord(NativeUInt(ptrBuffer) + 12)^, 13); 163 | Inc(NativeUInt(ptrBuffer), 16); 164 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 165 | 166 | F_state.v1 := v1; 167 | F_state.v2 := v2; 168 | F_state.v3 := v3; 169 | F_state.v4 := v4; 170 | end; 171 | 172 | if NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) then 173 | begin 174 | ptrTemp := F_state.ptrmemory; 175 | Move(ptrBuffer^, ptrTemp^, NativeUInt(ptrEnd) - NativeUInt(ptrBuffer)); 176 | F_state.memsize := NativeUInt(ptrEnd) - NativeUInt(ptrBuffer); 177 | end; 178 | 179 | result := True; 180 | 181 | end; 182 | 183 | class function TxxHash32.CalculateHash32(const HashData; len: Integer = 0; 184 | seed: LongWord = 0): LongWord; 185 | var 186 | v1, v2, v3, v4: LongWord; 187 | ptrLimit, ptrEnd, ptrBuffer: Pointer; 188 | begin 189 | ptrBuffer := @HashData; 190 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + UInt32(len)); 191 | 192 | if len >= 16 then 193 | begin 194 | ptrLimit := Pointer(NativeUInt(ptrEnd) - 16); 195 | v1 := seed + PRIME32_1 + PRIME32_2; 196 | v2 := seed + PRIME32_2; 197 | v3 := seed; 198 | v4 := seed - PRIME32_1; 199 | 200 | repeat 201 | v1 := PRIME32_1 * RotateLeft32(v1 + PRIME32_2 * 202 | PLongWord(ptrBuffer)^, 13); 203 | v2 := PRIME32_1 * RotateLeft32(v2 + PRIME32_2 * 204 | PLongWord(NativeUInt(ptrBuffer) + 4)^, 13); 205 | v3 := PRIME32_1 * RotateLeft32(v3 + PRIME32_2 * 206 | PLongWord(NativeUInt(ptrBuffer) + 8)^, 13); 207 | v4 := PRIME32_1 * RotateLeft32(v4 + PRIME32_2 * 208 | PLongWord(NativeUInt(ptrBuffer) + 12)^, 13); 209 | Inc(NativeUInt(ptrBuffer), 16); 210 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 211 | 212 | result := RotateLeft32(v1, 1) + RotateLeft32(v2, 7) + RotateLeft32(v3, 12) + 213 | RotateLeft32(v4, 18); 214 | end 215 | else 216 | result := seed + PRIME32_5; 217 | 218 | Inc(result, UInt32(len)); 219 | 220 | while (NativeUInt(ptrBuffer) + 4) <= (NativeUInt(ptrEnd)) do 221 | begin 222 | result := result + PLongWord(ptrBuffer)^ * PRIME32_3; 223 | result := RotateLeft32(result, 17) * PRIME32_4; 224 | Inc(NativeUInt(ptrBuffer), 4); 225 | end; 226 | 227 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 228 | begin 229 | result := result + PByte(ptrBuffer)^ * PRIME32_5; 230 | result := RotateLeft32(result, 11) * PRIME32_1; 231 | Inc(NativeUInt(ptrBuffer)); 232 | end; 233 | 234 | result := result xor (result shr 15); 235 | result := result * PRIME32_2; 236 | result := result xor (result shr 13); 237 | result := result * PRIME32_3; 238 | result := result xor (result shr 16); 239 | end; 240 | 241 | function TxxHash32.Digest: LongWord; 242 | var 243 | ptrBuffer, ptrEnd: Pointer; 244 | begin 245 | if F_state.total_len >= UInt64(16) then 246 | result := RotateLeft32(F_state.v1, 1) + RotateLeft32(F_state.v2, 7) + 247 | RotateLeft32(F_state.v3, 12) + RotateLeft32(F_state.v4, 18) 248 | else 249 | result := F_state.seed + PRIME32_5; 250 | Inc(result, F_state.total_len); 251 | 252 | ptrBuffer := F_state.ptrmemory; 253 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + F_state.memsize); 254 | while (NativeUInt(ptrBuffer) + 4) <= (NativeUInt(ptrEnd)) do 255 | begin 256 | result := result + PLongWord(ptrBuffer)^ * PRIME32_3; 257 | result := RotateLeft32(result, 17) * PRIME32_4; 258 | Inc(NativeUInt(ptrBuffer), 4); 259 | end; 260 | 261 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 262 | begin 263 | result := result + PByte(ptrBuffer)^ * PRIME32_5; 264 | result := RotateLeft32(result, 11) * PRIME32_1; 265 | Inc(NativeUInt(ptrBuffer)); 266 | end; 267 | 268 | result := result xor (result shr 15); 269 | result := result * PRIME32_2; 270 | result := result xor (result shr 13); 271 | result := result * PRIME32_3; 272 | result := result xor (result shr 16); 273 | end; 274 | 275 | class function TxxHash32.RotateLeft32(value: LongWord; count: Integer) 276 | : LongWord; 277 | begin 278 | 279 | result := (value shl count) or (value shr (32 - count)); 280 | 281 | end; 282 | 283 | {$POINTERMATH OFF} 284 | 285 | end. 286 | -------------------------------------------------------------------------------- /xxHashPascal Normal/src/Main/xxHash64.pas: -------------------------------------------------------------------------------- 1 | unit xxHash64; 2 | 3 | {$POINTERMATH ON} 4 | {$IFDEF FPC} 5 | {$mode delphi} 6 | {$ENDIF} 7 | 8 | interface 9 | 10 | uses 11 | {$IFDEF FPC} 12 | SysUtils 13 | {$ELSE} 14 | System.SysUtils 15 | {$ENDIF}; 16 | 17 | type 18 | PUInt64 = ^UInt64; 19 | 20 | TxxHash64 = class 21 | strict private 22 | 23 | class function RotateLeft64(value: UInt64; count: Integer): UInt64; 24 | static; inline; 25 | 26 | type 27 | 28 | TXXH_State = Record 29 | 30 | private 31 | 32 | total_len: UInt64; 33 | seed: UInt64; 34 | v1: UInt64; 35 | v2: UInt64; 36 | v3: UInt64; 37 | v4: UInt64; 38 | memsize: LongWord; 39 | ptrmemory: Pointer; 40 | 41 | end; 42 | 43 | class var 44 | const 45 | PRIME64_1: UInt64 = 11400714785074694791; 46 | PRIME64_2: UInt64 = 14029467366897019727; 47 | PRIME64_3: UInt64 = 1609587929392839161; 48 | PRIME64_4: UInt64 = 9650029242287828579; 49 | PRIME64_5: UInt64 = 2870177450012600261; 50 | 51 | protected 52 | F_state: TXXH_State; 53 | 54 | public 55 | constructor Create(); 56 | destructor Destroy(); Override; 57 | procedure Init(seed: UInt64 = 0); 58 | function Update(const input; len: Integer): Boolean; 59 | class function CalculateHash64(const HashData; len: Integer = 0; 60 | seed: UInt64 = 0): UInt64; static; 61 | function Digest(): UInt64; 62 | 63 | end; 64 | 65 | implementation 66 | 67 | constructor TxxHash64.Create(); 68 | begin 69 | inherited Create; 70 | 71 | end; 72 | 73 | destructor TxxHash64.Destroy(); 74 | begin 75 | 76 | FreeMem(F_state.ptrmemory, 32); 77 | inherited Destroy; 78 | end; 79 | 80 | procedure TxxHash64.Init(seed: UInt64 = 0); 81 | begin 82 | 83 | F_state.seed := seed; 84 | F_state.v1 := seed + PRIME64_1 + PRIME64_2; 85 | F_state.v2 := seed + PRIME64_2; 86 | F_state.v3 := seed + 0; 87 | F_state.v4 := seed - PRIME64_1; 88 | F_state.total_len := 0; 89 | F_state.memsize := 0; 90 | GetMem(F_state.ptrmemory, 32); 91 | 92 | end; 93 | 94 | class function TxxHash64.CalculateHash64(const HashData; len: Integer = 0; 95 | seed: UInt64 = 0): UInt64; 96 | var 97 | v1, v2, v3, v4: UInt64; 98 | ptrLimit, ptrEnd, ptrBuffer: Pointer; 99 | begin 100 | ptrBuffer := @HashData; 101 | 102 | NativeUInt(ptrEnd) := NativeUInt(ptrBuffer) + UInt32(len); 103 | 104 | if len >= 32 then 105 | begin 106 | v1 := seed + PRIME64_1 + PRIME64_2; 107 | v2 := seed + PRIME64_2; 108 | v3 := seed; 109 | v4 := seed - PRIME64_1; 110 | 111 | NativeUInt(ptrLimit) := NativeUInt(ptrEnd) - 32; 112 | repeat 113 | v1 := PRIME64_1 * RotateLeft64(v1 + PRIME64_2 * PUInt64(ptrBuffer)^, 31); 114 | v2 := PRIME64_1 * RotateLeft64(v2 + PRIME64_2 * 115 | PUInt64(NativeUInt(ptrBuffer) + 8)^, 31); 116 | v3 := PRIME64_1 * RotateLeft64(v3 + PRIME64_2 * 117 | PUInt64(NativeUInt(ptrBuffer) + 16)^, 31); 118 | v4 := PRIME64_1 * RotateLeft64(v4 + PRIME64_2 * 119 | PUInt64(NativeUInt(ptrBuffer) + 24)^, 31); 120 | Inc(NativeUInt(ptrBuffer), 32); 121 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 122 | 123 | result := RotateLeft64(v1, 1) + RotateLeft64(v2, 7) + RotateLeft64(v3, 12) + 124 | RotateLeft64(v4, 18); 125 | 126 | v1 := RotateLeft64(v1 * PRIME64_2, 31) * PRIME64_1; 127 | result := (result xor v1) * PRIME64_1 + PRIME64_4; 128 | 129 | v2 := RotateLeft64(v2 * PRIME64_2, 31) * PRIME64_1; 130 | result := (result xor v2) * PRIME64_1 + PRIME64_4; 131 | 132 | v3 := RotateLeft64(v3 * PRIME64_2, 31) * PRIME64_1; 133 | result := (result xor v3) * PRIME64_1 + PRIME64_4; 134 | 135 | v4 := RotateLeft64(v4 * PRIME64_2, 31) * PRIME64_1; 136 | result := (result xor v4) * PRIME64_1 + PRIME64_4; 137 | end 138 | else 139 | result := seed + PRIME64_5; 140 | 141 | Inc(result, UInt64(len)); 142 | 143 | while (NativeUInt(ptrBuffer) + 8) <= (NativeUInt(ptrEnd)) do 144 | begin 145 | result := result xor (PRIME64_1 * RotateLeft64(PRIME64_2 * 146 | PUInt64(ptrBuffer)^, 31)); 147 | result := RotateLeft64(result, 27) * PRIME64_1 + PRIME64_4; 148 | Inc(NativeUInt(ptrBuffer), 8); 149 | end; 150 | 151 | if (NativeUInt(ptrBuffer) + 4) <= NativeUInt(ptrEnd) then 152 | begin 153 | result := result xor (PLongWord(ptrBuffer)^ * PRIME64_1); 154 | result := RotateLeft64(result, 23) * PRIME64_2 + PRIME64_3; 155 | Inc(NativeUInt(ptrBuffer), 4); 156 | end; 157 | 158 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 159 | begin 160 | result := result xor (PByte(ptrBuffer)^ * PRIME64_5); 161 | result := RotateLeft64(result, 11) * PRIME64_1; 162 | Inc(NativeUInt(ptrBuffer)); 163 | end; 164 | 165 | result := result xor (result shr 33); 166 | result := result * PRIME64_2; 167 | result := result xor (result shr 29); 168 | result := result * PRIME64_3; 169 | result := result xor (result shr 32); 170 | end; 171 | 172 | function TxxHash64.Update(const input; len: Integer): Boolean; 173 | var 174 | v1, v2, v3, v4: UInt64; 175 | ptrBuffer, ptrTemp, ptrEnd, ptrLimit: Pointer; 176 | begin 177 | ptrBuffer := @input; 178 | 179 | F_state.total_len := F_state.total_len + UInt64(len); 180 | 181 | if ((F_state.memsize + UInt32(len)) < UInt32(32)) then 182 | begin 183 | 184 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 185 | 186 | Move(ptrBuffer^, ptrTemp^, len); 187 | 188 | F_state.memsize := F_state.memsize + UInt32(len); 189 | 190 | result := True; 191 | Exit; 192 | end; 193 | 194 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + UInt32(len)); 195 | 196 | if F_state.memsize > 0 then 197 | begin 198 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 199 | Move(ptrBuffer^, ptrTemp^, 32 - F_state.memsize); 200 | 201 | F_state.v1 := PRIME64_1 * RotateLeft64(F_state.v1 + PRIME64_2 * 202 | PUInt64(F_state.ptrmemory)^, 31); 203 | F_state.v2 := PRIME64_1 * RotateLeft64(F_state.v2 + PRIME64_2 * 204 | PUInt64(NativeUInt(F_state.ptrmemory) + 8)^, 31); 205 | F_state.v3 := PRIME64_1 * RotateLeft64(F_state.v3 + PRIME64_2 * 206 | PUInt64(NativeUInt(F_state.ptrmemory) + 16)^, 31); 207 | F_state.v4 := PRIME64_1 * RotateLeft64(F_state.v4 + PRIME64_2 * 208 | PUInt64(NativeUInt(F_state.ptrmemory) + 24)^, 31); 209 | 210 | ptrBuffer := Pointer(NativeUInt(ptrBuffer) + (32 - F_state.memsize)); 211 | F_state.memsize := 0; 212 | end; 213 | 214 | if NativeUInt(ptrBuffer) <= (NativeUInt(ptrEnd) - 32) then 215 | begin 216 | v1 := F_state.v1; 217 | v2 := F_state.v2; 218 | v3 := F_state.v3; 219 | v4 := F_state.v4; 220 | 221 | ptrLimit := Pointer(NativeUInt(ptrEnd) - 32); 222 | repeat 223 | v1 := PRIME64_1 * RotateLeft64(v1 + PRIME64_2 * PUInt64(ptrBuffer)^, 31); 224 | v2 := PRIME64_1 * RotateLeft64(v2 + PRIME64_2 * 225 | PUInt64(NativeUInt(ptrBuffer) + 8)^, 31); 226 | v3 := PRIME64_1 * RotateLeft64(v3 + PRIME64_2 * 227 | PUInt64(NativeUInt(ptrBuffer) + 16)^, 31); 228 | v4 := PRIME64_1 * RotateLeft64(v4 + PRIME64_2 * 229 | PUInt64(NativeUInt(ptrBuffer) + 24)^, 31); 230 | Inc(NativeUInt(ptrBuffer), 32); 231 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 232 | 233 | F_state.v1 := v1; 234 | F_state.v2 := v2; 235 | F_state.v3 := v3; 236 | F_state.v4 := v4; 237 | end; 238 | 239 | if NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) then 240 | begin 241 | ptrTemp := F_state.ptrmemory; 242 | Move(ptrBuffer^, ptrTemp^, NativeUInt(ptrEnd) - NativeUInt(ptrBuffer)); 243 | F_state.memsize := NativeUInt(ptrEnd) - NativeUInt(ptrBuffer); 244 | end; 245 | 246 | result := True; 247 | end; 248 | 249 | function TxxHash64.Digest: UInt64; 250 | var 251 | v1, v2, v3, v4: UInt64; 252 | ptrBuffer, ptrEnd: Pointer; 253 | 254 | begin 255 | if F_state.total_len >= UInt64(32) then 256 | begin 257 | v1 := F_state.v1; 258 | v2 := F_state.v2; 259 | v3 := F_state.v3; 260 | v4 := F_state.v4; 261 | 262 | result := RotateLeft64(v1, 1) + RotateLeft64(v2, 7) + RotateLeft64(v3, 12) + 263 | RotateLeft64(v4, 18); 264 | 265 | v1 := RotateLeft64(v1 * PRIME64_2, 31) * PRIME64_1; 266 | result := (result xor v1) * PRIME64_1 + PRIME64_4; 267 | 268 | v2 := RotateLeft64(v2 * PRIME64_2, 31) * PRIME64_1; 269 | result := (result xor v2) * PRIME64_1 + PRIME64_4; 270 | 271 | v3 := RotateLeft64(v3 * PRIME64_2, 31) * PRIME64_1; 272 | result := (result xor v3) * PRIME64_1 + PRIME64_4; 273 | 274 | v4 := RotateLeft64(v4 * PRIME64_2, 31) * PRIME64_1; 275 | result := (result xor v4) * PRIME64_1 + PRIME64_4; 276 | end 277 | else 278 | result := F_state.seed + PRIME64_5; 279 | 280 | Inc(result, F_state.total_len); 281 | 282 | ptrBuffer := F_state.ptrmemory; 283 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + F_state.memsize); 284 | 285 | while (NativeUInt(ptrBuffer) + 8) <= NativeUInt(ptrEnd) do 286 | begin 287 | result := result xor (PRIME64_1 * RotateLeft64(PRIME64_2 * 288 | PUInt64(ptrBuffer)^, 31)); 289 | result := RotateLeft64(result, 27) * PRIME64_1 + PRIME64_4; 290 | Inc(NativeUInt(ptrBuffer), 8); 291 | end; 292 | 293 | if (NativeUInt(ptrBuffer) + 4) <= NativeUInt(ptrEnd) then 294 | begin 295 | result := result xor PLongWord(ptrBuffer)^ * PRIME64_1; 296 | result := RotateLeft64(result, 23) * PRIME64_2 + PRIME64_3; 297 | Inc(NativeUInt(ptrBuffer), 4); 298 | end; 299 | 300 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 301 | begin 302 | result := result xor (PByte(ptrBuffer)^ * PRIME64_5); 303 | result := RotateLeft64(result, 11) * PRIME64_1; 304 | Inc(NativeUInt(ptrBuffer)); 305 | end; 306 | 307 | result := result xor (result shr 33); 308 | result := result * PRIME64_2; 309 | result := result xor (result shr 29); 310 | result := result * PRIME64_3; 311 | result := result xor (result shr 32); 312 | end; 313 | 314 | class function TxxHash64.RotateLeft64(value: UInt64; count: Integer): UInt64; 315 | begin 316 | 317 | result := (value shl count) or (value shr (64 - count)); 318 | 319 | end; 320 | 321 | {$POINTERMATH OFF} 322 | 323 | end. 324 | -------------------------------------------------------------------------------- /xxHashPascal ReferenceCounted/src/Main/xxHash64.pas: -------------------------------------------------------------------------------- 1 | unit xxHash64; 2 | 3 | {$POINTERMATH ON} 4 | {$IFDEF FPC} 5 | {$mode delphi} 6 | {$ENDIF} 7 | 8 | interface 9 | 10 | uses 11 | {$IFDEF FPC} 12 | SysUtils 13 | {$ELSE} 14 | System.SysUtils 15 | {$ENDIF}; 16 | 17 | type 18 | 19 | PUInt64 = ^UInt64; 20 | 21 | IIxxHash64 = interface 22 | ['{3AE40E4C-5259-451D-B57F-2B27202EFB8A}'] 23 | 24 | procedure Init(seed: UInt64 = 0); 25 | function Update(const input; len: Integer): Boolean; 26 | function Digest(): UInt64; 27 | 28 | end; 29 | 30 | TxxHash64 = class(TInterfacedObject, IIxxHash64) 31 | strict private 32 | 33 | class function RotateLeft64(value: UInt64; count: Integer): UInt64; 34 | static; inline; 35 | 36 | type 37 | 38 | TXXH_State = Record 39 | 40 | private 41 | 42 | total_len: UInt64; 43 | seed: UInt64; 44 | v1: UInt64; 45 | v2: UInt64; 46 | v3: UInt64; 47 | v4: UInt64; 48 | memsize: LongWord; 49 | ptrmemory: Pointer; 50 | 51 | end; 52 | 53 | class var 54 | const 55 | PRIME64_1: UInt64 = 11400714785074694791; 56 | PRIME64_2: UInt64 = 14029467366897019727; 57 | PRIME64_3: UInt64 = 1609587929392839161; 58 | PRIME64_4: UInt64 = 9650029242287828579; 59 | PRIME64_5: UInt64 = 2870177450012600261; 60 | 61 | protected 62 | F_state: TXXH_State; 63 | 64 | public 65 | constructor Create(); 66 | destructor Destroy(); Override; 67 | procedure Init(seed: UInt64 = 0); 68 | function Update(const input; len: Integer): Boolean; 69 | class function CalculateHash64(const HashData; len: Integer = 0; 70 | seed: UInt64 = 0): UInt64; static; 71 | function Digest(): UInt64; 72 | 73 | end; 74 | 75 | implementation 76 | 77 | constructor TxxHash64.Create(); 78 | begin 79 | inherited Create; 80 | 81 | end; 82 | 83 | destructor TxxHash64.Destroy(); 84 | begin 85 | 86 | FreeMem(F_state.ptrmemory, 32); 87 | inherited Destroy; 88 | end; 89 | 90 | procedure TxxHash64.Init(seed: UInt64 = 0); 91 | begin 92 | 93 | F_state.seed := seed; 94 | F_state.v1 := seed + PRIME64_1 + PRIME64_2; 95 | F_state.v2 := seed + PRIME64_2; 96 | F_state.v3 := seed + 0; 97 | F_state.v4 := seed - PRIME64_1; 98 | F_state.total_len := 0; 99 | F_state.memsize := 0; 100 | GetMem(F_state.ptrmemory, 32); 101 | 102 | end; 103 | 104 | class function TxxHash64.CalculateHash64(const HashData; len: Integer = 0; 105 | seed: UInt64 = 0): UInt64; 106 | var 107 | v1, v2, v3, v4: UInt64; 108 | ptrLimit, ptrEnd, ptrBuffer: Pointer; 109 | begin 110 | ptrBuffer := @HashData; 111 | 112 | NativeUInt(ptrEnd) := NativeUInt(ptrBuffer) + UInt32(len); 113 | 114 | if len >= 32 then 115 | begin 116 | v1 := seed + PRIME64_1 + PRIME64_2; 117 | v2 := seed + PRIME64_2; 118 | v3 := seed; 119 | v4 := seed - PRIME64_1; 120 | 121 | NativeUInt(ptrLimit) := NativeUInt(ptrEnd) - 32; 122 | repeat 123 | v1 := PRIME64_1 * RotateLeft64(v1 + PRIME64_2 * PUInt64(ptrBuffer)^, 31); 124 | v2 := PRIME64_1 * RotateLeft64(v2 + PRIME64_2 * 125 | PUInt64(NativeUInt(ptrBuffer) + 8)^, 31); 126 | v3 := PRIME64_1 * RotateLeft64(v3 + PRIME64_2 * 127 | PUInt64(NativeUInt(ptrBuffer) + 16)^, 31); 128 | v4 := PRIME64_1 * RotateLeft64(v4 + PRIME64_2 * 129 | PUInt64(NativeUInt(ptrBuffer) + 24)^, 31); 130 | Inc(NativeUInt(ptrBuffer), 32); 131 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 132 | 133 | result := RotateLeft64(v1, 1) + RotateLeft64(v2, 7) + RotateLeft64(v3, 12) + 134 | RotateLeft64(v4, 18); 135 | 136 | v1 := RotateLeft64(v1 * PRIME64_2, 31) * PRIME64_1; 137 | result := (result xor v1) * PRIME64_1 + PRIME64_4; 138 | 139 | v2 := RotateLeft64(v2 * PRIME64_2, 31) * PRIME64_1; 140 | result := (result xor v2) * PRIME64_1 + PRIME64_4; 141 | 142 | v3 := RotateLeft64(v3 * PRIME64_2, 31) * PRIME64_1; 143 | result := (result xor v3) * PRIME64_1 + PRIME64_4; 144 | 145 | v4 := RotateLeft64(v4 * PRIME64_2, 31) * PRIME64_1; 146 | result := (result xor v4) * PRIME64_1 + PRIME64_4; 147 | end 148 | else 149 | result := seed + PRIME64_5; 150 | 151 | Inc(result, UInt64(len)); 152 | 153 | while (NativeUInt(ptrBuffer) + 8) <= (NativeUInt(ptrEnd)) do 154 | begin 155 | result := result xor (PRIME64_1 * RotateLeft64(PRIME64_2 * 156 | PUInt64(ptrBuffer)^, 31)); 157 | result := RotateLeft64(result, 27) * PRIME64_1 + PRIME64_4; 158 | Inc(NativeUInt(ptrBuffer), 8); 159 | end; 160 | 161 | if (NativeUInt(ptrBuffer) + 4) <= NativeUInt(ptrEnd) then 162 | begin 163 | result := result xor (PLongWord(ptrBuffer)^ * PRIME64_1); 164 | result := RotateLeft64(result, 23) * PRIME64_2 + PRIME64_3; 165 | Inc(NativeUInt(ptrBuffer), 4); 166 | end; 167 | 168 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 169 | begin 170 | result := result xor (PByte(ptrBuffer)^ * PRIME64_5); 171 | result := RotateLeft64(result, 11) * PRIME64_1; 172 | Inc(NativeUInt(ptrBuffer)); 173 | end; 174 | 175 | result := result xor (result shr 33); 176 | result := result * PRIME64_2; 177 | result := result xor (result shr 29); 178 | result := result * PRIME64_3; 179 | result := result xor (result shr 32); 180 | end; 181 | 182 | function TxxHash64.Update(const input; len: Integer): Boolean; 183 | var 184 | v1, v2, v3, v4: UInt64; 185 | ptrBuffer, ptrTemp, ptrEnd, ptrLimit: Pointer; 186 | begin 187 | ptrBuffer := @input; 188 | 189 | F_state.total_len := F_state.total_len + UInt64(len); 190 | 191 | if ((F_state.memsize + UInt32(len)) < UInt32(32)) then 192 | begin 193 | 194 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 195 | 196 | Move(ptrBuffer^, ptrTemp^, len); 197 | 198 | F_state.memsize := F_state.memsize + UInt32(len); 199 | 200 | result := True; 201 | Exit; 202 | end; 203 | 204 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + UInt32(len)); 205 | 206 | if F_state.memsize > 0 then 207 | begin 208 | ptrTemp := Pointer(NativeUInt(F_state.ptrmemory) + F_state.memsize); 209 | Move(ptrBuffer^, ptrTemp^, 32 - F_state.memsize); 210 | 211 | F_state.v1 := PRIME64_1 * RotateLeft64(F_state.v1 + PRIME64_2 * 212 | PUInt64(F_state.ptrmemory)^, 31); 213 | F_state.v2 := PRIME64_1 * RotateLeft64(F_state.v2 + PRIME64_2 * 214 | PUInt64(NativeUInt(F_state.ptrmemory) + 8)^, 31); 215 | F_state.v3 := PRIME64_1 * RotateLeft64(F_state.v3 + PRIME64_2 * 216 | PUInt64(NativeUInt(F_state.ptrmemory) + 16)^, 31); 217 | F_state.v4 := PRIME64_1 * RotateLeft64(F_state.v4 + PRIME64_2 * 218 | PUInt64(NativeUInt(F_state.ptrmemory) + 24)^, 31); 219 | 220 | ptrBuffer := Pointer(NativeUInt(ptrBuffer) + (32 - F_state.memsize)); 221 | F_state.memsize := 0; 222 | end; 223 | 224 | if NativeUInt(ptrBuffer) <= (NativeUInt(ptrEnd) - 32) then 225 | begin 226 | v1 := F_state.v1; 227 | v2 := F_state.v2; 228 | v3 := F_state.v3; 229 | v4 := F_state.v4; 230 | 231 | ptrLimit := Pointer(NativeUInt(ptrEnd) - 32); 232 | repeat 233 | v1 := PRIME64_1 * RotateLeft64(v1 + PRIME64_2 * PUInt64(ptrBuffer)^, 31); 234 | v2 := PRIME64_1 * RotateLeft64(v2 + PRIME64_2 * 235 | PUInt64(NativeUInt(ptrBuffer) + 8)^, 31); 236 | v3 := PRIME64_1 * RotateLeft64(v3 + PRIME64_2 * 237 | PUInt64(NativeUInt(ptrBuffer) + 16)^, 31); 238 | v4 := PRIME64_1 * RotateLeft64(v4 + PRIME64_2 * 239 | PUInt64(NativeUInt(ptrBuffer) + 24)^, 31); 240 | Inc(NativeUInt(ptrBuffer), 32); 241 | until not(NativeUInt(ptrBuffer) <= NativeUInt(ptrLimit)); 242 | 243 | F_state.v1 := v1; 244 | F_state.v2 := v2; 245 | F_state.v3 := v3; 246 | F_state.v4 := v4; 247 | end; 248 | 249 | if NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) then 250 | begin 251 | ptrTemp := F_state.ptrmemory; 252 | Move(ptrBuffer^, ptrTemp^, NativeUInt(ptrEnd) - NativeUInt(ptrBuffer)); 253 | F_state.memsize := NativeUInt(ptrEnd) - NativeUInt(ptrBuffer); 254 | end; 255 | 256 | result := True; 257 | end; 258 | 259 | function TxxHash64.Digest: UInt64; 260 | var 261 | v1, v2, v3, v4: UInt64; 262 | ptrBuffer, ptrEnd: Pointer; 263 | 264 | begin 265 | if F_state.total_len >= UInt64(32) then 266 | begin 267 | v1 := F_state.v1; 268 | v2 := F_state.v2; 269 | v3 := F_state.v3; 270 | v4 := F_state.v4; 271 | 272 | result := RotateLeft64(v1, 1) + RotateLeft64(v2, 7) + RotateLeft64(v3, 12) + 273 | RotateLeft64(v4, 18); 274 | 275 | v1 := RotateLeft64(v1 * PRIME64_2, 31) * PRIME64_1; 276 | result := (result xor v1) * PRIME64_1 + PRIME64_4; 277 | 278 | v2 := RotateLeft64(v2 * PRIME64_2, 31) * PRIME64_1; 279 | result := (result xor v2) * PRIME64_1 + PRIME64_4; 280 | 281 | v3 := RotateLeft64(v3 * PRIME64_2, 31) * PRIME64_1; 282 | result := (result xor v3) * PRIME64_1 + PRIME64_4; 283 | 284 | v4 := RotateLeft64(v4 * PRIME64_2, 31) * PRIME64_1; 285 | result := (result xor v4) * PRIME64_1 + PRIME64_4; 286 | end 287 | else 288 | result := F_state.seed + PRIME64_5; 289 | 290 | Inc(result, F_state.total_len); 291 | 292 | ptrBuffer := F_state.ptrmemory; 293 | ptrEnd := Pointer(NativeUInt(ptrBuffer) + F_state.memsize); 294 | 295 | while (NativeUInt(ptrBuffer) + 8) <= NativeUInt(ptrEnd) do 296 | begin 297 | result := result xor (PRIME64_1 * RotateLeft64(PRIME64_2 * 298 | PUInt64(ptrBuffer)^, 31)); 299 | result := RotateLeft64(result, 27) * PRIME64_1 + PRIME64_4; 300 | Inc(NativeUInt(ptrBuffer), 8); 301 | end; 302 | 303 | if (NativeUInt(ptrBuffer) + 4) <= NativeUInt(ptrEnd) then 304 | begin 305 | result := result xor PLongWord(ptrBuffer)^ * PRIME64_1; 306 | result := RotateLeft64(result, 23) * PRIME64_2 + PRIME64_3; 307 | Inc(NativeUInt(ptrBuffer), 4); 308 | end; 309 | 310 | while NativeUInt(ptrBuffer) < NativeUInt(ptrEnd) do 311 | begin 312 | result := result xor (PByte(ptrBuffer)^ * PRIME64_5); 313 | result := RotateLeft64(result, 11) * PRIME64_1; 314 | Inc(NativeUInt(ptrBuffer)); 315 | end; 316 | 317 | result := result xor (result shr 33); 318 | result := result * PRIME64_2; 319 | result := result xor (result shr 29); 320 | result := result * PRIME64_3; 321 | result := result xor (result shr 32); 322 | end; 323 | 324 | class function TxxHash64.RotateLeft64(value: UInt64; count: Integer): UInt64; 325 | begin 326 | 327 | result := (value shl count) or (value shr (64 - count)); 328 | 329 | end; 330 | 331 | {$POINTERMATH OFF} 332 | 333 | end. 334 | -------------------------------------------------------------------------------- /xxHash.Test/xxHashTest.dproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | {2C999141-6637-4B61-BE27-CF3C7904BE88} 4 | 18.1 5 | xxHashTest.dpr 6 | True 7 | Release 8 | Win32 9 | 1 10 | Console 11 | VCL 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Cfg_1 34 | true 35 | true 36 | 37 | 38 | true 39 | Base 40 | true 41 | 42 | 43 | true 44 | Cfg_2 45 | true 46 | true 47 | 48 | 49 | true 50 | Cfg_2 51 | true 52 | true 53 | 54 | 55 | TESTINSIGHT;$(DCC_Define) 56 | $(BDS)\bin\delphi_PROJECTICNS.icns 57 | xxHashTest 58 | true 59 | $(DUnitX);$(DCC_UnitSearchPath) 60 | $(BDS)\bin\delphi_PROJECTICON.ico 61 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) 62 | .\$(Platform)\$(Config) 63 | .\$(Platform)\$(Config) 64 | false 65 | false 66 | false 67 | false 68 | false 69 | 70 | 71 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 72 | 1033 73 | DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;skinpackd10Seattle;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;bsfd10Seattle;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) 74 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 75 | 76 | 77 | 1033 78 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) 79 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 80 | DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) 81 | 82 | 83 | DEBUG;$(DCC_Define) 84 | true 85 | false 86 | true 87 | true 88 | true 89 | 90 | 91 | 3 92 | false 93 | 94 | 95 | false 96 | RELEASE;$(DCC_Define) 97 | 0 98 | 0 99 | 100 | 101 | 2 102 | 3 103 | true 104 | 105 | 106 | true 107 | 2 108 | 3 109 | madExcept;LeakChecking;$(DCC_Define) 110 | 111 | 112 | 113 | MainSource 114 | 115 | 116 | 117 | 118 | 119 | 120 | Cfg_2 121 | Base 122 | 123 | 124 | Base 125 | 126 | 127 | Cfg_1 128 | Base 129 | 130 | 131 | 132 | Delphi.Personality.12 133 | Console 134 | 135 | 136 | 137 | xxHashTest.dpr 138 | 139 | 140 | 141 | 142 | 143 | true 144 | 145 | 146 | 147 | 148 | true 149 | 150 | 151 | 152 | 153 | true 154 | 155 | 156 | 157 | 158 | xxHashTest.exe 159 | true 160 | 161 | 162 | 163 | 164 | xxHashTest.exe 165 | true 166 | 167 | 168 | 169 | 170 | 171 | Contents\Resources 172 | 1 173 | 174 | 175 | 176 | 177 | classes 178 | 1 179 | 180 | 181 | 182 | 183 | Contents\MacOS 184 | 0 185 | 186 | 187 | 1 188 | 189 | 190 | 191 | 192 | 1 193 | 194 | 195 | 1 196 | 197 | 198 | 1 199 | 200 | 201 | 202 | 203 | res\drawable-xxhdpi 204 | 1 205 | 206 | 207 | 208 | 209 | library\lib\mips 210 | 1 211 | 212 | 213 | 214 | 215 | 0 216 | 217 | 218 | 1 219 | 220 | 221 | 1 222 | 223 | 224 | 1 225 | 226 | 227 | library\lib\armeabi-v7a 228 | 1 229 | 230 | 231 | 1 232 | 233 | 234 | 235 | 236 | 0 237 | 238 | 239 | 1 240 | .framework 241 | 242 | 243 | 244 | 245 | 1 246 | 247 | 248 | 1 249 | 250 | 251 | 1 252 | 253 | 254 | 255 | 256 | 1 257 | 258 | 259 | 1 260 | 261 | 262 | 1 263 | 264 | 265 | 266 | 267 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 268 | 1 269 | 270 | 271 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 272 | 1 273 | 274 | 275 | 276 | 277 | library\lib\x86 278 | 1 279 | 280 | 281 | 282 | 283 | 1 284 | 285 | 286 | 1 287 | 288 | 289 | 1 290 | 291 | 292 | 293 | 294 | 295 | library\lib\armeabi 296 | 1 297 | 298 | 299 | 300 | 301 | 0 302 | 303 | 304 | 1 305 | 306 | 307 | 1 308 | 309 | 310 | 311 | 312 | 1 313 | 314 | 315 | 1 316 | 317 | 318 | 1 319 | 320 | 321 | 322 | 323 | res\drawable-normal 324 | 1 325 | 326 | 327 | 328 | 329 | res\drawable-xhdpi 330 | 1 331 | 332 | 333 | 334 | 335 | res\drawable-large 336 | 1 337 | 338 | 339 | 340 | 341 | 1 342 | 343 | 344 | 1 345 | 346 | 347 | 1 348 | 349 | 350 | 351 | 352 | 353 | res\drawable-hdpi 354 | 1 355 | 356 | 357 | 358 | 359 | library\lib\armeabi-v7a 360 | 1 361 | 362 | 363 | 364 | 365 | 366 | 367 | 1 368 | 369 | 370 | 1 371 | 372 | 373 | 1 374 | 375 | 376 | 377 | 378 | res\values 379 | 1 380 | 381 | 382 | 383 | 384 | res\drawable-small 385 | 1 386 | 387 | 388 | 389 | 390 | res\drawable 391 | 1 392 | 393 | 394 | 395 | 396 | 1 397 | 398 | 399 | 1 400 | 401 | 402 | 1 403 | 404 | 405 | 406 | 407 | 1 408 | 409 | 410 | 411 | 412 | res\drawable 413 | 1 414 | 415 | 416 | 417 | 418 | 0 419 | 420 | 421 | 0 422 | 423 | 424 | 0 425 | 426 | 427 | 0 428 | 429 | 430 | 0 431 | 432 | 433 | 0 434 | 435 | 436 | 437 | 438 | library\lib\armeabi-v7a 439 | 1 440 | 441 | 442 | 443 | 444 | 0 445 | .bpl 446 | 447 | 448 | 1 449 | .dylib 450 | 451 | 452 | 1 453 | .dylib 454 | 455 | 456 | 1 457 | .dylib 458 | 459 | 460 | 1 461 | .dylib 462 | 463 | 464 | 465 | 466 | res\drawable-mdpi 467 | 1 468 | 469 | 470 | 471 | 472 | res\drawable-xlarge 473 | 1 474 | 475 | 476 | 477 | 478 | res\drawable-ldpi 479 | 1 480 | 481 | 482 | 483 | 484 | 0 485 | .dll;.bpl 486 | 487 | 488 | 1 489 | .dylib 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | True 502 | False 503 | 504 | 505 | 12 506 | 507 | 508 | 509 | 510 | 511 | -------------------------------------------------------------------------------- /xxHashPascal Normal/xxHashNormal.dproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | {B2AE708E-471F-474B-9912-FE2E0B4410AF} 4 | 18.1 5 | VCL 6 | xxHashNormal.dpr 7 | True 8 | Release 9 | Win32 10 | 1 11 | Application 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Cfg_1 34 | true 35 | true 36 | 37 | 38 | true 39 | Base 40 | true 41 | 42 | 43 | true 44 | Cfg_2 45 | true 46 | true 47 | 48 | 49 | xxHashNormal 50 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) 51 | $(BDS)\bin\delphi_PROJECTICON.ico 52 | .\$(Platform)\$(Config) 53 | .\$(Platform)\$(Config) 54 | false 55 | false 56 | false 57 | false 58 | false 59 | 60 | 61 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 62 | 1033 63 | true 64 | DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;skinpackd10Seattle;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;bsfd10Seattle;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) 65 | $(BDS)\bin\default_app.manifest 66 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 67 | 68 | 69 | DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) 70 | 71 | 72 | DEBUG;$(DCC_Define) 73 | true 74 | false 75 | true 76 | true 77 | true 78 | 79 | 80 | true 81 | true 82 | false 83 | 84 | 85 | false 86 | RELEASE;$(DCC_Define) 87 | 0 88 | 0 89 | 90 | 91 | true 92 | true 93 | 94 | 95 | 96 | MainSource 97 | 98 | 99 | 100 | 101 | Cfg_2 102 | Base 103 | 104 | 105 | Base 106 | 107 | 108 | Cfg_1 109 | Base 110 | 111 | 112 | 113 | Delphi.Personality.12 114 | Application 115 | 116 | 117 | 118 | xxHashNormal.dpr 119 | 120 | 121 | 122 | 123 | 124 | xxHashNormal.exe 125 | true 126 | 127 | 128 | 129 | 130 | xxHashNormal.exe 131 | true 132 | 133 | 134 | 135 | 136 | 0 137 | .dll;.bpl 138 | 139 | 140 | 1 141 | .dylib 142 | 143 | 144 | Contents\MacOS 145 | 1 146 | .dylib 147 | 148 | 149 | 1 150 | .dylib 151 | 152 | 153 | 1 154 | .dylib 155 | 156 | 157 | 158 | 159 | Contents\Resources 160 | 1 161 | 162 | 163 | 164 | 165 | classes 166 | 1 167 | 168 | 169 | 170 | 171 | Contents\MacOS 172 | 0 173 | 174 | 175 | 1 176 | 177 | 178 | Contents\MacOS 179 | 1 180 | 181 | 182 | 183 | 184 | 1 185 | 186 | 187 | 1 188 | 189 | 190 | 1 191 | 192 | 193 | 194 | 195 | res\drawable-xxhdpi 196 | 1 197 | 198 | 199 | 200 | 201 | library\lib\mips 202 | 1 203 | 204 | 205 | 206 | 207 | 0 208 | 209 | 210 | 1 211 | 212 | 213 | Contents\MacOS 214 | 1 215 | 216 | 217 | 1 218 | 219 | 220 | library\lib\armeabi-v7a 221 | 1 222 | 223 | 224 | 1 225 | 226 | 227 | 228 | 229 | 0 230 | 231 | 232 | Contents\MacOS 233 | 1 234 | .framework 235 | 236 | 237 | 238 | 239 | 1 240 | 241 | 242 | 1 243 | 244 | 245 | 1 246 | 247 | 248 | 249 | 250 | 1 251 | 252 | 253 | 1 254 | 255 | 256 | 1 257 | 258 | 259 | 260 | 261 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 262 | 1 263 | 264 | 265 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 266 | 1 267 | 268 | 269 | 270 | 271 | library\lib\x86 272 | 1 273 | 274 | 275 | 276 | 277 | 1 278 | 279 | 280 | 1 281 | 282 | 283 | 1 284 | 285 | 286 | 287 | 288 | 1 289 | 290 | 291 | 1 292 | 293 | 294 | 1 295 | 296 | 297 | 298 | 299 | library\lib\armeabi 300 | 1 301 | 302 | 303 | 304 | 305 | 0 306 | 307 | 308 | 1 309 | 310 | 311 | Contents\MacOS 312 | 1 313 | 314 | 315 | 316 | 317 | 1 318 | 319 | 320 | 1 321 | 322 | 323 | 1 324 | 325 | 326 | 327 | 328 | res\drawable-normal 329 | 1 330 | 331 | 332 | 333 | 334 | res\drawable-xhdpi 335 | 1 336 | 337 | 338 | 339 | 340 | res\drawable-large 341 | 1 342 | 343 | 344 | 345 | 346 | 1 347 | 348 | 349 | 1 350 | 351 | 352 | 1 353 | 354 | 355 | 356 | 357 | ../ 358 | 1 359 | 360 | 361 | ../ 362 | 1 363 | 364 | 365 | 366 | 367 | res\drawable-hdpi 368 | 1 369 | 370 | 371 | 372 | 373 | library\lib\armeabi-v7a 374 | 1 375 | 376 | 377 | 378 | 379 | Contents 380 | 1 381 | 382 | 383 | 384 | 385 | ../ 386 | 1 387 | 388 | 389 | 390 | 391 | 1 392 | 393 | 394 | 1 395 | 396 | 397 | 1 398 | 399 | 400 | 401 | 402 | res\values 403 | 1 404 | 405 | 406 | 407 | 408 | res\drawable-small 409 | 1 410 | 411 | 412 | 413 | 414 | res\drawable 415 | 1 416 | 417 | 418 | 419 | 420 | 1 421 | 422 | 423 | 1 424 | 425 | 426 | 1 427 | 428 | 429 | 430 | 431 | 1 432 | 433 | 434 | 435 | 436 | res\drawable 437 | 1 438 | 439 | 440 | 441 | 442 | 0 443 | 444 | 445 | 0 446 | 447 | 448 | Contents\Resources\StartUp\ 449 | 0 450 | 451 | 452 | 0 453 | 454 | 455 | 0 456 | 457 | 458 | 0 459 | 460 | 461 | 462 | 463 | library\lib\armeabi-v7a 464 | 1 465 | 466 | 467 | 468 | 469 | 0 470 | .bpl 471 | 472 | 473 | 1 474 | .dylib 475 | 476 | 477 | Contents\MacOS 478 | 1 479 | .dylib 480 | 481 | 482 | 1 483 | .dylib 484 | 485 | 486 | 1 487 | .dylib 488 | 489 | 490 | 491 | 492 | res\drawable-mdpi 493 | 1 494 | 495 | 496 | 497 | 498 | res\drawable-xlarge 499 | 1 500 | 501 | 502 | 503 | 504 | res\drawable-ldpi 505 | 1 506 | 507 | 508 | 509 | 510 | 1 511 | 512 | 513 | 1 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | True 526 | False 527 | 528 | 529 | 12 530 | 531 | 532 | 533 | 534 | 535 | -------------------------------------------------------------------------------- /xxHashPascal ReferenceCounted/xxHashPascalReferenceCounted.dproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | {99B4B79B-C478-42C0-9F56-6B67596798D7} 4 | 18.1 5 | VCL 6 | xxHashPascalReferenceCounted.dpr 7 | True 8 | Release 9 | Win32 10 | 1 11 | Application 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Cfg_1 34 | true 35 | true 36 | 37 | 38 | true 39 | Base 40 | true 41 | 42 | 43 | true 44 | Cfg_2 45 | true 46 | true 47 | 48 | 49 | xxHashPascalReferenceCounted 50 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) 51 | $(BDS)\bin\delphi_PROJECTICON.ico 52 | .\$(Platform)\$(Config) 53 | .\$(Platform)\$(Config) 54 | false 55 | false 56 | false 57 | false 58 | false 59 | 60 | 61 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 62 | 1033 63 | true 64 | DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;skinpackd10Seattle;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;bsfd10Seattle;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) 65 | $(BDS)\bin\default_app.manifest 66 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 67 | 68 | 69 | DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) 70 | 71 | 72 | DEBUG;$(DCC_Define) 73 | true 74 | false 75 | true 76 | true 77 | true 78 | 79 | 80 | true 81 | true 82 | false 83 | 84 | 85 | false 86 | RELEASE;$(DCC_Define) 87 | 0 88 | 0 89 | 90 | 91 | true 92 | true 93 | 94 | 95 | 96 | MainSource 97 | 98 | 99 | 100 | 101 | Cfg_2 102 | Base 103 | 104 | 105 | Base 106 | 107 | 108 | Cfg_1 109 | Base 110 | 111 | 112 | 113 | Delphi.Personality.12 114 | Application 115 | 116 | 117 | 118 | xxHashPascalReferenceCounted.dpr 119 | 120 | 121 | 122 | 123 | 124 | xxHashPascalReferenceCounted.exe 125 | true 126 | 127 | 128 | 129 | 130 | xxHashPascalReferenceCounted.exe 131 | true 132 | 133 | 134 | 135 | 136 | 1 137 | 138 | 139 | 1 140 | 141 | 142 | 143 | 144 | Contents\Resources 145 | 1 146 | 147 | 148 | 149 | 150 | classes 151 | 1 152 | 153 | 154 | 155 | 156 | Contents\MacOS 157 | 0 158 | 159 | 160 | 1 161 | 162 | 163 | Contents\MacOS 164 | 1 165 | 166 | 167 | 168 | 169 | 1 170 | 171 | 172 | 1 173 | 174 | 175 | 1 176 | 177 | 178 | 179 | 180 | res\drawable-xxhdpi 181 | 1 182 | 183 | 184 | 185 | 186 | library\lib\mips 187 | 1 188 | 189 | 190 | 191 | 192 | 0 193 | 194 | 195 | 1 196 | 197 | 198 | Contents\MacOS 199 | 1 200 | 201 | 202 | 1 203 | 204 | 205 | library\lib\armeabi-v7a 206 | 1 207 | 208 | 209 | 1 210 | 211 | 212 | 213 | 214 | 0 215 | 216 | 217 | Contents\MacOS 218 | 1 219 | .framework 220 | 221 | 222 | 223 | 224 | 1 225 | 226 | 227 | 1 228 | 229 | 230 | 1 231 | 232 | 233 | 234 | 235 | 1 236 | 237 | 238 | 1 239 | 240 | 241 | 1 242 | 243 | 244 | 245 | 246 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 247 | 1 248 | 249 | 250 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 251 | 1 252 | 253 | 254 | 255 | 256 | library\lib\x86 257 | 1 258 | 259 | 260 | 261 | 262 | 1 263 | 264 | 265 | 1 266 | 267 | 268 | 1 269 | 270 | 271 | 272 | 273 | 1 274 | 275 | 276 | 1 277 | 278 | 279 | 1 280 | 281 | 282 | 283 | 284 | library\lib\armeabi 285 | 1 286 | 287 | 288 | 289 | 290 | 0 291 | 292 | 293 | 1 294 | 295 | 296 | Contents\MacOS 297 | 1 298 | 299 | 300 | 301 | 302 | 1 303 | 304 | 305 | 1 306 | 307 | 308 | 1 309 | 310 | 311 | 312 | 313 | res\drawable-normal 314 | 1 315 | 316 | 317 | 318 | 319 | res\drawable-xhdpi 320 | 1 321 | 322 | 323 | 324 | 325 | res\drawable-large 326 | 1 327 | 328 | 329 | 330 | 331 | 1 332 | 333 | 334 | 1 335 | 336 | 337 | 1 338 | 339 | 340 | 341 | 342 | ../ 343 | 1 344 | 345 | 346 | ../ 347 | 1 348 | 349 | 350 | 351 | 352 | res\drawable-hdpi 353 | 1 354 | 355 | 356 | 357 | 358 | library\lib\armeabi-v7a 359 | 1 360 | 361 | 362 | 363 | 364 | Contents 365 | 1 366 | 367 | 368 | 369 | 370 | ../ 371 | 1 372 | 373 | 374 | 375 | 376 | 1 377 | 378 | 379 | 1 380 | 381 | 382 | 1 383 | 384 | 385 | 386 | 387 | res\values 388 | 1 389 | 390 | 391 | 392 | 393 | res\drawable-small 394 | 1 395 | 396 | 397 | 398 | 399 | res\drawable 400 | 1 401 | 402 | 403 | 404 | 405 | 1 406 | 407 | 408 | 1 409 | 410 | 411 | 1 412 | 413 | 414 | 415 | 416 | 1 417 | 418 | 419 | 420 | 421 | res\drawable 422 | 1 423 | 424 | 425 | 426 | 427 | 0 428 | 429 | 430 | 0 431 | 432 | 433 | Contents\Resources\StartUp\ 434 | 0 435 | 436 | 437 | 0 438 | 439 | 440 | 0 441 | 442 | 443 | 0 444 | 445 | 446 | 447 | 448 | library\lib\armeabi-v7a 449 | 1 450 | 451 | 452 | 453 | 454 | 0 455 | .bpl 456 | 457 | 458 | 1 459 | .dylib 460 | 461 | 462 | Contents\MacOS 463 | 1 464 | .dylib 465 | 466 | 467 | 1 468 | .dylib 469 | 470 | 471 | 1 472 | .dylib 473 | 474 | 475 | 476 | 477 | res\drawable-mdpi 478 | 1 479 | 480 | 481 | 482 | 483 | res\drawable-xlarge 484 | 1 485 | 486 | 487 | 488 | 489 | res\drawable-ldpi 490 | 1 491 | 492 | 493 | 494 | 495 | 0 496 | .dll;.bpl 497 | 498 | 499 | 1 500 | .dylib 501 | 502 | 503 | Contents\MacOS 504 | 1 505 | .dylib 506 | 507 | 508 | 1 509 | .dylib 510 | 511 | 512 | 1 513 | .dylib 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | True 526 | False 527 | 528 | 529 | 12 530 | 531 | 532 | 533 | 534 | 535 | --------------------------------------------------------------------------------