From 92b13647933e19786c8420fffc94f1f01f5980d1 Mon Sep 17 00:00:00 2001 From: Ugochukwu Mmaduekwe Date: Sun, 22 Mar 2026 21:27:44 +0100 Subject: [PATCH 1/3] some refactorings --- .../src/Core/uPerformanceBenchmark.pas | 67 +- HashLib.Tests/src/CRCTests.pas | 248 +- HashLib.Tests/src/ChecksumTests.pas | 2 +- HashLib.Tests/src/CryptoTests.pas | 716 ++-- HashLib.Tests/src/Hash128Tests.pas | 6 +- HashLib.Tests/src/Hash32Tests.pas | 42 +- HashLib.Tests/src/Hash64Tests.pas | 10 +- HashLib.Tests/src/HashLibTestBase.pas | 57 +- HashLib.Tests/src/NullDigestTests.pas | 6 +- HashLib.Tests/src/PBKDF2_HMACTests.pas | 4 +- HashLib.Tests/src/PBKDF_ScryptTests.pas | 20 +- HashLib.Tests/src/TestVectors.pas | 4 +- HashLib/src/Base/HlpHMACNotBuildInAdapter.pas | 36 +- HashLib/src/Base/HlpHash.pas | 40 +- HashLib/src/Base/HlpHashBuffer.pas | 32 +- HashLib/src/Base/HlpHashCryptoNotBuildIn.pas | 4 +- HashLib/src/Base/HlpHashFactory.pas | 52 +- HashLib/src/Base/HlpHashResult.pas | 28 +- HashLib/src/Base/HlpKDF.pas | 2 +- .../src/Base/HlpMultipleTransformNonBlock.pas | 4 +- HashLib/src/Checksum/HlpAdler32.pas | 70 +- HashLib/src/Checksum/HlpCRC.pas | 266 +- HashLib/src/Checksum/HlpCRC16.pas | 6 +- HashLib/src/Checksum/HlpCRC32.pas | 6 +- HashLib/src/Checksum/HlpCRC32Fast.pas | 38 +- HashLib/src/Checksum/HlpCRC64.pas | 8 +- .../Crypto/Blake2BParams/HlpBlake2BParams.pas | 44 +- .../Crypto/Blake2SParams/HlpBlake2SParams.pas | 52 +- HashLib/src/Crypto/HlpBlake2B.pas | 2870 +++++++-------- HashLib/src/Crypto/HlpBlake2BP.pas | 42 +- HashLib/src/Crypto/HlpBlake2S.pas | 2438 ++++++------- HashLib/src/Crypto/HlpBlake2SP.pas | 44 +- HashLib/src/Crypto/HlpBlake3.pas | 92 +- HashLib/src/Crypto/HlpGOST3411_2012.pas | 501 +-- HashLib/src/Crypto/HlpGost.pas | 592 +-- HashLib/src/Crypto/HlpGrindahl256.pas | 48 +- HashLib/src/Crypto/HlpGrindahl512.pas | 46 +- HashLib/src/Crypto/HlpHAS160.pas | 118 +- HashLib/src/Crypto/HlpHaval.pas | 3170 ++++++++--------- HashLib/src/Crypto/HlpMD2.pas | 28 +- HashLib/src/Crypto/HlpMD4.pas | 224 +- HashLib/src/Crypto/HlpMD5.pas | 290 +- HashLib/src/Crypto/HlpMDBase.pas | 8 +- HashLib/src/Crypto/HlpPanama.pas | 12 +- HashLib/src/Crypto/HlpRIPEMD.pas | 258 +- HashLib/src/Crypto/HlpRIPEMD128.pas | 546 +-- HashLib/src/Crypto/HlpRIPEMD160.pas | 1002 +++--- HashLib/src/Crypto/HlpRIPEMD256.pas | 554 +-- HashLib/src/Crypto/HlpRIPEMD320.pas | 1010 +++--- HashLib/src/Crypto/HlpRadioGatun32.pas | 34 +- HashLib/src/Crypto/HlpRadioGatun64.pas | 34 +- HashLib/src/Crypto/HlpSHA0.pas | 436 +-- HashLib/src/Crypto/HlpSHA1.pas | 268 +- HashLib/src/Crypto/HlpSHA2_224.pas | 14 +- HashLib/src/Crypto/HlpSHA2_256.pas | 14 +- HashLib/src/Crypto/HlpSHA2_256Base.pas | 1522 ++++---- HashLib/src/Crypto/HlpSHA2_384.pas | 14 +- HashLib/src/Crypto/HlpSHA2_512.pas | 14 +- HashLib/src/Crypto/HlpSHA2_512Base.pas | 1950 +++++----- HashLib/src/Crypto/HlpSHA2_512_224.pas | 16 +- HashLib/src/Crypto/HlpSHA2_512_256.pas | 14 +- HashLib/src/Crypto/HlpSHA3.pas | 462 +-- HashLib/src/Crypto/HlpSnefru.pas | 26 +- HashLib/src/Crypto/HlpTiger.pas | 498 +-- HashLib/src/Crypto/HlpTiger2.pas | 498 +-- HashLib/src/Crypto/HlpWhirlPool.pas | 131 +- .../src/Hash128/HlpMurmurHash3_x64_128.pas | 14 +- .../src/Hash128/HlpMurmurHash3_x86_128.pas | 14 +- HashLib/src/Hash128/HlpSipHash128.pas | 4 +- HashLib/src/Hash32/HlpAP.pas | 8 +- HashLib/src/Hash32/HlpBKDR.pas | 12 +- HashLib/src/Hash32/HlpBernstein.pas | 8 +- HashLib/src/Hash32/HlpBernstein1.pas | 8 +- HashLib/src/Hash32/HlpDEK.pas | 8 +- HashLib/src/Hash32/HlpDJB.pas | 8 +- HashLib/src/Hash32/HlpELF.pas | 18 +- HashLib/src/Hash32/HlpFNV.pas | 8 +- HashLib/src/Hash32/HlpFNV1a.pas | 8 +- HashLib/src/Hash32/HlpJS.pas | 8 +- HashLib/src/Hash32/HlpJenkins3.pas | 322 +- HashLib/src/Hash32/HlpMurmur2.pas | 58 +- HashLib/src/Hash32/HlpMurmurHash3_x86_32.pas | 64 +- HashLib/src/Hash32/HlpOneAtTime.pas | 8 +- HashLib/src/Hash32/HlpPJW.pas | 8 +- HashLib/src/Hash32/HlpRS.pas | 20 +- HashLib/src/Hash32/HlpRotating.pas | 8 +- HashLib/src/Hash32/HlpSDBM.pas | 8 +- HashLib/src/Hash32/HlpShiftAndXor.pas | 8 +- HashLib/src/Hash32/HlpSuperFast.pas | 40 +- HashLib/src/Hash32/HlpXXHash32.pas | 78 +- HashLib/src/Hash64/HlpFNV1a64.pas | 8 +- HashLib/src/Hash64/HlpFNV64.pas | 8 +- HashLib/src/Hash64/HlpMurmur2_64.pas | 114 +- HashLib/src/Hash64/HlpSipHash.pas | 20 +- HashLib/src/Hash64/HlpXXHash64.pas | 104 +- HashLib/src/Interfaces/HlpICRC.pas | 2 +- HashLib/src/Interfaces/HlpIHash.pas | 2 +- .../KDF/HlpPBKDF2_HMACNotBuildInAdapter.pas | 32 +- .../KDF/HlpPBKDF_Argon2NotBuildInAdapter.pas | 474 +-- .../KDF/HlpPBKDF_ScryptNotBuildInAdapter.pas | 306 +- HashLib/src/NullDigest/HlpNullDigest.pas | 10 +- HashLib/src/Utils/HlpArrayUtils.pas | 18 +- HashLib/src/Utils/HlpBitConverter.pas | 198 +- HashLib/src/Utils/HlpBits.pas | 12 +- HashLib/src/Utils/HlpConverters.pas | 118 +- scripts/check-duplicate-guids.ps1 | 49 + 106 files changed, 11998 insertions(+), 11933 deletions(-) create mode 100644 scripts/check-duplicate-guids.ps1 diff --git a/HashLib.Benchmark/src/Core/uPerformanceBenchmark.pas b/HashLib.Benchmark/src/Core/uPerformanceBenchmark.pas index 33862e46..af2882a2 100644 --- a/HashLib.Benchmark/src/Core/uPerformanceBenchmark.pas +++ b/HashLib.Benchmark/src/Core/uPerformanceBenchmark.pas @@ -38,75 +38,76 @@ class function TPerformanceBenchmark.Calculate(const AHashInstance: IHash; const THREE_SECONDS_IN_MILLISECONDS = UInt32(3000); var - MaxRate: Double; - Data: TBytes; - Idx: Int32; - Total: Int64; - A, B, TotalMilliSeconds: UInt32; - NewName, BlockSizeAndUnit: String; + LMaxRate: Double; + LData: TBytes; + LIdx: Int32; + LTotal: Int64; + LTickStart, LTickEnd, LTotalMilliSeconds: UInt32; + LNewName, LBlockSizeAndUnit: String; begin - System.SetLength(Data, ASize); + System.SetLength(LData, ASize); - for Idx := System.Low(Data) to System.High(Data) do + for LIdx := System.Low(LData) to System.High(LData) do begin - Data[Idx] := Byte(Random(ASize)); + LData[LIdx] := Byte(Random(ASize)); end; - MaxRate := 0.0; - TotalMilliSeconds := 0; + LMaxRate := 0.0; + LTotalMilliSeconds := 0; - Idx := 3; - while Idx > 0 do + LIdx := 3; + while LIdx > 0 do begin - Total := 0; + LTotal := 0; - while (TotalMilliSeconds <= THREE_SECONDS_IN_MILLISECONDS) do + while (LTotalMilliSeconds <= THREE_SECONDS_IN_MILLISECONDS) do begin - A := TThread.GetTickCount; - AHashInstance.ComputeBytes(Data); - B := TThread.GetTickCount; - Total := Total + System.Length(Data); - TotalMilliSeconds := TotalMilliSeconds + (B - A); + LTickStart := TThread.GetTickCount; + AHashInstance.ComputeBytes(LData); + LTickEnd := TThread.GetTickCount; + LTotal := LTotal + System.Length(LData); + LTotalMilliSeconds := LTotalMilliSeconds + (LTickEnd - LTickStart); end; - MaxRate := Math.Max(Total / (TotalMilliSeconds div 1000) / 1024 / - 1024, MaxRate); + LMaxRate := Math.Max(LTotal / (LTotalMilliSeconds div 1000) / 1024 / + 1024, LMaxRate); - System.Dec(Idx); + System.Dec(LIdx); end; if ANamePrefix <> '' then begin - NewName := Format('%s_%s', [AHashInstance.Name, ANamePrefix]); + LNewName := Format('%s_%s', [AHashInstance.Name, ANamePrefix]); end else begin - NewName := AHashInstance.Name; + LNewName := AHashInstance.Name; end; if ASize >= 1024 * 1024 * 1024 then begin - BlockSizeAndUnit := Format('%d GB', [(ASize div (1024 * 1024 * 1024))]); + LBlockSizeAndUnit := Format('%d GB', [(ASize div (1024 * 1024 * 1024))]); end else if ASize >= 1024 * 1024 then begin - BlockSizeAndUnit := Format('%d MB', [(ASize div (1024 * 1024))]); + LBlockSizeAndUnit := Format('%d MB', [(ASize div (1024 * 1024))]); end else begin - BlockSizeAndUnit := Format('%d KB', [(ASize div 1024)]); + LBlockSizeAndUnit := Format('%d KB', [(ASize div 1024)]); end; Result := Format('%s Throughput: %.2f MB/s with Blocks of %s', - [Copy(NewName, 2, System.Length(NewName) - 1), MaxRate, BlockSizeAndUnit]); + [Copy(LNewName, 2, System.Length(LNewName) - 1), LMaxRate, + LBlockSizeAndUnit]); end; class procedure TPerformanceBenchmark.DoBenchmark(var AStringList: TStringList); begin if not Assigned(AStringList) then begin - raise Exception.Create('StringList Instance cannot be Nil'); + raise Exception.Create('StringList Instance cannot be nil'); end; AStringList.Clear; @@ -153,11 +154,11 @@ class procedure TPerformanceBenchmark.DoBenchmark(var AStringList: TStringList); AStringList.Append(Calculate(THashFactory.TCrypto.CreateBlake2S_256)); - AStringList.Append(Calculate(THashFactory.TCrypto.CreateBlake2BP(64, Nil))); + AStringList.Append(Calculate(THashFactory.TCrypto.CreateBlake2BP(64, nil))); - AStringList.Append(Calculate(THashFactory.TCrypto.CreateBlake2SP(32, Nil))); + AStringList.Append(Calculate(THashFactory.TCrypto.CreateBlake2SP(32, nil))); - AStringList.Append(Calculate(THashFactory.TCrypto.CreateBlake3_256(Nil))); + AStringList.Append(Calculate(THashFactory.TCrypto.CreateBlake3_256(nil))); end; diff --git a/HashLib.Tests/src/CRCTests.pas b/HashLib.Tests/src/CRCTests.pas index f4295b17..ac82308e 100644 --- a/HashLib.Tests/src/CRCTests.pas +++ b/HashLib.Tests/src/CRCTests.pas @@ -67,41 +67,41 @@ implementation procedure TTestCRCModel.TearDown; begin - FCRC := Nil; + FCRC := nil; inherited; end; procedure TTestCRCModel.TestAnotherChunkedDataIncrementalHash; var - Idx: TCRCStandard; - temp: String; - x, size, i: Int32; + LIdx: TCRCStandard; + LTemp: String; + LX, LSize, LI: Int32; begin - for x := 0 to System.Pred(System.SizeOf(ChunkSizes) + for LX := 0 to System.Pred(System.SizeOf(ChunkSizes) div System.SizeOf(Int32)) do begin - size := ChunkSizes[x]; - for Idx := System.Low(TCRCStandard) to System.High(TCRCStandard) do + LSize := ChunkSizes[LX]; + for LIdx := System.Low(TCRCStandard) to System.High(TCRCStandard) do begin - FCRC := THashFactory.TChecksum.TCRC.CreateCRC(Idx); + FCRC := THashFactory.TChecksum.TCRC.CreateCRC(LIdx); FCRC.Initialize; - i := size; - while i < System.Length(ChunkedData) do + LI := LSize; + while LI < System.Length(ChunkedData) do begin - temp := System.Copy(ChunkedData, (i - size) + 1, size); - FCRC.TransformString(temp, TEncoding.UTF8); + LTemp := System.Copy(ChunkedData, (LI - LSize) + 1, LSize); + FCRC.TransformString(LTemp, TEncoding.UTF8); - System.Inc(i, size); + System.Inc(LI, LSize); end; - temp := System.Copy(ChunkedData, (i - size) + 1, - System.Length(ChunkedData) - ((i - size))); - FCRC.TransformString(temp, TEncoding.UTF8); + LTemp := System.Copy(ChunkedData, (LI - LSize) + 1, + System.Length(ChunkedData) - ((LI - LSize))); + FCRC.TransformString(LTemp, TEncoding.UTF8); ActualString := FCRC.TransformFinal().ToString(); - ExpectedString := THashFactory.TChecksum.TCRC.CreateCRC(Idx) + ExpectedString := THashFactory.TChecksum.TCRC.CreateCRC(LIdx) .ComputeString(ChunkedData, TEncoding.UTF8).ToString(); CheckEquals(ExpectedString, ActualString, @@ -115,18 +115,21 @@ procedure TTestCRCModel.TestAnotherChunkedDataIncrementalHash; procedure TTestCRCModel.TestCheckValue; var - Idx: TCRCStandard; - tmp: String; + LIdx: TCRCStandard; + LTmp: String; + LCRC: ICRC; begin - for Idx := System.Low(TCRCStandard) to System.High(TCRCStandard) do + for LIdx := System.Low(TCRCStandard) to System.High(TCRCStandard) do begin - FCRC := THashFactory.TChecksum.TCRC.CreateCRC(Idx); + FCRC := THashFactory.TChecksum.TCRC.CreateCRC(LIdx); - ExpectedString := IntToHex(((FCRC as ICRC).CheckValue), 16); + CheckTrue(Supports(FCRC, ICRC, LCRC), Format('Expected ICRC from %s', + [FCRC.Name])); + ExpectedString := IntToHex(LCRC.CheckValue, 16); - tmp := FCRC.ComputeString(OneToNine, TEncoding.UTF8).ToString(); + LTmp := FCRC.ComputeString(OneToNine, TEncoding.UTF8).ToString(); - ActualString := System.StringOfChar('0', 16 - System.Length(tmp)) + tmp; + ActualString := System.StringOfChar('0', 16 - System.Length(LTmp)) + LTmp; CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s. %s', [ExpectedString, ActualString, @@ -138,24 +141,27 @@ procedure TTestCRCModel.TestCheckValue; procedure TTestCRCModel.TestCheckValueWithIncrementalHash; var - Idx: TCRCStandard; - tmp: String; + LIdx: TCRCStandard; + LTmp: String; + LCRC: ICRC; begin - for Idx := System.Low(TCRCStandard) to System.High(TCRCStandard) do + for LIdx := System.Low(TCRCStandard) to System.High(TCRCStandard) do begin - FCRC := THashFactory.TChecksum.TCRC.CreateCRC(Idx); + FCRC := THashFactory.TChecksum.TCRC.CreateCRC(LIdx); FCRC.Initialize(); - ExpectedString := IntToHex(((FCRC as ICRC).CheckValue), 16); + CheckTrue(Supports(FCRC, ICRC, LCRC), Format('Expected ICRC from %s', + [FCRC.Name])); + ExpectedString := IntToHex(LCRC.CheckValue, 16); FCRC.TransformString(System.Copy(OneToNine, 1, 3), TEncoding.UTF8); FCRC.TransformString(System.Copy(OneToNine, 4, 3), TEncoding.UTF8); FCRC.TransformString(System.Copy(OneToNine, 7, 3), TEncoding.UTF8); - tmp := FCRC.TransformFinal().ToString(); + LTmp := FCRC.TransformFinal().ToString(); - ActualString := System.StringOfChar('0', 16 - System.Length(tmp)) + tmp; + ActualString := System.StringOfChar('0', 16 - System.Length(LTmp)) + LTmp; CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s. %s', [ExpectedString, ActualString, @@ -167,52 +173,52 @@ procedure TTestCRCModel.TestCheckValueWithIncrementalHash; procedure TTestCRCModel.TestHashCloneIsCorrect; var - Original, Copy: IHash; - MainData, ChunkOne, ChunkTwo: TBytes; - Count: Int32; - Idx: TCRCStandard; + LOriginal, LCopy: IHash; + LMainData, LChunkOne, LChunkTwo: TBytes; + LCount: Int32; + LIdx: TCRCStandard; begin - MainData := TConverters.ConvertStringToBytes(DefaultData, TEncoding.UTF8); - Count := System.Length(MainData) - 3; - ChunkOne := System.Copy(MainData, 0, Count); - ChunkTwo := System.Copy(MainData, Count, System.Length(MainData) - Count); + LMainData := TConverters.ConvertStringToBytes(DefaultData, TEncoding.UTF8); + LCount := System.Length(LMainData) - 3; + LChunkOne := System.Copy(LMainData, 0, LCount); + LChunkTwo := System.Copy(LMainData, LCount, System.Length(LMainData) - LCount); - for Idx := System.Low(TCRCStandard) to System.High(TCRCStandard) do + for LIdx := System.Low(TCRCStandard) to System.High(TCRCStandard) do begin - Original := THashFactory.TChecksum.TCRC.CreateCRC(Idx); - Original.Initialize; + LOriginal := THashFactory.TChecksum.TCRC.CreateCRC(LIdx); + LOriginal.Initialize; - Original.TransformBytes(ChunkOne); + LOriginal.TransformBytes(LChunkOne); // Make Copy Of Current State - Copy := Original.Clone(); - Original.TransformBytes(ChunkTwo); - ExpectedString := Original.TransformFinal().ToString(); - Copy.TransformBytes(ChunkTwo); - ActualString := Copy.TransformFinal().ToString(); + LCopy := LOriginal.Clone(); + LOriginal.TransformBytes(LChunkTwo); + ExpectedString := LOriginal.TransformFinal().ToString(); + LCopy.TransformBytes(LChunkTwo); + ActualString := LCopy.TransformFinal().ToString(); CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s. %s', [ExpectedString, ActualString, - Original.Name])); + LOriginal.Name])); end; end; procedure TTestCRCModel.TestHashCloneIsUnique; var - Original, Copy: IHash; - Idx: TCRCStandard; + LOriginal, LCopy: IHash; + LIdx: TCRCStandard; begin - for Idx := System.Low(TCRCStandard) to System.High(TCRCStandard) do + for LIdx := System.Low(TCRCStandard) to System.High(TCRCStandard) do begin - Original := THashFactory.TChecksum.TCRC.CreateCRC(Idx); - Original.Initialize; - Original.BufferSize := (64 * 1024); // 64Kb + LOriginal := THashFactory.TChecksum.TCRC.CreateCRC(LIdx); + LOriginal.Initialize; + LOriginal.BufferSize := (64 * 1024); // 64Kb // Make Copy Of Current State - Copy := Original.Clone(); - Copy.BufferSize := (128 * 1024); // 128Kb + LCopy := LOriginal.Clone(); + LCopy.BufferSize := (128 * 1024); // 128Kb - CheckNotEquals(Original.BufferSize, Copy.BufferSize, - Format('Expected %d but got %d. %s', [Original.BufferSize, - Copy.BufferSize, Original.Name])); + CheckNotEquals(LOriginal.BufferSize, LCopy.BufferSize, + Format('Expected %d but got %d. %s', [LOriginal.BufferSize, + LCopy.BufferSize, LOriginal.Name])); end; end; @@ -240,39 +246,39 @@ function TTestCRC32FastModel.GetWorkingValue(AIndex: Int32): UInt32; procedure TTestCRC32FastModel.TearDown; begin - FCRC32Fast := Nil; + FCRC32Fast := nil; inherited; end; procedure TTestCRC32FastModel.TestAnotherChunkedDataIncrementalHash; var - temp: String; - x, size, i, Idx: Int32; + LTemp: String; + LX, LSize, LI, LIdx: Int32; begin - for x := 0 to System.Pred(System.SizeOf(ChunkSizes) + for LX := 0 to System.Pred(System.SizeOf(ChunkSizes) div System.SizeOf(Int32)) do begin - size := ChunkSizes[x]; + LSize := ChunkSizes[LX]; - for Idx := LOW_INDEX to HIGH_INDEX do + for LIdx := LOW_INDEX to HIGH_INDEX do begin - GetWorkingValue(Idx); + GetWorkingValue(LIdx); FCRC32Fast.Initialize; - i := size; - while i < System.Length(ChunkedData) do + LI := LSize; + while LI < System.Length(ChunkedData) do begin - temp := System.Copy(ChunkedData, (i - size) + 1, size); - FCRC32Fast.TransformString(temp, TEncoding.UTF8); + LTemp := System.Copy(ChunkedData, (LI - LSize) + 1, LSize); + FCRC32Fast.TransformString(LTemp, TEncoding.UTF8); - System.Inc(i, size); + System.Inc(LI, LSize); end; - temp := System.Copy(ChunkedData, (i - size) + 1, - System.Length(ChunkedData) - ((i - size))); - FCRC32Fast.TransformString(temp, TEncoding.UTF8); + LTemp := System.Copy(ChunkedData, (LI - LSize) + 1, + System.Length(ChunkedData) - ((LI - LSize))); + FCRC32Fast.TransformString(LTemp, TEncoding.UTF8); ActualString := FCRC32Fast.TransformFinal().ToString(); @@ -291,21 +297,21 @@ procedure TTestCRC32FastModel.TestAnotherChunkedDataIncrementalHash; procedure TTestCRC32FastModel.TestCheckValue; var - Idx: Int32; - Check_Value: UInt32; - tmp: String; + LIdx: Int32; + LCheckValue: UInt32; + LTmp: String; begin - for Idx := LOW_INDEX to HIGH_INDEX do + for LIdx := LOW_INDEX to HIGH_INDEX do begin - Check_Value := GetWorkingValue(Idx); + LCheckValue := GetWorkingValue(LIdx); - ExpectedString := IntToHex(Check_Value, 16); + ExpectedString := IntToHex(LCheckValue, 16); - tmp := FCRC32Fast.ComputeString(OneToNine, TEncoding.UTF8).ToString(); + LTmp := FCRC32Fast.ComputeString(OneToNine, TEncoding.UTF8).ToString(); - ActualString := System.StringOfChar('0', 16 - System.Length(tmp)) + tmp; + ActualString := System.StringOfChar('0', 16 - System.Length(LTmp)) + LTmp; CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s. %s', [ExpectedString, ActualString, @@ -317,27 +323,27 @@ procedure TTestCRC32FastModel.TestCheckValue; procedure TTestCRC32FastModel.TestCheckValueWithIncrementalHash; var - Idx: Int32; - Check_Value: UInt32; - tmp: String; + LIdx: Int32; + LCheckValue: UInt32; + LTmp: String; begin - for Idx := LOW_INDEX to HIGH_INDEX do + for LIdx := LOW_INDEX to HIGH_INDEX do begin - Check_Value := GetWorkingValue(Idx); + LCheckValue := GetWorkingValue(LIdx); FCRC32Fast.Initialize(); - ExpectedString := IntToHex(Check_Value, 16); + ExpectedString := IntToHex(LCheckValue, 16); FCRC32Fast.TransformString(System.Copy(OneToNine, 1, 3), TEncoding.UTF8); FCRC32Fast.TransformString(System.Copy(OneToNine, 4, 3), TEncoding.UTF8); FCRC32Fast.TransformString(System.Copy(OneToNine, 7, 3), TEncoding.UTF8); - tmp := FCRC32Fast.TransformFinal().ToString(); + LTmp := FCRC32Fast.TransformFinal().ToString(); - ActualString := System.StringOfChar('0', 16 - System.Length(tmp)) + tmp; + ActualString := System.StringOfChar('0', 16 - System.Length(LTmp)) + LTmp; CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s. %s', [ExpectedString, ActualString, @@ -349,53 +355,53 @@ procedure TTestCRC32FastModel.TestCheckValueWithIncrementalHash; procedure TTestCRC32FastModel.TestHashCloneIsCorrect; var - Original, Copy: IHash; - MainData, ChunkOne, ChunkTwo: TBytes; - Count, Idx: Int32; + LOriginal, LCopy: IHash; + LMainData, LChunkOne, LChunkTwo: TBytes; + LCount, LIdx: Int32; begin - MainData := TConverters.ConvertStringToBytes(DefaultData, TEncoding.UTF8); - Count := System.Length(MainData) - 3; - ChunkOne := System.Copy(MainData, 0, Count); - ChunkTwo := System.Copy(MainData, Count, System.Length(MainData) - Count); + LMainData := TConverters.ConvertStringToBytes(DefaultData, TEncoding.UTF8); + LCount := System.Length(LMainData) - 3; + LChunkOne := System.Copy(LMainData, 0, LCount); + LChunkTwo := System.Copy(LMainData, LCount, System.Length(LMainData) - LCount); - for Idx := LOW_INDEX to HIGH_INDEX do + for LIdx := LOW_INDEX to HIGH_INDEX do begin - GetWorkingValue(Idx); - Original := FCRC32Fast; - Original.Initialize; + GetWorkingValue(LIdx); + LOriginal := FCRC32Fast; + LOriginal.Initialize; - Original.TransformBytes(ChunkOne); + LOriginal.TransformBytes(LChunkOne); // Make Copy Of Current State - Copy := Original.Clone(); - Original.TransformBytes(ChunkTwo); - ExpectedString := Original.TransformFinal().ToString(); - Copy.TransformBytes(ChunkTwo); - ActualString := Copy.TransformFinal().ToString(); + LCopy := LOriginal.Clone(); + LOriginal.TransformBytes(LChunkTwo); + ExpectedString := LOriginal.TransformFinal().ToString(); + LCopy.TransformBytes(LChunkTwo); + ActualString := LCopy.TransformFinal().ToString(); CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s. %s', [ExpectedString, ActualString, - Original.Name])); + LOriginal.Name])); end; end; procedure TTestCRC32FastModel.TestHashCloneIsUnique; var - Original, Copy: IHash; - Idx: Int32; + LOriginal, LCopy: IHash; + LIdx: Int32; begin - for Idx := LOW_INDEX to HIGH_INDEX do + for LIdx := LOW_INDEX to HIGH_INDEX do begin - GetWorkingValue(Idx); - Original := FCRC32Fast; - Original.Initialize; - Original.BufferSize := (64 * 1024); // 64Kb + GetWorkingValue(LIdx); + LOriginal := FCRC32Fast; + LOriginal.Initialize; + LOriginal.BufferSize := (64 * 1024); // 64Kb // Make Copy Of Current State - Copy := Original.Clone(); - Copy.BufferSize := (128 * 1024); // 128Kb + LCopy := LOriginal.Clone(); + LCopy.BufferSize := (128 * 1024); // 128Kb - CheckNotEquals(Original.BufferSize, Copy.BufferSize, - Format('Expected %d but got %d. %s', [Original.BufferSize, - Copy.BufferSize, Original.Name])); + CheckNotEquals(LOriginal.BufferSize, LCopy.BufferSize, + Format('Expected %d but got %d. %s', [LOriginal.BufferSize, + LCopy.BufferSize, LOriginal.Name])); end; end; diff --git a/HashLib.Tests/src/ChecksumTests.pas b/HashLib.Tests/src/ChecksumTests.pas index fd12b47e..e3043f2a 100644 --- a/HashLib.Tests/src/ChecksumTests.pas +++ b/HashLib.Tests/src/ChecksumTests.pas @@ -37,7 +37,7 @@ procedure TTestAlder32.SetUp; procedure TTestAlder32.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; diff --git a/HashLib.Tests/src/CryptoTests.pas b/HashLib.Tests/src/CryptoTests.pas index 66b9ee90..df1ebe52 100644 --- a/HashLib.Tests/src/CryptoTests.pas +++ b/HashLib.Tests/src/CryptoTests.pas @@ -910,7 +910,7 @@ procedure TTestGost.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateGost(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'CE85B99CC46752FFFEE35CAB9A7B0278ABB4C2D2055CFF685AF4912C49490F8D'; HashOfDefaultData := @@ -927,8 +927,8 @@ procedure TTestGost.SetUp; procedure TTestGost.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -938,7 +938,7 @@ procedure TTestGost_CryptoProParamSet.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateGost(TGostSBox.gsbCryptoProParamSet); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '981E5F3CA30C841487830F84FB433E13AC1101569B9C13584AC483234CD656C0'; HashOfDefaultData := @@ -955,8 +955,8 @@ procedure TTestGost_CryptoProParamSet.SetUp; procedure TTestGost_CryptoProParamSet.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -966,7 +966,7 @@ procedure TTestGrindahl256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateGrindahl256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '45A7600159AF54AE110FCB6EA0F38AD57875EAC814F74D2CBC247D28C89923E6'; HashOfDefaultData := @@ -983,8 +983,8 @@ procedure TTestGrindahl256.SetUp; procedure TTestGrindahl256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -994,7 +994,7 @@ procedure TTestGrindahl512.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateGrindahl512(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'EE0BA85F90B6D232430BA43DD0EDD008462591816962A355602ED214FAAE54A9A4607D6F577CE950421FF58AEA53F51A7A9F5CCA894C3776104D43568FEA1207'; HashOfDefaultData := @@ -1011,8 +1011,8 @@ procedure TTestGrindahl512.SetUp; procedure TTestGrindahl512.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1022,7 +1022,7 @@ procedure TTestHAS160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHAS160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '307964EF34151D37C8047ADEC7AB50F4FF89762D'; HashOfDefaultData := '2773EDAC4501514254D7B1DF091D6B7652250A52'; HashOfOnetoNine := 'A0DA48CCD36C9D24AA630D4B3673525E9109A83C'; @@ -1035,8 +1035,8 @@ procedure TTestHAS160.SetUp; procedure TTestHAS160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1046,7 +1046,7 @@ procedure TTestHaval_3_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_3_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'C68F39913F901F3DDF44C707357A7D70'; HashOfDefaultData := '04AF7562BA75D5767ADE2A71E4BE33DE'; HashOfOnetoNine := 'F2F92D4E5CA6B92A5B5FC5AC822C39D2'; @@ -1057,8 +1057,8 @@ procedure TTestHaval_3_128.SetUp; procedure TTestHaval_3_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1068,7 +1068,7 @@ procedure TTestHaval_4_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_4_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'EE6BBF4D6A46A679B3A856C88538BB98'; HashOfDefaultData := 'C815192C498CF266D0EB32E90D60892E'; HashOfOnetoNine := '52DFE2F3DA02591061B02DBDC1510F1C'; @@ -1079,8 +1079,8 @@ procedure TTestHaval_4_128.SetUp; procedure TTestHaval_4_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1090,7 +1090,7 @@ procedure TTestHaval_5_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_5_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '184B8482A0C050DCA54B59C7F05BF5DD'; HashOfDefaultData := 'B335D2DC38EFB9D937B803F7581AF88D'; HashOfOnetoNine := '8AA1C1CA3A7E4F983654C4F689DE6F8D'; @@ -1101,8 +1101,8 @@ procedure TTestHaval_5_128.SetUp; procedure TTestHaval_5_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1112,7 +1112,7 @@ procedure TTestHaval_3_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_3_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'D353C3AE22A25401D257643836D7231A9A95F953'; HashOfDefaultData := '4A5E28CA30029D2D04287E6C807E74D297A7FC74'; HashOfOnetoNine := '39A83AF3293CDAC04DE1DF3D0BE7A1F9D8AAB923'; @@ -1125,8 +1125,8 @@ procedure TTestHaval_3_160.SetUp; procedure TTestHaval_3_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1136,7 +1136,7 @@ procedure TTestHaval_4_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_4_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '1D33AAE1BE4146DBAACA0B6E70D7A11F10801525'; HashOfDefaultData := '9E86A9E2D964CCF9019593C88F40AA5C725E0912'; HashOfOnetoNine := 'B03439BE6F2A3EBED93AC86846D029D76F62FD99'; @@ -1149,8 +1149,8 @@ procedure TTestHaval_4_160.SetUp; procedure TTestHaval_4_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1160,7 +1160,7 @@ procedure TTestHaval_5_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_5_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '255158CFC1EED1A7BE7C55DDD64D9790415B933B'; HashOfDefaultData := 'A9AB9AB152BB4413B717228C3A65E75644542A35'; HashOfOnetoNine := '11F592B3A1A1A9C0F9C638C33B69E442D06C1D99'; @@ -1173,8 +1173,8 @@ procedure TTestHaval_5_160.SetUp; procedure TTestHaval_5_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1184,7 +1184,7 @@ procedure TTestHaval_3_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_3_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'E9C48D7903EAF2A91C5B350151EFCB175C0FC82DE2289A4E'; HashOfDefaultData := '4235822851EB1B63D6B1DB56CF18EBD28E0BC2327416D5D1'; HashOfOnetoNine := '6B92F078E73AF2E0F9F049FAA5016D32173A3D62D2F08554'; @@ -1197,8 +1197,8 @@ procedure TTestHaval_3_192.SetUp; procedure TTestHaval_3_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1208,7 +1208,7 @@ procedure TTestHaval_4_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_4_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '4A8372945AFA55C7DEAD800311272523CA19D42EA47B72DA'; HashOfDefaultData := '54D4FD0DE4228D55F826B627A128A765378B1DC1F8E6CD75'; HashOfOnetoNine := 'A5C285EAD0FF2F47C15C27B991C4A3A5007BA57137B18D07'; @@ -1221,8 +1221,8 @@ procedure TTestHaval_4_192.SetUp; procedure TTestHaval_4_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1232,7 +1232,7 @@ procedure TTestHaval_5_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_5_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '4839D0626F95935E17EE2FC4509387BBE2CC46CB382FFE85'; HashOfDefaultData := 'ED197F026B20DB6362CBC62BDD28E0B34F1E287966D84E3B'; HashOfOnetoNine := 'EC32312AA79775539675C9BA83D079FFC7EA498FA6173A46'; @@ -1245,8 +1245,8 @@ procedure TTestHaval_5_192.SetUp; procedure TTestHaval_5_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1256,7 +1256,7 @@ procedure TTestHaval_3_224.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_3_224(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'C5AAE9D47BFFCAAF84A8C6E7CCACD60A0DD1932BE7B1A192B9214B6D'; HashOfDefaultData := '12B7BFA1D36D0163E876A1474EB33CF5BC24C1BBBB181F28ACEE8D36'; @@ -1270,8 +1270,8 @@ procedure TTestHaval_3_224.SetUp; procedure TTestHaval_3_224.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1281,7 +1281,7 @@ procedure TTestHaval_4_224.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_4_224(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '3E56243275B3B81561750550E36FCD676AD2F5DD9E15F2E89E6ED78E'; HashOfDefaultData := 'DA7AB9D08D42C1819C04C7064891DB700DD05C960C3192CB615758B0'; @@ -1295,8 +1295,8 @@ procedure TTestHaval_4_224.SetUp; procedure TTestHaval_4_224.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1306,7 +1306,7 @@ procedure TTestHaval_5_224.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_5_224(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '4A0513C032754F5582A758D35917AC9ADF3854219B39E3AC77D1837E'; HashOfDefaultData := 'D5FEA825ED7B8CBF23938425BAFDBEE9AD127A685EFCA4559BD54892'; @@ -1320,8 +1320,8 @@ procedure TTestHaval_5_224.SetUp; procedure TTestHaval_5_224.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1331,7 +1331,7 @@ procedure TTestHaval_3_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_3_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '4F6938531F0BC8991F62DA7BBD6F7DE3FAD44562B8C6F4EBF146D5B4E46F7C17'; HashOfDefaultData := @@ -1348,8 +1348,8 @@ procedure TTestHaval_3_256.SetUp; procedure TTestHaval_3_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1359,7 +1359,7 @@ procedure TTestHaval_4_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_4_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'C92B2E23091E80E375DADCE26982482D197B1A2521BE82DA819F8CA2C579B99B'; HashOfDefaultData := @@ -1376,8 +1376,8 @@ procedure TTestHaval_4_256.SetUp; procedure TTestHaval_4_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1387,7 +1387,7 @@ procedure TTestHaval_5_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateHaval_5_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'BE417BB4DD5CFB76C7126F4F8EEB1553A449039307B1A3CD451DBFDC0FBBE330'; HashOfDefaultData := @@ -1404,8 +1404,8 @@ procedure TTestHaval_5_256.SetUp; procedure TTestHaval_5_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1415,7 +1415,7 @@ procedure TTestMD2.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateMD2(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '8350E5A3E24C153DF2275C9F80692773'; HashOfDefaultData := 'DFBE28FF5A3C23CAA85BE5848F16524E'; HashOfOnetoNine := '12BD4EFDD922B5C8C7B773F26EF4E35F'; @@ -1426,8 +1426,8 @@ procedure TTestMD2.SetUp; procedure TTestMD2.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1437,7 +1437,7 @@ procedure TTestMD4.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateMD4(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '31D6CFE0D16AE931B73C59D7E0C089C0'; HashOfDefaultData := 'A77EAB8C3432FD9DD1B87C3C5C2E9C3C'; HashOfOnetoNine := '2AE523785D0CAF4D2FB557C12016185C'; @@ -1448,8 +1448,8 @@ procedure TTestMD4.SetUp; procedure TTestMD4.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1459,7 +1459,7 @@ procedure TTestMD5.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateMD5(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'D41D8CD98F00B204E9800998ECF8427E'; HashOfDefaultData := '462EC1E50C8F2D5C387682E98F9BC842'; HashOfOnetoNine := '25F9E794323B453885F5181F1B624D0B'; @@ -1470,8 +1470,8 @@ procedure TTestMD5.SetUp; procedure TTestMD5.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1481,7 +1481,7 @@ procedure TTestPanama.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreatePanama(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'AA0CC954D757D7AC7779CA3342334CA471ABD47D5952AC91ED837ECD5B16922B'; HashOfDefaultData := @@ -1498,8 +1498,8 @@ procedure TTestPanama.SetUp; procedure TTestPanama.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1509,7 +1509,7 @@ procedure TTestRadioGatun32.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateRadioGatun32(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'F30028B54AFAB6B3E55355D277711109A19BEDA7091067E9A492FB5ED9F20117'; HashOfDefaultData := @@ -1526,8 +1526,8 @@ procedure TTestRadioGatun32.SetUp; procedure TTestRadioGatun32.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1537,7 +1537,7 @@ procedure TTestRadioGatun64.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateRadioGatun64(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '64A9A7FA139905B57BDAB35D33AA216370D5EAE13E77BFCDD85513408311A584'; HashOfDefaultData := @@ -1554,8 +1554,8 @@ procedure TTestRadioGatun64.SetUp; procedure TTestRadioGatun64.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1565,7 +1565,7 @@ procedure TTestRIPEMD.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateRIPEMD(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '9F73AA9B372A9DACFB86A6108852E2D9'; HashOfDefaultData := 'B3F629A9786744AA105A2C150869C236'; HashOfOnetoNine := 'C905B44C6429AD0A1934550037D4816F'; @@ -1576,8 +1576,8 @@ procedure TTestRIPEMD.SetUp; procedure TTestRIPEMD.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1587,7 +1587,7 @@ procedure TTestRIPEMD128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateRIPEMD128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'CDF26213A150DC3ECB610F18F6B38B46'; HashOfDefaultData := '75891B00B2874EDCAF7002CA98264193'; HashOfOnetoNine := '1886DB8ACDCBFEAB1E7EE3780400536F'; @@ -1598,8 +1598,8 @@ procedure TTestRIPEMD128.SetUp; procedure TTestRIPEMD128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1609,7 +1609,7 @@ procedure TTestRIPEMD160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateRIPEMD160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '9C1185A5C5E9FC54612808977EE8F548B2258D31'; HashOfDefaultData := '0B8EAC9A2EA1E267750CE639D83A84B92631462B'; HashOfOnetoNine := 'D3D0379126C1E5E0BA70AD6E5E53FF6AEAB9F4FA'; @@ -1622,8 +1622,8 @@ procedure TTestRIPEMD160.SetUp; procedure TTestRIPEMD160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1633,7 +1633,7 @@ procedure TTestRIPEMD256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateRIPEMD256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '02BA4C4E5F8ECD1877FC52D64D30E37A2D9774FB1E5D026380AE0168E3C5522D'; HashOfDefaultData := @@ -1650,8 +1650,8 @@ procedure TTestRIPEMD256.SetUp; procedure TTestRIPEMD256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1661,7 +1661,7 @@ procedure TTestRIPEMD320.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateRIPEMD320(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '22D65D5661536CDC75C1FDF5C6DE7B41B9F27325EBC61E8557177D705A0EC880151C3A32A00899B8'; HashOfDefaultData := @@ -1678,8 +1678,8 @@ procedure TTestRIPEMD320.SetUp; procedure TTestRIPEMD320.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1689,7 +1689,7 @@ procedure TTestSHA0.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA0(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'F96CEA198AD1DD5617AC084A3D92C6107708C0EF'; HashOfDefaultData := 'C9CBBE593DE122CA36B13CC37FE2CA8D5606FEED'; HashOfOnetoNine := 'F0360779D2AF6615F306BB534223CF762A92E988'; @@ -1702,8 +1702,8 @@ procedure TTestSHA0.SetUp; procedure TTestSHA0.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1713,7 +1713,7 @@ procedure TTestSHA1.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA1(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'; HashOfDefaultData := 'C8389876E94C043C47BA4BFF3D359884071DC310'; HashOfOnetoNine := 'F7C3BC1D808E04732ADF679965CCC34CA7AE3441'; @@ -1726,8 +1726,8 @@ procedure TTestSHA1.SetUp; procedure TTestSHA1.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1737,7 +1737,7 @@ procedure TTestSHA2_224.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA2_224(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'D14A028C2A3A2BC9476102BB288234C415A2B01F828EA62AC5B3E42F'; HashOfDefaultData := 'DF2B86ED008508F542443C4B1810AA5A0F5658692B808EEB1D0A2F7E'; @@ -1751,8 +1751,8 @@ procedure TTestSHA2_224.SetUp; procedure TTestSHA2_224.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1762,7 +1762,7 @@ procedure TTestSHA2_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA2_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855'; HashOfDefaultData := @@ -1779,8 +1779,8 @@ procedure TTestSHA2_256.SetUp; procedure TTestSHA2_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1790,7 +1790,7 @@ procedure TTestSHA2_384.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA2_384(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B'; HashOfDefaultData := @@ -1807,8 +1807,8 @@ procedure TTestSHA2_384.SetUp; procedure TTestSHA2_384.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1818,7 +1818,7 @@ procedure TTestSHA2_512.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA2_512(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E'; HashOfDefaultData := @@ -1835,8 +1835,8 @@ procedure TTestSHA2_512.SetUp; procedure TTestSHA2_512.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1846,7 +1846,7 @@ procedure TTestSHA2_512_224.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA2_512_224(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '6ED0DD02806FA89E25DE060C19D3AC86CABB87D6A0DDD05C333B84F4'; HashOfDefaultData := '7A95749FB7F4489A45275556F5D905D28E1B637DCDD6537336AB6234'; @@ -1860,8 +1860,8 @@ procedure TTestSHA2_512_224.SetUp; procedure TTestSHA2_512_224.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1871,7 +1871,7 @@ procedure TTestSHA2_512_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA2_512_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'C672B8D1EF56ED28AB87C3622C5114069BDD3AD7B8F9737498D0C01ECEF0967A'; HashOfDefaultData := @@ -1888,8 +1888,8 @@ procedure TTestSHA2_512_256.SetUp; procedure TTestSHA2_512_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1899,7 +1899,7 @@ procedure TTestSHA3_224.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA3_224(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '6B4E03423667DBB73B6E15454F0EB1ABD4597F9A1B078E3F5B5A6BC7'; HashOfDefaultData := '1D2BDFB95B0203C2BB7C739D813D69521EC7A3047E3FCA15CD305C95'; @@ -1913,8 +1913,8 @@ procedure TTestSHA3_224.SetUp; procedure TTestSHA3_224.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1924,7 +1924,7 @@ procedure TTestSHA3_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA3_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'A7FFC6F8BF1ED76651C14756A061D662F580FF4DE43B49FA82D80A4B80F8434A'; HashOfDefaultData := @@ -1941,8 +1941,8 @@ procedure TTestSHA3_256.SetUp; procedure TTestSHA3_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1952,7 +1952,7 @@ procedure TTestSHA3_384.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA3_384(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '0C63A75B845E4F7D01107D852E4C2485C51A50AAAA94FC61995E71BBEE983A2AC3713831264ADB47FB6BD1E058D5F004'; HashOfDefaultData := @@ -1969,8 +1969,8 @@ procedure TTestSHA3_384.SetUp; procedure TTestSHA3_384.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -1980,7 +1980,7 @@ procedure TTestSHA3_512.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSHA3_512(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'A69F73CCA23A9AC5C8B567DC185A756E97C982164FE25859E0D1DCC1475C80A615B2123AF1F5F94C11E3E9402C3AC558F500199D95B6D3E301758586281DCD26'; HashOfDefaultData := @@ -1997,8 +1997,8 @@ procedure TTestSHA3_512.SetUp; procedure TTestSHA3_512.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2031,8 +2031,8 @@ procedure TTestShake_128.SetUp; procedure TTestShake_128.TearDown; begin - HashInstance := Nil; - XofInstance := Nil; + HashInstance := nil; + XofInstance := nil; inherited; end; @@ -2070,8 +2070,8 @@ procedure TTestShake_256.SetUp; procedure TTestShake_256.TearDown; begin - HashInstance := Nil; - XofInstance := Nil; + HashInstance := nil; + XofInstance := nil; inherited; end; @@ -2080,10 +2080,10 @@ procedure TTestShake_256.TearDown; procedure TTestCShake_128.SetUp; begin inherited; - HashInstance := THashFactory.TXOF.CreateCShake_128(Nil, Nil, 128); - XofInstance := THashFactory.TXOF.CreateCShake_128(Nil, Nil, 8000) as IXOF; + HashInstance := THashFactory.TXOF.CreateCShake_128(nil, nil, 128); + XofInstance := THashFactory.TXOF.CreateCShake_128(nil, nil, 8000) as IXOF; XofInstanceShake := THashFactory.TXOF.CreateShake_128(8000) as IXOF; - XofInstanceTestVector := THashFactory.TXOF.CreateCShake_128(Nil, + XofInstanceTestVector := THashFactory.TXOF.CreateCShake_128(nil, TConverters.ConvertStringToBytes('Email Signature', TEncoding.UTF8), 128) as IXOF; HashOfEmptyData := '7F9C2BA4E88F827D616045507605853E'; @@ -2108,10 +2108,10 @@ procedure TTestCShake_128.SetUp; procedure TTestCShake_128.TearDown; begin - HashInstance := Nil; - XofInstance := Nil; - XofInstanceShake := Nil; - XofInstanceTestVector := Nil; + HashInstance := nil; + XofInstance := nil; + XofInstanceShake := nil; + XofInstanceTestVector := nil; inherited; end; @@ -2120,10 +2120,10 @@ procedure TTestCShake_128.TearDown; procedure TTestCShake_256.SetUp; begin inherited; - HashInstance := THashFactory.TXOF.CreateCShake_256(Nil, Nil, 256); - XofInstance := THashFactory.TXOF.CreateCShake_256(Nil, Nil, 8000) as IXOF; + HashInstance := THashFactory.TXOF.CreateCShake_256(nil, nil, 256); + XofInstance := THashFactory.TXOF.CreateCShake_256(nil, nil, 8000) as IXOF; XofInstanceShake := THashFactory.TXOF.CreateShake_256(8000) as IXOF; - XofInstanceTestVector := THashFactory.TXOF.CreateCShake_256(Nil, + XofInstanceTestVector := THashFactory.TXOF.CreateCShake_256(nil, TConverters.ConvertStringToBytes('Email Signature', TEncoding.UTF8), 256) as IXOF; HashOfEmptyData := @@ -2155,10 +2155,10 @@ procedure TTestCShake_256.SetUp; procedure TTestCShake_256.TearDown; begin - HashInstance := Nil; - XofInstance := Nil; - XofInstanceShake := Nil; - XofInstanceTestVector := Nil; + HashInstance := nil; + XofInstance := nil; + XofInstanceShake := nil; + XofInstanceTestVector := nil; inherited; end; @@ -2168,7 +2168,7 @@ procedure TTestSnefru_8_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSnefru_8_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '8617F366566A011837F4FB4BA5BEDEA2'; HashOfDefaultData := '1EA32485C121D07D1BD22FC4EDCF554F'; HashOfOnetoNine := '486D27B1F5F4A20DEE14CC466EDA9069'; @@ -2179,8 +2179,8 @@ procedure TTestSnefru_8_128.SetUp; procedure TTestSnefru_8_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2190,7 +2190,7 @@ procedure TTestSnefru_8_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateSnefru_8_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '8617F366566A011837F4FB4BA5BEDEA2B892F3ED8B894023D16AE344B2BE5881'; HashOfDefaultData := @@ -2207,8 +2207,8 @@ procedure TTestSnefru_8_256.SetUp; procedure TTestSnefru_8_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2218,7 +2218,7 @@ procedure TTestTiger_3_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_3_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '3293AC630C13F0245F92BBB1766E1616'; HashOfDefaultData := 'C76C85CE853F6E9858B507DA64E33DA2'; HashOfOnetoNine := '0672665140A491BB35040AA9943D769A'; @@ -2229,8 +2229,8 @@ procedure TTestTiger_3_128.SetUp; procedure TTestTiger_3_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2240,7 +2240,7 @@ procedure TTestTiger_4_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_4_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '24CC78A7F6FF3546E7984E59695CA13D'; HashOfDefaultData := '42CAAEB3A7218E379A78E4F1F7FBADA4'; HashOfOnetoNine := 'D9902D13011BD217DE965A3BA709F5CE'; @@ -2251,8 +2251,8 @@ procedure TTestTiger_4_128.SetUp; procedure TTestTiger_4_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2262,7 +2262,7 @@ procedure TTestTiger_5_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_5_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'E765EBE4C351724A1B99F96F2D7E62C9'; HashOfDefaultData := 'D6B8DCEA252160A4CBBF6A57DA9ABA78'; HashOfOnetoNine := 'BCCCB6421B3EC291A062A33DFF21BA76'; @@ -2273,8 +2273,8 @@ procedure TTestTiger_5_128.SetUp; procedure TTestTiger_5_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2284,7 +2284,7 @@ procedure TTestTiger_3_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_3_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '3293AC630C13F0245F92BBB1766E16167A4E5849'; HashOfDefaultData := 'C76C85CE853F6E9858B507DA64E33DA27DE49F86'; HashOfOnetoNine := '0672665140A491BB35040AA9943D769A47BE83FE'; @@ -2297,8 +2297,8 @@ procedure TTestTiger_3_160.SetUp; procedure TTestTiger_3_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2308,7 +2308,7 @@ procedure TTestTiger_4_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_4_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '24CC78A7F6FF3546E7984E59695CA13D804E0B68'; HashOfDefaultData := '42CAAEB3A7218E379A78E4F1F7FBADA432E1D4B6'; HashOfOnetoNine := 'D9902D13011BD217DE965A3BA709F5CE7E75ED2C'; @@ -2321,8 +2321,8 @@ procedure TTestTiger_4_160.SetUp; procedure TTestTiger_4_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2332,7 +2332,7 @@ procedure TTestTiger_5_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_5_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'E765EBE4C351724A1B99F96F2D7E62C9AACBE64C'; HashOfDefaultData := 'D6B8DCEA252160A4CBBF6A57DA9ABA78E4564864'; HashOfOnetoNine := 'BCCCB6421B3EC291A062A33DFF21BA764596C58E'; @@ -2345,8 +2345,8 @@ procedure TTestTiger_5_160.SetUp; procedure TTestTiger_5_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2356,7 +2356,7 @@ procedure TTestTiger_3_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_3_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '3293AC630C13F0245F92BBB1766E16167A4E58492DDE73F3'; HashOfDefaultData := 'C76C85CE853F6E9858B507DA64E33DA27DE49F8601F6A830'; HashOfOnetoNine := '0672665140A491BB35040AA9943D769A47BE83FEF2126E50'; @@ -2369,8 +2369,8 @@ procedure TTestTiger_3_192.SetUp; procedure TTestTiger_3_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2380,7 +2380,7 @@ procedure TTestTiger_4_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_4_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '24CC78A7F6FF3546E7984E59695CA13D804E0B686E255194'; HashOfDefaultData := '42CAAEB3A7218E379A78E4F1F7FBADA432E1D4B6A41827B0'; HashOfOnetoNine := 'D9902D13011BD217DE965A3BA709F5CE7E75ED2CB791FEA6'; @@ -2393,8 +2393,8 @@ procedure TTestTiger_4_192.SetUp; procedure TTestTiger_4_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2404,7 +2404,7 @@ procedure TTestTiger_5_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger_5_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'E765EBE4C351724A1B99F96F2D7E62C9AACBE64C63B5BCA2'; HashOfDefaultData := 'D6B8DCEA252160A4CBBF6A57DA9ABA78E45648645715E3CE'; HashOfOnetoNine := 'BCCCB6421B3EC291A062A33DFF21BA764596C58E30854A92'; @@ -2417,8 +2417,8 @@ procedure TTestTiger_5_192.SetUp; procedure TTestTiger_5_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2428,7 +2428,7 @@ procedure TTestTiger2_3_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_3_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '4441BE75F6018773C206C22745374B92'; HashOfDefaultData := 'DEB1924D290E3D5567792A8171BFC44F'; HashOfOnetoNine := '82FAF69673762B9FD8A0C902BDB395C1'; @@ -2439,8 +2439,8 @@ procedure TTestTiger2_3_128.SetUp; procedure TTestTiger2_3_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2450,7 +2450,7 @@ procedure TTestTiger2_4_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_4_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '6A7201A47AAC2065913811175553489A'; HashOfDefaultData := '22EE5BFE174B8C1C23361306C3E8F32C'; HashOfOnetoNine := '75B7D71ACD40FE5B5D3263C1F68F4CF5'; @@ -2461,8 +2461,8 @@ procedure TTestTiger2_4_128.SetUp; procedure TTestTiger2_4_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2472,7 +2472,7 @@ procedure TTestTiger2_5_128.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_5_128(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '61C657CC0C3C147ED90779B36A1E811F'; HashOfDefaultData := '7F71F95B346733E7022D4B85BDA9C51E'; HashOfOnetoNine := 'F720446C9BFDC8479D9FA53BC8B9144F'; @@ -2483,8 +2483,8 @@ procedure TTestTiger2_5_128.SetUp; procedure TTestTiger2_5_128.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2494,7 +2494,7 @@ procedure TTestTiger2_3_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_3_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '4441BE75F6018773C206C22745374B924AA8313F'; HashOfDefaultData := 'DEB1924D290E3D5567792A8171BFC44F70B5CD13'; HashOfOnetoNine := '82FAF69673762B9FD8A0C902BDB395C12B0CBDDC'; @@ -2507,8 +2507,8 @@ procedure TTestTiger2_3_160.SetUp; procedure TTestTiger2_3_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2518,7 +2518,7 @@ procedure TTestTiger2_4_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_4_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '6A7201A47AAC2065913811175553489ADD0F8B99'; HashOfDefaultData := '22EE5BFE174B8C1C23361306C3E8F32C92075577'; HashOfOnetoNine := '75B7D71ACD40FE5B5D3263C1F68F4CF5A5DA963B'; @@ -2531,8 +2531,8 @@ procedure TTestTiger2_4_160.SetUp; procedure TTestTiger2_4_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2542,7 +2542,7 @@ procedure TTestTiger2_5_160.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_5_160(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '61C657CC0C3C147ED90779B36A1E811F1D27F406'; HashOfDefaultData := '7F71F95B346733E7022D4B85BDA9C51E904825F7'; HashOfOnetoNine := 'F720446C9BFDC8479D9FA53BC8B9144FC3FE42ED'; @@ -2555,8 +2555,8 @@ procedure TTestTiger2_5_160.SetUp; procedure TTestTiger2_5_160.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2566,7 +2566,7 @@ procedure TTestTiger2_3_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_3_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '4441BE75F6018773C206C22745374B924AA8313FEF919F41'; HashOfDefaultData := 'DEB1924D290E3D5567792A8171BFC44F70B5CD13480D6D5C'; HashOfOnetoNine := '82FAF69673762B9FD8A0C902BDB395C12B0CBDDC66957838'; @@ -2579,8 +2579,8 @@ procedure TTestTiger2_3_192.SetUp; procedure TTestTiger2_3_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2590,7 +2590,7 @@ procedure TTestTiger2_4_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_4_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '6A7201A47AAC2065913811175553489ADD0F8B99E65A0955'; HashOfDefaultData := '22EE5BFE174B8C1C23361306C3E8F32C92075577F9115C2A'; HashOfOnetoNine := '75B7D71ACD40FE5B5D3263C1F68F4CF5A5DA963B39413ACA'; @@ -2603,8 +2603,8 @@ procedure TTestTiger2_4_192.SetUp; procedure TTestTiger2_4_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2614,7 +2614,7 @@ procedure TTestTiger2_5_192.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateTiger2_5_192(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '61C657CC0C3C147ED90779B36A1E811F1D27F406E3F37010'; HashOfDefaultData := '7F71F95B346733E7022D4B85BDA9C51E904825F73AF0E8AE'; HashOfOnetoNine := 'F720446C9BFDC8479D9FA53BC8B9144FC3FE42ED1440C213'; @@ -2627,8 +2627,8 @@ procedure TTestTiger2_5_192.SetUp; procedure TTestTiger2_5_192.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2638,7 +2638,7 @@ procedure TTestWhirlPool.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateWhirlPool(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '19FA61D75522A4669B44E39C1D2E1726C530232130D407F89AFEE0964997F7A73E83BE698B288FEBCF88E3E03C4F0757EA8964E59B63D93708B138CC42A66EB3'; HashOfDefaultData := @@ -2655,8 +2655,8 @@ procedure TTestWhirlPool.SetUp; procedure TTestWhirlPool.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2670,58 +2670,58 @@ procedure TTestBlake2B.TestBlake2BTreeHashingMode; INNER_SIZE = Byte(64); var LBuffer: TBytes; - Blake2BTreeConfigh00, Blake2BTreeConfigh01, Blake2BTreeConfigh10 + LBlake2BTreeConfigH00, LBlake2BTreeConfigH01, LBlake2BTreeConfigH10 : IBlake2BTreeConfig; - h00, h01, h10: IHash; + LH00, LH01, LH10: IHash; begin - LBuffer := Nil; + LBuffer := nil; System.SetLength(LBuffer, 6000); // Left leaf - Blake2BTreeConfigh00 := TBlake2BTreeConfig.Create(); - Blake2BTreeConfigh00.FanOut := FAN_OUT; - Blake2BTreeConfigh00.MaxDepth := DEPTH; - Blake2BTreeConfigh00.LeafSize := LEAF_SIZE; - Blake2BTreeConfigh00.InnerHashSize := INNER_SIZE; - Blake2BTreeConfigh00.NodeOffset := 0; - Blake2BTreeConfigh00.NodeDepth := 0; - Blake2BTreeConfigh00.IsLastNode := False; - h00 := THashFactory.TCrypto.CreateBlake2B(TBlake2BConfig.Create() - as IBlake2BConfig, Blake2BTreeConfigh00); - h00.Initialize; + LBlake2BTreeConfigH00 := TBlake2BTreeConfig.Create(); + LBlake2BTreeConfigH00.FanOut := FAN_OUT; + LBlake2BTreeConfigH00.MaxDepth := DEPTH; + LBlake2BTreeConfigH00.LeafSize := LEAF_SIZE; + LBlake2BTreeConfigH00.InnerHashSize := INNER_SIZE; + LBlake2BTreeConfigH00.NodeOffset := 0; + LBlake2BTreeConfigH00.NodeDepth := 0; + LBlake2BTreeConfigH00.IsLastNode := False; + LH00 := THashFactory.TCrypto.CreateBlake2B(TBlake2BConfig.Create() + as IBlake2BConfig, LBlake2BTreeConfigH00); + LH00.Initialize; // Right leaf - Blake2BTreeConfigh01 := TBlake2BTreeConfig.Create(); - Blake2BTreeConfigh01.FanOut := FAN_OUT; - Blake2BTreeConfigh01.MaxDepth := DEPTH; - Blake2BTreeConfigh01.LeafSize := LEAF_SIZE; - Blake2BTreeConfigh01.InnerHashSize := INNER_SIZE; - Blake2BTreeConfigh01.NodeOffset := 1; - Blake2BTreeConfigh01.NodeDepth := 0; - Blake2BTreeConfigh01.IsLastNode := True; - h01 := THashFactory.TCrypto.CreateBlake2B(TBlake2BConfig.Create() - as IBlake2BConfig, Blake2BTreeConfigh01); - h01.Initialize; + LBlake2BTreeConfigH01 := TBlake2BTreeConfig.Create(); + LBlake2BTreeConfigH01.FanOut := FAN_OUT; + LBlake2BTreeConfigH01.MaxDepth := DEPTH; + LBlake2BTreeConfigH01.LeafSize := LEAF_SIZE; + LBlake2BTreeConfigH01.InnerHashSize := INNER_SIZE; + LBlake2BTreeConfigH01.NodeOffset := 1; + LBlake2BTreeConfigH01.NodeDepth := 0; + LBlake2BTreeConfigH01.IsLastNode := True; + LH01 := THashFactory.TCrypto.CreateBlake2B(TBlake2BConfig.Create() + as IBlake2BConfig, LBlake2BTreeConfigH01); + LH01.Initialize; // Root node - Blake2BTreeConfigh10 := TBlake2BTreeConfig.Create(); - Blake2BTreeConfigh10.FanOut := FAN_OUT; - Blake2BTreeConfigh10.MaxDepth := DEPTH; - Blake2BTreeConfigh10.LeafSize := LEAF_SIZE; - Blake2BTreeConfigh10.InnerHashSize := INNER_SIZE; - Blake2BTreeConfigh10.NodeOffset := 0; - Blake2BTreeConfigh10.NodeDepth := 1; - Blake2BTreeConfigh10.IsLastNode := True; - h10 := THashFactory.TCrypto.CreateBlake2B(TBlake2BConfig.Create(32) - as IBlake2BConfig, Blake2BTreeConfigh10); - h10.Initialize; - - h10.TransformBytes(h00.ComputeBytes(System.Copy(LBuffer, 0, LEAF_SIZE)) + LBlake2BTreeConfigH10 := TBlake2BTreeConfig.Create(); + LBlake2BTreeConfigH10.FanOut := FAN_OUT; + LBlake2BTreeConfigH10.MaxDepth := DEPTH; + LBlake2BTreeConfigH10.LeafSize := LEAF_SIZE; + LBlake2BTreeConfigH10.InnerHashSize := INNER_SIZE; + LBlake2BTreeConfigH10.NodeOffset := 0; + LBlake2BTreeConfigH10.NodeDepth := 1; + LBlake2BTreeConfigH10.IsLastNode := True; + LH10 := THashFactory.TCrypto.CreateBlake2B(TBlake2BConfig.Create(32) + as IBlake2BConfig, LBlake2BTreeConfigH10); + LH10.Initialize; + + LH10.TransformBytes(LH00.ComputeBytes(System.Copy(LBuffer, 0, LEAF_SIZE)) .GetBytes()); - h10.TransformBytes(h01.ComputeBytes(System.Copy(LBuffer, LEAF_SIZE, + LH10.TransformBytes(LH01.ComputeBytes(System.Copy(LBuffer, LEAF_SIZE, UInt32(System.Length(LBuffer)) - LEAF_SIZE)).GetBytes()); - ActualString := h10.TransformFinal().ToString(); + ActualString := LH10.TransformFinal().ToString(); ExpectedString := Blake2BTreeHashingMode; CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s.', @@ -2739,7 +2739,7 @@ procedure TTestBlake2B.TestNullKeyVsUnKeyed; begin LConfigNoKeyed := TBlake2BConfig.Create(LIdx); LConfigNullKeyed := TBlake2BConfig.Create(LIdx); - LConfigNullKeyed.Key := Nil; + LConfigNullKeyed.Key := nil; ExpectedString := THashFactory.TCrypto.CreateBlake2B(LConfigNoKeyed) .ComputeBytes(LMainData).ToString(); @@ -2762,7 +2762,7 @@ procedure TTestBlake2B.SetUp; inherited; HashInstance := THashFactory.TCrypto.CreateBlake2B(); LConfig := TBlake2BConfig.Create(); - LKey := Nil; + LKey := nil; System.SetLength(LKey, 64); for LIdx := 0 to 63 do @@ -2772,7 +2772,7 @@ procedure TTestBlake2B.SetUp; LConfig.Key := LKey; HashInstanceWithKey := THashFactory.TCrypto.CreateBlake2B(LConfig); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '786A02F742015903C6C6FD852552D272912F4740E15847618A86E217F71F5419D25E1031AFEE585313896444934EB04B903A685B1448B755D56F701AFE9BE2CE'; HashOfDefaultData := @@ -2792,9 +2792,9 @@ procedure TTestBlake2B.SetUp; procedure TTestBlake2B.TearDown; begin - HashInstance := Nil; - HashInstanceWithKey := Nil; - HMACInstance := Nil; + HashInstance := nil; + HashInstanceWithKey := nil; + HmacInstance := nil; inherited; end; @@ -2809,58 +2809,58 @@ procedure TTestBlake2S.TestBlake2STreeHashingMode; INNER_SIZE = Byte(32); var LBuffer: TBytes; - Blake2STreeConfigh00, Blake2STreeConfigh01, Blake2STreeConfigh10 + LBlake2STreeConfigH00, LBlake2STreeConfigH01, LBlake2STreeConfigH10 : IBlake2STreeConfig; - h00, h01, h10: IHash; + LH00, LH01, LH10: IHash; begin - LBuffer := Nil; + LBuffer := nil; System.SetLength(LBuffer, 6000); // Left leaf - Blake2STreeConfigh00 := TBlake2STreeConfig.Create(); - Blake2STreeConfigh00.FanOut := FAN_OUT; - Blake2STreeConfigh00.MaxDepth := DEPTH; - Blake2STreeConfigh00.LeafSize := LEAF_SIZE; - Blake2STreeConfigh00.InnerHashSize := INNER_SIZE; - Blake2STreeConfigh00.NodeOffset := 0; - Blake2STreeConfigh00.NodeDepth := 0; - Blake2STreeConfigh00.IsLastNode := False; - h00 := THashFactory.TCrypto.CreateBlake2S(TBlake2SConfig.Create() - as IBlake2SConfig, Blake2STreeConfigh00); - h00.Initialize; + LBlake2STreeConfigH00 := TBlake2STreeConfig.Create(); + LBlake2STreeConfigH00.FanOut := FAN_OUT; + LBlake2STreeConfigH00.MaxDepth := DEPTH; + LBlake2STreeConfigH00.LeafSize := LEAF_SIZE; + LBlake2STreeConfigH00.InnerHashSize := INNER_SIZE; + LBlake2STreeConfigH00.NodeOffset := 0; + LBlake2STreeConfigH00.NodeDepth := 0; + LBlake2STreeConfigH00.IsLastNode := False; + LH00 := THashFactory.TCrypto.CreateBlake2S(TBlake2SConfig.Create() + as IBlake2SConfig, LBlake2STreeConfigH00); + LH00.Initialize; // Right leaf - Blake2STreeConfigh01 := TBlake2STreeConfig.Create(); - Blake2STreeConfigh01.FanOut := FAN_OUT; - Blake2STreeConfigh01.MaxDepth := DEPTH; - Blake2STreeConfigh01.LeafSize := LEAF_SIZE; - Blake2STreeConfigh01.InnerHashSize := INNER_SIZE; - Blake2STreeConfigh01.NodeOffset := 1; - Blake2STreeConfigh01.NodeDepth := 0; - Blake2STreeConfigh01.IsLastNode := True; - h01 := THashFactory.TCrypto.CreateBlake2S(TBlake2SConfig.Create() - as IBlake2SConfig, Blake2STreeConfigh01); - h01.Initialize; + LBlake2STreeConfigH01 := TBlake2STreeConfig.Create(); + LBlake2STreeConfigH01.FanOut := FAN_OUT; + LBlake2STreeConfigH01.MaxDepth := DEPTH; + LBlake2STreeConfigH01.LeafSize := LEAF_SIZE; + LBlake2STreeConfigH01.InnerHashSize := INNER_SIZE; + LBlake2STreeConfigH01.NodeOffset := 1; + LBlake2STreeConfigH01.NodeDepth := 0; + LBlake2STreeConfigH01.IsLastNode := True; + LH01 := THashFactory.TCrypto.CreateBlake2S(TBlake2SConfig.Create() + as IBlake2SConfig, LBlake2STreeConfigH01); + LH01.Initialize; // Root node - Blake2STreeConfigh10 := TBlake2STreeConfig.Create(); - Blake2STreeConfigh10.FanOut := FAN_OUT; - Blake2STreeConfigh10.MaxDepth := DEPTH; - Blake2STreeConfigh10.LeafSize := LEAF_SIZE; - Blake2STreeConfigh10.InnerHashSize := INNER_SIZE; - Blake2STreeConfigh10.NodeOffset := 0; - Blake2STreeConfigh10.NodeDepth := 1; - Blake2STreeConfigh10.IsLastNode := True; - h10 := THashFactory.TCrypto.CreateBlake2S(TBlake2SConfig.Create(16) - as IBlake2SConfig, Blake2STreeConfigh10); - h10.Initialize; - - h10.TransformBytes(h00.ComputeBytes(System.Copy(LBuffer, 0, LEAF_SIZE)) + LBlake2STreeConfigH10 := TBlake2STreeConfig.Create(); + LBlake2STreeConfigH10.FanOut := FAN_OUT; + LBlake2STreeConfigH10.MaxDepth := DEPTH; + LBlake2STreeConfigH10.LeafSize := LEAF_SIZE; + LBlake2STreeConfigH10.InnerHashSize := INNER_SIZE; + LBlake2STreeConfigH10.NodeOffset := 0; + LBlake2STreeConfigH10.NodeDepth := 1; + LBlake2STreeConfigH10.IsLastNode := True; + LH10 := THashFactory.TCrypto.CreateBlake2S(TBlake2SConfig.Create(16) + as IBlake2SConfig, LBlake2STreeConfigH10); + LH10.Initialize; + + LH10.TransformBytes(LH00.ComputeBytes(System.Copy(LBuffer, 0, LEAF_SIZE)) .GetBytes()); - h10.TransformBytes(h01.ComputeBytes(System.Copy(LBuffer, LEAF_SIZE, + LH10.TransformBytes(LH01.ComputeBytes(System.Copy(LBuffer, LEAF_SIZE, UInt32(System.Length(LBuffer)) - LEAF_SIZE)).GetBytes()); - ActualString := h10.TransformFinal().ToString(); + ActualString := LH10.TransformFinal().ToString(); ExpectedString := Blake2STreeHashingMode; CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s.', @@ -2878,7 +2878,7 @@ procedure TTestBlake2S.TestNullKeyVsUnKeyed; begin LConfigNoKeyed := TBlake2SConfig.Create(LIdx); LConfigNullKeyed := TBlake2SConfig.Create(LIdx); - LConfigNullKeyed.Key := Nil; + LConfigNullKeyed.Key := nil; ExpectedString := THashFactory.TCrypto.CreateBlake2S(LConfigNoKeyed) .ComputeBytes(LMainData).ToString(); @@ -2901,7 +2901,7 @@ procedure TTestBlake2S.SetUp; inherited; HashInstance := THashFactory.TCrypto.CreateBlake2S(); LConfig := TBlake2SConfig.Create(); - LKey := Nil; + LKey := nil; System.SetLength(LKey, 32); for LIdx := 0 to 31 do @@ -2911,7 +2911,7 @@ procedure TTestBlake2S.SetUp; LConfig.Key := LKey; HashInstanceWithKey := THashFactory.TCrypto.CreateBlake2S(LConfig); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '69217A3079908094E11121D042354A7C1F55B6482CA1A51E1B250DFD1ED0EEF9'; HashOfDefaultData := @@ -2931,9 +2931,9 @@ procedure TTestBlake2S.SetUp; procedure TTestBlake2S.TearDown; begin - HashInstance := Nil; - HashInstanceWithKey := Nil; - HMACInstance := Nil; + HashInstance := nil; + HashInstanceWithKey := nil; + HmacInstance := nil; inherited; end; @@ -2943,7 +2943,7 @@ procedure TTestKeccak_224.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateKeccak_224(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'F71837502BA8E10837BDD8D365ADB85591895602FC552B48B7390ABD'; HashOfDefaultData := '1BA678212F840E95F076B4E3E75310D4DA4308E04396E07EF1683ACE'; @@ -2957,8 +2957,8 @@ procedure TTestKeccak_224.SetUp; procedure TTestKeccak_224.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2968,7 +2968,7 @@ procedure TTestKeccak_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateKeccak_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'C5D2460186F7233C927E7DB2DCC703C0E500B653CA82273B7BFAD8045D85A470'; HashOfDefaultData := @@ -2985,8 +2985,8 @@ procedure TTestKeccak_256.SetUp; procedure TTestKeccak_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -2996,7 +2996,7 @@ procedure TTestKeccak_288.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateKeccak_288(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '6753E3380C09E385D0339EB6B050A68F66CFD60A73476E6FD6ADEB72F5EDD7C6F04A5D01'; HashOfDefaultData := @@ -3013,8 +3013,8 @@ procedure TTestKeccak_288.SetUp; procedure TTestKeccak_288.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -3024,7 +3024,7 @@ procedure TTestKeccak_384.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateKeccak_384(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '2C23146A63A29ACF99E73B88F8C24EAA7DC60AA771780CCC006AFBFA8FE2479B2DD2B21362337441AC12B515911957FF'; HashOfDefaultData := @@ -3041,8 +3041,8 @@ procedure TTestKeccak_384.SetUp; procedure TTestKeccak_384.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -3052,7 +3052,7 @@ procedure TTestKeccak_512.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateKeccak_512(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '0EAB42DE4C3CEB9235FC91ACFFE746B29C29A8C366B7C60E4E67C466F36A4304C00FA9CAF9D87976BA469BCBE06713B435F091EF2769FB160CDAB33D3670680E'; HashOfDefaultData := @@ -3069,8 +3069,8 @@ procedure TTestKeccak_512.SetUp; procedure TTestKeccak_512.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -3080,7 +3080,7 @@ procedure TTestGOST3411_2012_256.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateGOST3411_2012_256(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '3F539A213E97C802CC229D474C6AA32A825A360B2A933A949FD925208D9CE1BB'; HashOfDefaultData := @@ -3097,8 +3097,8 @@ procedure TTestGOST3411_2012_256.SetUp; procedure TTestGOST3411_2012_256.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -3108,7 +3108,7 @@ procedure TTestGOST3411_2012_512.SetUp; begin inherited; HashInstance := THashFactory.TCrypto.CreateGOST3411_2012_512(); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := '8E945DA209AA869F0455928529BCAE4679E9873AB707B55315F56CEB98BEF0A7362F715528356EE83CDA5F2AAC4C6AD2BA3A715C1BCD81CB8E9F90BF4C1C1A8A'; HashOfDefaultData := @@ -3125,8 +3125,8 @@ procedure TTestGOST3411_2012_512.SetUp; procedure TTestGOST3411_2012_512.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -3135,8 +3135,8 @@ procedure TTestGOST3411_2012_512.TearDown; procedure TTestBlake2XS.SetUp; begin inherited; - HashInstance := THashFactory.TXOF.CreateBlake2XS(Nil, 256); - XofInstance := THashFactory.TXOF.CreateBlake2XS(Nil, 8000) as IXOF; + HashInstance := THashFactory.TXOF.CreateBlake2XS(nil, 256); + XofInstance := THashFactory.TXOF.CreateBlake2XS(nil, 8000) as IXOF; HashOfEmptyData := 'F4B358457E5563FB54DF3060AEC26EA3AA1C959CF89F55A22538117ECF708BFC'; HashOfDefaultData := @@ -3164,8 +3164,8 @@ procedure TTestBlake2XS.SetUp; procedure TTestBlake2XS.TearDown; begin - HashInstance := Nil; - XofInstance := Nil; + HashInstance := nil; + XofInstance := nil; inherited; end; @@ -3230,8 +3230,8 @@ procedure TTestBlake2XS.TestCheckTestVectors; procedure TTestBlake2XB.SetUp; begin inherited; - HashInstance := THashFactory.TXOF.CreateBlake2XB(Nil, 512); - XofInstance := THashFactory.TXOF.CreateBlake2XB(Nil, 8000) as IXOF; + HashInstance := THashFactory.TXOF.CreateBlake2XB(nil, 512); + XofInstance := THashFactory.TXOF.CreateBlake2XB(nil, 8000) as IXOF; HashOfEmptyData := 'C5EF3D8845B9B2BA8EA28E9326C9E46E7A5843AD42BACAF927798BEAF554A43CA0830CCF8BB4A24CE1B1D82BD2DA971AFB2BE73919CC5FFF8E7C6A20F87284FA'; HashOfDefaultData := @@ -3259,8 +3259,8 @@ procedure TTestBlake2XB.SetUp; procedure TTestBlake2XB.TearDown; begin - HashInstance := Nil; - XofInstance := Nil; + HashInstance := nil; + XofInstance := nil; inherited; end; @@ -3325,8 +3325,8 @@ procedure TTestBlake2XB.TestCheckTestVectors; procedure TTestBlake3.SetUp; begin inherited; - HashInstance := THashFactory.TCrypto.CreateBlake3_256(Nil); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HashInstance := THashFactory.TCrypto.CreateBlake3_256(nil); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'AF1349B9F5F9A1A6A0404DEA36DCC9499BCB25C9ADC112B7CC9A93CAE41F3262'; @@ -3344,8 +3344,8 @@ procedure TTestBlake3.SetUp; procedure TTestBlake3.TearDown; begin - HashInstance := Nil; - HMACInstance := Nil; + HashInstance := nil; + HmacInstance := nil; inherited; end; @@ -3354,8 +3354,8 @@ procedure TTestBlake3.TearDown; procedure TTestBlake3XOF.SetUp; begin inherited; - HashInstance := THashFactory.TXOF.CreateBlake3XOF(Nil, 512); - XofInstance := THashFactory.TXOF.CreateBlake3XOF(Nil, 8000) as IXOF; + HashInstance := THashFactory.TXOF.CreateBlake3XOF(nil, 512); + XofInstance := THashFactory.TXOF.CreateBlake3XOF(nil, 8000) as IXOF; HashOfEmptyData := 'AF1349B9F5F9A1A6A0404DEA36DCC9499BCB25C9ADC112B7CC9A93CAE41F3262E00F03E7B69AF26B7FAAF09FCD333050338DDFE085B8CC869CA98B206C08243A'; HashOfDefaultData := @@ -3384,8 +3384,8 @@ procedure TTestBlake3XOF.SetUp; procedure TTestBlake3XOF.TearDown; begin - HashInstance := Nil; - XofInstance := Nil; + HashInstance := nil; + XofInstance := nil; inherited; end; @@ -3408,7 +3408,7 @@ procedure TTestBlake3XOF.TestCheckTestVectors; LCtxAsString := 'BLAKE3 2019-12-27 16:29:52 test vectors context'; LKey := TConverters.ConvertStringToBytes(LKeyAsString, TEncoding.UTF8); - LNilKey := Nil; + LNilKey := nil; LCtx := TConverters.ConvertStringToBytes(LCtxAsString, TEncoding.UTF8); for LIdx := 0 to System.Pred @@ -3545,8 +3545,8 @@ procedure TTestKMAC128.DoComputeKMAC128(const AKey, ACustomization, AData, LClone := LHash.Clone(); - LActualResult := Nil; - LActualResultClone := Nil; + LActualResult := nil; + LActualResultClone := nil; if IsXOF then begin @@ -3589,7 +3589,7 @@ procedure TTestKMAC128.SetUp; LTemp: TBytes; begin inherited; - LTemp := Nil; + LTemp := nil; System.SetLength(LTemp, 200); for LIdx := 0 to 199 do begin @@ -3685,8 +3685,8 @@ procedure TTestKMAC256.DoComputeKMAC256(const AKey, ACustomization, AData, LClone := LHash.Clone(); - LActualResult := Nil; - LActualResultClone := Nil; + LActualResult := nil; + LActualResultClone := nil; if IsXOF then begin @@ -3729,7 +3729,7 @@ procedure TTestKMAC256.SetUp; LTemp: TBytes; begin inherited; - LTemp := Nil; + LTemp := nil; System.SetLength(LTemp, 200); for LIdx := 0 to 199 do begin @@ -3974,8 +3974,8 @@ procedure TTestBlake2BP.SetUp; LKey: TBytes; begin inherited; - HashInstance := THashFactory.TCrypto.CreateBlake2BP(64, Nil); - LKey := Nil; + HashInstance := THashFactory.TCrypto.CreateBlake2BP(64, nil); + LKey := nil; System.SetLength(LKey, 64); for LIdx := 0 to 63 do @@ -3984,7 +3984,7 @@ procedure TTestBlake2BP.SetUp; end; HashInstanceWithKey := THashFactory.TCrypto.CreateBlake2BP(64, LKey); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'B5EF811A8038F70B628FA8B294DAAE7492B1EBE343A80EAABBF1F6AE664DD67B9D90B0120791EAB81DC96985F28849F6A305186A85501B405114BFA678DF9380'; HashOfDefaultData := @@ -4004,9 +4004,9 @@ procedure TTestBlake2BP.SetUp; procedure TTestBlake2BP.TearDown; begin - HashInstance := Nil; - HashInstanceWithKey := Nil; - HMACInstance := Nil; + HashInstance := nil; + HashInstanceWithKey := nil; + HmacInstance := nil; inherited; end; @@ -4018,8 +4018,8 @@ procedure TTestBlake2SP.SetUp; LKey: TBytes; begin inherited; - HashInstance := THashFactory.TCrypto.CreateBlake2SP(32, Nil); - LKey := Nil; + HashInstance := THashFactory.TCrypto.CreateBlake2SP(32, nil); + LKey := nil; System.SetLength(LKey, 32); for LIdx := 0 to 31 do @@ -4028,7 +4028,7 @@ procedure TTestBlake2SP.SetUp; end; HashInstanceWithKey := THashFactory.TCrypto.CreateBlake2SP(32, LKey); - HMACInstance := THashFactory.THMAC.CreateHMAC(HashInstance); + HmacInstance := THashFactory.THMAC.CreateHMAC(HashInstance); HashOfEmptyData := 'DD0E891776933F43C7D032B08A917E25741F8AA9A12C12E1CAC8801500F2CA4F'; HashOfDefaultData := @@ -4048,9 +4048,9 @@ procedure TTestBlake2SP.SetUp; procedure TTestBlake2SP.TearDown; begin - HashInstance := Nil; - HashInstanceWithKey := Nil; - HMACInstance := Nil; + HashInstance := nil; + HashInstanceWithKey := nil; + HmacInstance := nil; inherited; end; diff --git a/HashLib.Tests/src/Hash128Tests.pas b/HashLib.Tests/src/Hash128Tests.pas index ac4d968a..e096e4f8 100644 --- a/HashLib.Tests/src/Hash128Tests.pas +++ b/HashLib.Tests/src/Hash128Tests.pas @@ -60,7 +60,7 @@ procedure TTestMurmurHash3_x86_128.SetUp; procedure TTestMurmurHash3_x86_128.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -79,7 +79,7 @@ procedure TTestMurmurHash3_x64_128.SetUp; procedure TTestMurmurHash3_x64_128.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -98,7 +98,7 @@ procedure TTestSipHash128_2_4.SetUp; procedure TTestSipHash128_2_4.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; diff --git a/HashLib.Tests/src/Hash32Tests.pas b/HashLib.Tests/src/Hash32Tests.pas index 2adf5d5a..a76d382b 100644 --- a/HashLib.Tests/src/Hash32Tests.pas +++ b/HashLib.Tests/src/Hash32Tests.pas @@ -220,7 +220,7 @@ procedure TTestAP.SetUp; procedure TTestAP.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -238,7 +238,7 @@ procedure TTestBernstein.SetUp; procedure TTestBernstein.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -256,7 +256,7 @@ procedure TTestBernstein1.SetUp; procedure TTestBernstein1.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -274,7 +274,7 @@ procedure TTestBKDR.SetUp; procedure TTestBKDR.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -292,7 +292,7 @@ procedure TTestDEK.SetUp; procedure TTestDEK.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -310,7 +310,7 @@ procedure TTestDJB.SetUp; procedure TTestDJB.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -328,7 +328,7 @@ procedure TTestELF.SetUp; procedure TTestELF.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -346,7 +346,7 @@ procedure TTestFNV.SetUp; procedure TTestFNV.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -364,7 +364,7 @@ procedure TTestFNV1a.SetUp; procedure TTestFNV1a.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -382,7 +382,7 @@ procedure TTestJenkins3.SetUp; procedure TTestJenkins3.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -400,7 +400,7 @@ procedure TTestJS.SetUp; procedure TTestJS.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -419,7 +419,7 @@ procedure TTestMurmur2.SetUp; procedure TTestMurmur2.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -438,7 +438,7 @@ procedure TTestMurmurHash3_x86_32.SetUp; procedure TTestMurmurHash3_x86_32.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -456,7 +456,7 @@ procedure TTestOneAtTime.SetUp; procedure TTestOneAtTime.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -474,7 +474,7 @@ procedure TTestPJW.SetUp; procedure TTestPJW.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -492,7 +492,7 @@ procedure TTestRotating.SetUp; procedure TTestRotating.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -510,7 +510,7 @@ procedure TTestRS.SetUp; procedure TTestRS.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -528,7 +528,7 @@ procedure TTestSDBM.SetUp; procedure TTestSDBM.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -546,7 +546,7 @@ procedure TTestShiftAndXor.SetUp; procedure TTestShiftAndXor.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -564,7 +564,7 @@ procedure TTestSuperFast.SetUp; procedure TTestSuperFast.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -583,7 +583,7 @@ procedure TTestXXHash32.SetUp; procedure TTestXXHash32.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; diff --git a/HashLib.Tests/src/Hash64Tests.pas b/HashLib.Tests/src/Hash64Tests.pas index 24ac15f5..f9270fed 100644 --- a/HashLib.Tests/src/Hash64Tests.pas +++ b/HashLib.Tests/src/Hash64Tests.pas @@ -80,7 +80,7 @@ procedure TTestFNV64.SetUp; procedure TTestFNV64.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -98,7 +98,7 @@ procedure TTestFNV1a64.SetUp; procedure TTestFNV1a64.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -117,7 +117,7 @@ procedure TTestMurmur2_64.SetUp; procedure TTestMurmur2_64.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -136,7 +136,7 @@ procedure TTestSipHash2_4.SetUp; procedure TTestSipHash2_4.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; @@ -155,7 +155,7 @@ procedure TTestXXHash64.SetUp; procedure TTestXXHash64.TearDown; begin - HashInstance := Nil; + HashInstance := nil; inherited; end; diff --git a/HashLib.Tests/src/HashLibTestBase.pas b/HashLib.Tests/src/HashLibTestBase.pas index 1c270c6a..aed8f21f 100644 --- a/HashLib.Tests/src/HashLibTestBase.pas +++ b/HashLib.Tests/src/HashLibTestBase.pas @@ -310,7 +310,7 @@ THashWithExternalKeyAlgorithmTestCase = class abstract(THashAlgorithmTestCase) TCryptoAlgorithmTestCase = class abstract(THashAlgorithmTestCase) strict private var - FHMACInstance: IHMAC; + FHmacInstance: IHMAC; FHashOfDefaultDataHMACWithShortKey, FHashOfDefaultDataHMACWithLongKey: String; @@ -320,8 +320,8 @@ TCryptoAlgorithmTestCase = class abstract(THashAlgorithmTestCase) : String); inline; procedure SetHashOfDefaultDataHMACWithLongKey(const AValue: String); inline; - function GetHMACInstance: IHMAC; inline; - procedure SetHMACInstance(const AValue: IHMAC); inline; + function GetHmacInstance: IHMAC; inline; + procedure SetHmacInstance(const AValue: IHMAC); inline; strict protected property HashOfDefaultDataHMACWithShortKey: String @@ -332,7 +332,7 @@ TCryptoAlgorithmTestCase = class abstract(THashAlgorithmTestCase) read GetHashOfDefaultDataHMACWithLongKey write SetHashOfDefaultDataHMACWithLongKey; - property HMACInstance: IHMAC read GetHMACInstance write SetHMACInstance; + property HmacInstance: IHMAC read GetHmacInstance write SetHmacInstance; published procedure TestSplits(); procedure TestHMACWithDefaultDataShortKey; @@ -766,7 +766,7 @@ procedure THashAlgorithmTestCase.TestBytesABCDE; var LBuffer: TBytes; begin - LBuffer := Nil; + LBuffer := nil; System.SetLength(LBuffer, System.SizeOf(BytesABCDE)); System.Move(BytesABCDE, Pointer(LBuffer)^, System.SizeOf(BytesABCDE)); ExpectedString := HashOfABCDE; @@ -836,7 +836,7 @@ procedure THashAlgorithmTestCase.TestUntypedInterface; var LBuffer, LResultA, LResultB: TBytes; begin - LBuffer := Nil; + LBuffer := nil; System.SetLength(LBuffer, System.SizeOf(BytesABCDE)); System.Move(BytesABCDE, Pointer(LBuffer)^, System.SizeOf(BytesABCDE)); LResultA := HashInstance.ComputeBytes(LBuffer).GetBytes(); @@ -865,7 +865,8 @@ procedure THashWithUInt32AsKeyAlgorithmTestCase.TestWithMaxUInt32AsKey; LIHashWithKey: IHashWithKey; begin ExpectedString := HashOfDefaultDataWithMaxUInt32AsKey; - LIHashWithKey := (HashInstance as IHashWithKey); + CheckTrue(Supports(HashInstance, IHashWithKey, LIHashWithKey), + 'HashInstance must support IHashWithKey'); LIHashWithKey.Key := TConverters.ReadUInt32AsBytesLE(System.High(UInt32)); ActualString := LIHashWithKey.ComputeString(DefaultData, TEncoding.UTF8) .ToString(); @@ -892,7 +893,7 @@ procedure THashWithUInt64AsKeyAlgorithmTestCase.TestWithMaxUInt64AsKey; LIHashWithKey: IHashWithKey; begin ExpectedString := HashOfDefaultDataWithMaxUInt64AsKey; - LIHashWithKey := (HashInstance as IHashWithKey); + LIHashWithKey := HashInstance as IHashWithKey; LIHashWithKey.Key := TConverters.ReadUInt64AsBytesLE(System.High(UInt64)); ActualString := LIHashWithKey.ComputeString(DefaultData, TEncoding.UTF8) .ToString(); @@ -919,7 +920,8 @@ procedure THashWithExternalKeyAlgorithmTestCase.TestWithExternalKey; LIHashWithKey: IHashWithKey; begin ExpectedString := HashOfDefaultDataWithExternalKey; - LIHashWithKey := (HashInstance as IHashWithKey); + CheckTrue(Supports(HashInstance, IHashWithKey, LIHashWithKey), + 'HashInstance must support IHashWithKey'); LIHashWithKey.Key := TConverters.ConvertHexStringToBytes(ZeroToFifteenInHex); ActualString := LIHashWithKey.ComputeString(DefaultData, TEncoding.UTF8) .ToString(); @@ -951,22 +953,22 @@ procedure TCryptoAlgorithmTestCase.SetHashOfDefaultDataHMACWithShortKey FHashOfDefaultDataHMACWithShortKey := AValue; end; -function TCryptoAlgorithmTestCase.GetHMACInstance: IHMAC; +function TCryptoAlgorithmTestCase.GetHmacInstance: IHMAC; begin - Result := FHMACInstance; + Result := FHmacInstance; end; -procedure TCryptoAlgorithmTestCase.SetHMACInstance(const AValue: IHMAC); +procedure TCryptoAlgorithmTestCase.SetHmacInstance(const AValue: IHMAC); begin - FHMACInstance := AValue; + FHmacInstance := AValue; end; procedure TCryptoAlgorithmTestCase.TestHMACWithDefaultDataShortKey; begin ExpectedString := HashOfDefaultDataHMACWithShortKey; - HMACInstance.Key := TConverters.ConvertStringToBytes(HMACShortStringKey, + HmacInstance.Key := TConverters.ConvertStringToBytes(HMACShortStringKey, TEncoding.UTF8); - ActualString := HMACInstance.ComputeString(DefaultData, TEncoding.UTF8) + ActualString := HmacInstance.ComputeString(DefaultData, TEncoding.UTF8) .ToString(); CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s.', [ExpectedString, ActualString])); @@ -975,9 +977,9 @@ procedure TCryptoAlgorithmTestCase.TestHMACWithDefaultDataShortKey; procedure TCryptoAlgorithmTestCase.TestHMACWithDefaultDataLongKey; begin ExpectedString := HashOfDefaultDataHMACWithLongKey; - HMACInstance.Key := TConverters.ConvertStringToBytes(HMACLongStringKey, + HmacInstance.Key := TConverters.ConvertStringToBytes(HMACLongStringKey, TEncoding.UTF8); - ActualString := HMACInstance.ComputeString(DefaultData, TEncoding.UTF8) + ActualString := HmacInstance.ComputeString(DefaultData, TEncoding.UTF8) .ToString(); CheckEquals(ExpectedString, ActualString, Format('Expected %s but got %s.', [ExpectedString, ActualString])); @@ -994,14 +996,15 @@ procedure TCryptoAlgorithmTestCase.TestHMACCloneWorks; LChunkOne := System.Copy(LMainData, 0, LCount); LChunkTwo := System.Copy(LMainData, LCount, System.Length(LMainData) - LCount); - LOriginal := HMACInstance; - (LOriginal as IHMAC).Key := TConverters.ConvertStringToBytes + LOriginal := HmacInstance; + LOriginal.Key := TConverters.ConvertStringToBytes (HMACLongStringKey, TEncoding.UTF8); LOriginal.Initialize; LOriginal.TransformBytes(LChunkOne); // Make Copy Of Current State - LCopy := LOriginal.Clone() as IHMAC; + CheckTrue(Supports(LOriginal.Clone(), IHMAC, LCopy), + 'Clone must support IHMAC'); LOriginal.TransformBytes(LChunkTwo); ExpectedString := LOriginal.TransformFinal().ToString(); LCopy.TransformBytes(LChunkTwo); @@ -1017,7 +1020,7 @@ procedure TCryptoAlgorithmTestCase.TestSplits; LHash0, LHash1: String; LInput: TBytes; begin - LInput := Nil; + LInput := nil; System.SetLength(LInput, 20); for LIdx := System.Low(LInput) to System.High(LInput) do begin @@ -1096,7 +1099,7 @@ procedure TBlakeCryptoAlgorithmTestCase.TestCheckKeyedTestVectors; if LLen = 0 then begin - LData := Nil; + LData := nil; end else begin @@ -1126,7 +1129,7 @@ procedure TBlakeCryptoAlgorithmTestCase.TestCheckUnkeyedTestVectors; if LIdx = 0 then begin - LInput := Nil; + LInput := nil; end else begin @@ -1173,7 +1176,7 @@ procedure TXofAlgorithmTestCase.CallShouldRaiseException; LOutput: TBytes; begin XofInstance.Initialize; - LOutput := Nil; + LOutput := nil; System.SetLength(LOutput, (XofInstance.XOFSizeInBits shr 3)); XofInstance.TransformUntyped(BytesABCDE, System.SizeOf(BytesABCDE)); XofInstance.DoOutput(LOutput, 0, System.Length(LOutput)); @@ -1186,7 +1189,7 @@ procedure TXofAlgorithmTestCase.TestOutputBufferTooShort; LOutput: TBytes; begin XofInstance.Initialize; - LOutput := Nil; + LOutput := nil; System.SetLength(LOutput, (XofInstance.XOFSizeInBits shr 3)); try @@ -1207,7 +1210,7 @@ procedure TXofAlgorithmTestCase.TestOutputOverflow; LOutput: TBytes; begin XofInstance.Initialize; - LOutput := Nil; + LOutput := nil; System.SetLength(LOutput, (XofInstance.XOFSizeInBits shr 3) + 1); try @@ -1236,7 +1239,7 @@ procedure TXofAlgorithmTestCase.TestVeryLongXofOfEmptyStringWithStreamingOutput; var LTempResult, LExpectedChunk, LActualChunk: TBytes; begin - LTempResult := Nil; + LTempResult := nil; System.SetLength(LTempResult, 1000); XofInstance.Initialize; XofInstance.TransformString(EmptyData, TEncoding.UTF8); diff --git a/HashLib.Tests/src/NullDigestTests.pas b/HashLib.Tests/src/NullDigestTests.pas index bcf8a593..1d7744c3 100644 --- a/HashLib.Tests/src/NullDigestTests.pas +++ b/HashLib.Tests/src/NullDigestTests.pas @@ -41,9 +41,9 @@ procedure TTestNullDigest.SetUp; procedure TTestNullDigest.TearDown; begin inherited; - HashInstance := Nil; - FBlockSizeMethod := Nil; - FHashSizeMethod := Nil; + HashInstance := nil; + FBlockSizeMethod := nil; + FHashSizeMethod := nil; end; initialization diff --git a/HashLib.Tests/src/PBKDF2_HMACTests.pas b/HashLib.Tests/src/PBKDF2_HMACTests.pas index 571ed6ee..fa1d499c 100644 --- a/HashLib.Tests/src/PBKDF2_HMACTests.pas +++ b/HashLib.Tests/src/PBKDF2_HMACTests.pas @@ -53,7 +53,7 @@ procedure TTestPBKDF2_HMACSHA1.SetUp; procedure TTestPBKDF2_HMACSHA1.TearDown; begin - PBKDF2_HMACInstance := Nil; + PBKDF2_HMACInstance := nil; inherited; end; @@ -75,7 +75,7 @@ procedure TTestPBKDF2_HMACSHA2_256.SetUp; procedure TTestPBKDF2_HMACSHA2_256.TearDown; begin - PBKDF2_HMACInstance := Nil; + PBKDF2_HMACInstance := nil; inherited; end; diff --git a/HashLib.Tests/src/PBKDF_ScryptTests.pas b/HashLib.Tests/src/PBKDF_ScryptTests.pas index 2e6f0674..678d1b66 100644 --- a/HashLib.Tests/src/PBKDF_ScryptTests.pas +++ b/HashLib.Tests/src/PBKDF_ScryptTests.pas @@ -106,21 +106,21 @@ procedure TTestPBKDF_Scrypt.DoCheckOk(const AMsg: String; procedure TTestPBKDF_Scrypt.TestParameters; begin - DoCheckOk('Minimal values', Nil, Nil, 2, 1, 1, 1); - DoCheckIllegal('Cost parameter must be > 1', Nil, Nil, 1, 1, 1, 1); - DoCheckOk('Cost parameter 32768 OK for r = 1', Nil, Nil, 32768, 1, 1, 1); - DoCheckIllegal('Cost parameter must < 65536 for r = 1', Nil, Nil, + DoCheckOk('Minimal values', nil, nil, 2, 1, 1, 1); + DoCheckIllegal('Cost parameter must be > 1', nil, nil, 1, 1, 1, 1); + DoCheckOk('Cost parameter 32768 OK for r = 1', nil, nil, 32768, 1, 1, 1); + DoCheckIllegal('Cost parameter must < 65536 for r = 1', nil, nil, 65536, 1, 1, 1); - DoCheckIllegal('Block size must be >= 1', Nil, Nil, 2, 0, 2, 1); - DoCheckIllegal('Parallelisation parameter must be >= 1', Nil, Nil, 2, + DoCheckIllegal('Block size must be >= 1', nil, nil, 2, 0, 2, 1); + DoCheckIllegal('Parallelisation parameter must be >= 1', nil, nil, 2, 1, 0, 1); // disabled test because it's very expensive - // DoCheckOk('Parallelisation parameter 65535 OK for r = 4', Nil, Nil, 2, 32, + // DoCheckOk('Parallelisation parameter 65535 OK for r = 4', nil, nil, 2, 32, // 65535, 1); - DoCheckIllegal('Parallelisation parameter must be < 65535 for r = 4', Nil, - Nil, 2, 32, 65536, 1); + DoCheckIllegal('Parallelisation parameter must be < 65535 for r = 4', nil, + nil, 2, 32, 65536, 1); - DoCheckIllegal('Len parameter must be > 1', Nil, Nil, 2, 1, 1, 0); + DoCheckIllegal('Len parameter must be > 1', nil, nil, 2, 1, 1, 0); end; procedure TTestPBKDF_Scrypt.TestVectors; diff --git a/HashLib.Tests/src/TestVectors.pas b/HashLib.Tests/src/TestVectors.pas index 54d578ce..c00651f2 100644 --- a/HashLib.Tests/src/TestVectors.pas +++ b/HashLib.Tests/src/TestVectors.pas @@ -5263,7 +5263,7 @@ implementation class constructor TBlake2BPTestVectors.Blake2BPTestVectors; begin - FUnkeyedBlake2BP := Nil; + FUnkeyedBlake2BP := nil; FKeyedBlake2BP := THashLibStringArray.Create ('9D9461073E4EB640A255357B839F394B838C6FF57C9B686A3F76107C1066728F3C9956BD785CBC3BF79DC2AB578C5A0C063B9D9C405848DE1DBE821CD05C940A', @@ -5528,7 +5528,7 @@ implementation class constructor TBlake2SPTestVectors.Blake2SPTestVectors; begin - FUnkeyedBlake2SP := Nil; + FUnkeyedBlake2SP := nil; FKeyedBlake2SP := THashLibStringArray.Create ('715CB13895AEB678F6124160BFF21465B30F4F6874193FC851B4621043F09CC6', diff --git a/HashLib/src/Base/HlpHMACNotBuildInAdapter.pas b/HashLib/src/Base/HlpHMACNotBuildInAdapter.pas index d1af462f..86367360 100644 --- a/HashLib/src/Base/HlpHMACNotBuildInAdapter.pas +++ b/HashLib/src/Base/HlpHMACNotBuildInAdapter.pas @@ -64,19 +64,19 @@ procedure THMACNotBuildInAdapter.Clear(); function THMACNotBuildInAdapter.Clone(): IHash; var - HmacInstance: THMACNotBuildInAdapter; + LHmacInstance: THMACNotBuildInAdapter; begin - HmacInstance := THMACNotBuildInAdapter.Create(FHash.Clone(), FKey); - HmacInstance.FOpad := System.Copy(FOpad); - HmacInstance.FIpad := System.Copy(FIpad); - result := HmacInstance as IHash; - result.BufferSize := BufferSize; + LHmacInstance := THMACNotBuildInAdapter.Create(FHash.Clone(), FKey); + LHmacInstance.FOpad := System.Copy(FOpad); + LHmacInstance.FIpad := System.Copy(FIpad); + Result := LHmacInstance; + Result.BufferSize := BufferSize; end; constructor THMACNotBuildInAdapter.Create(const AUnderlyingHash: IHash; const AHMACKey: THashLibByteArray); begin - Inherited Create(AUnderlyingHash.HashSize, AUnderlyingHash.BlockSize); + inherited Create(AUnderlyingHash.HashSize, AUnderlyingHash.BlockSize); FHash := AUnderlyingHash; SetKey(AHMACKey); System.SetLength(FIpad, FHash.BlockSize); @@ -91,14 +91,14 @@ destructor THMACNotBuildInAdapter.Destroy; function THMACNotBuildInAdapter.GetKey: THashLibByteArray; begin - result := System.Copy(FKey); + Result := System.Copy(FKey); end; procedure THMACNotBuildInAdapter.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin - FKey := Nil; + FKey := nil; end else begin @@ -143,10 +143,10 @@ procedure THMACNotBuildInAdapter.Initialize; function THMACNotBuildInAdapter.TransformFinal: IHashResult; begin - result := FHash.TransformFinal(); + Result := FHash.TransformFinal(); FHash.TransformBytes(FOpad); - FHash.TransformBytes(result.GetBytes()); - result := FHash.TransformFinal(); + FHash.TransformBytes(Result.GetBytes()); + Result := FHash.TransformFinal(); Initialize(); end; @@ -163,19 +163,21 @@ procedure THMACNotBuildInAdapter.TransformBytes(const AData: THashLibByteArray; function THMACNotBuildInAdapter.GetName: String; begin - result := Format('%s(%s)', ['THMAC', FHash.Name]); + Result := Format('%s(%s)', ['THMAC', FHash.Name]); end; class function THMACNotBuildInAdapter.CreateHMAC(const AHash: IHash; const AHMACKey: THashLibByteArray): IHMAC; +var + LExisting: IHMAC; begin - if Supports(AHash, IHMAC) then + if Supports(AHash, IHMAC, LExisting) then begin - result := AHash as IHMAC; + Result := LExisting; end else begin - result := THMACNotBuildInAdapter.Create(AHash, AHMACKey); + Result := THMACNotBuildInAdapter.Create(AHash, AHMACKey); end; end; diff --git a/HashLib/src/Base/HlpHash.pas b/HashLib/src/Base/HlpHash.pas index f82b6486..d59864f3 100644 --- a/HashLib/src/Base/HlpHash.pas +++ b/HashLib/src/Base/HlpHash.pas @@ -27,7 +27,7 @@ THash = class abstract(TInterfacedObject, IHash) FBufferSize, FBlockSize, FHashSize: Int32; const - BUFFER_SIZE = Int32(64 * 1024); // 64Kb + DefaultBufferSize = Int32(64 * 1024); // 64Kb strict protected @@ -61,7 +61,7 @@ THash = class abstract(TInterfacedObject, IHash) function TransformFinal(): IHashResult; virtual; abstract; - function ComputeString(const AData: String; AEncoding: TEncoding) + function ComputeString(const AData: String; const AEncoding: TEncoding) : IHashResult; virtual; function ComputeBytes(const AData: THashLibByteArray): IHashResult; virtual; function ComputeUntyped(const AData; ALength: Int64): IHashResult; @@ -84,24 +84,24 @@ implementation constructor THash.Create(AHashSize, ABlockSize: Int32); begin - Inherited Create(); + inherited Create(); {$IFDEF DEBUG} System.Assert((ABlockSize > 0) or (ABlockSize = -1)); System.Assert((AHashSize > 0) or (AHashSize = -1)); {$ENDIF DEBUG} FBlockSize := ABlockSize; FHashSize := AHashSize; - FBufferSize := BUFFER_SIZE; + FBufferSize := DefaultBufferSize; end; function THash.GetName: String; begin - result := Self.ClassName; + Result := Self.ClassName; end; function THash.GetBufferSize: Int32; begin - result := FBufferSize; + Result := FBufferSize; end; procedure THash.SetBufferSize(AValue: Int32); @@ -118,7 +118,7 @@ procedure THash.SetBufferSize(AValue: Int32); function THash.GetBlockSize: Int32; begin - result := FBlockSize; + Result := FBlockSize; end; procedure THash.SetBlockSize(AValue: Int32); @@ -128,7 +128,7 @@ procedure THash.SetBlockSize(AValue: Int32); function THash.GetHashSize: Int32; begin - result := FHashSize; + Result := FHashSize; end; procedure THash.SetHashSize(AValue: Int32); @@ -136,17 +136,17 @@ procedure THash.SetHashSize(AValue: Int32); FHashSize := AValue; end; -function THash.ComputeString(const AData: String; AEncoding: TEncoding) +function THash.ComputeString(const AData: String; const AEncoding: TEncoding) : IHashResult; begin - result := ComputeBytes(TConverters.ConvertStringToBytes(AData, AEncoding)); + Result := ComputeBytes(TConverters.ConvertStringToBytes(AData, AEncoding)); end; function THash.ComputeUntyped(const AData; ALength: Int64): IHashResult; begin Initialize(); TransformUntyped(AData, ALength); - result := TransformFinal(); + Result := TransformFinal(); end; procedure THash.TransformUntyped(const AData; ALength: Int64); @@ -159,14 +159,14 @@ procedure THash.TransformUntyped(const AData; ALength: Int64); if BufferSize > ALength then // Sanity Check begin - LBufferSize := BUFFER_SIZE; + LBufferSize := BufferSize; end else begin LBufferSize := BufferSize; end; - if LPtrStart <> Nil then + if LPtrStart <> nil then begin System.SetLength(LBuffer, LBufferSize); LPtrEnd := LPtrStart + ALength; @@ -198,7 +198,7 @@ function THash.ComputeStream(const AStream: TStream; ALength: Int64) begin Initialize(); TransformStream(AStream, ALength); - result := TransformFinal(); + Result := TransformFinal(); end; function THash.ComputeFile(const AFileName: String; AFrom, ALength: Int64) @@ -206,7 +206,7 @@ function THash.ComputeFile(const AFileName: String; AFrom, ALength: Int64) begin Initialize(); TransformFile(AFileName, AFrom, ALength); - result := TransformFinal(); + Result := TransformFinal(); end; function THash.Clone(): IHash; @@ -219,7 +219,7 @@ function THash.ComputeBytes(const AData: THashLibByteArray): IHashResult; begin Initialize(); TransformBytes(AData); - result := TransformFinal(); + Result := TransformFinal(); end; procedure THash.TransformString(const AData: String; @@ -258,7 +258,7 @@ procedure THash.TransformStream(const AStream: TStream; ALength: Int64); System.Assert((ALength = -1) or (ALength > 0)); {$ENDIF DEBUG} LTotal := 0; - if (AStream <> Nil) then + if (AStream <> nil) then begin if (ALength > -1) then begin @@ -281,7 +281,7 @@ procedure THash.TransformStream(const AStream: TStream; ALength: Int64); if BufferSize > AStream.Size then // Sanity Check begin - LBufferSize := BUFFER_SIZE; + LBufferSize := BufferSize; end else begin @@ -293,7 +293,7 @@ procedure THash.TransformStream(const AStream: TStream; ALength: Int64); if (ALength = -1) then begin - while true do + while True do begin LRead := AStream.Read(LData[0], LBufferSize); @@ -312,7 +312,7 @@ procedure THash.TransformStream(const AStream: TStream; ALength: Int64); end else begin - while true do + while True do begin LRead := AStream.Read(LData[0], LBufferSize); diff --git a/HashLib/src/Base/HlpHashBuffer.pas b/HashLib/src/Base/HlpHashBuffer.pas index 81438543..491637d9 100644 --- a/HashLib/src/Base/HlpHashBuffer.pas +++ b/HashLib/src/Base/HlpHashBuffer.pas @@ -53,9 +53,9 @@ implementation function THashBuffer.Clone(): THashBuffer; begin - result := Default (THashBuffer); - result.FData := System.Copy(FData); - result.FPosition := FPosition; + Result := Default(THashBuffer); + Result.FData := System.Copy(FData); + Result.FPosition := FPosition; end; constructor THashBuffer.Create(ALength: Int32); @@ -69,7 +69,7 @@ constructor THashBuffer.Create(ALength: Int32); function THashBuffer.GetIsFull: Boolean; begin - result := FPosition = System.Length(FData); + Result := FPosition = System.Length(FData); end; function THashBuffer.Feed(AData: PByte; ADataLength: Int32; @@ -84,13 +84,13 @@ function THashBuffer.Feed(AData: PByte; ADataLength: Int32; {$ENDIF DEBUG} if (ADataLength = 0) then begin - result := false; + Result := False; Exit; end; if (ALength = 0) then begin - result := false; + Result := False; Exit; end; LLength := System.Length(FData) - FPosition; @@ -103,7 +103,7 @@ function THashBuffer.Feed(AData: PByte; ADataLength: Int32; FPosition := FPosition + LLength; - result := IsFull; + Result := IsFull; end; function THashBuffer.Feed(AData: PByte; ADataLength: Int32; @@ -119,13 +119,13 @@ function THashBuffer.Feed(AData: PByte; ADataLength: Int32; {$ENDIF DEBUG} if (ADataLength = 0) then begin - result := false; + Result := False; Exit; end; if (ALength = 0) then begin - result := false; + Result := False; Exit; end; @@ -143,7 +143,7 @@ function THashBuffer.Feed(AData: PByte; ADataLength: Int32; ALength := ALength - LLength; AProcessedBytesCount := AProcessedBytesCount + UInt64(LLength); - result := IsFull; + Result := IsFull; end; function THashBuffer.GetBytes: THashLibByteArray; @@ -152,7 +152,7 @@ function THashBuffer.GetBytes: THashLibByteArray; System.Assert(IsFull); {$ENDIF DEBUG} FPosition := 0; - result := FData; + Result := FData; end; function THashBuffer.GetBytesZeroPadded: THashLibByteArray; @@ -160,22 +160,22 @@ function THashBuffer.GetBytesZeroPadded: THashLibByteArray; TArrayUtils.Fill(FData, FPosition, (System.Length(FData) - FPosition) + FPosition, Byte(0)); FPosition := 0; - result := FData; + Result := FData; end; function THashBuffer.GetIsEmpty: Boolean; begin - result := FPosition = 0; + Result := FPosition = 0; end; function THashBuffer.GetLength: Int32; begin - result := System.Length(FData); + Result := System.Length(FData); end; function THashBuffer.GetPosition: Int32; begin - result := FPosition; + Result := FPosition; end; procedure THashBuffer.Initialize; @@ -186,7 +186,7 @@ procedure THashBuffer.Initialize; function THashBuffer.ToString: String; begin - result := Format(SHashBufferMessage, [Self.Length, Self.Position, + Result := Format(SHashBufferMessage, [Self.Length, Self.Position, BoolToStr(Self.IsEmpty, True)]); end; diff --git a/HashLib/src/Base/HlpHashCryptoNotBuildIn.pas b/HashLib/src/Base/HlpHashCryptoNotBuildIn.pas index a34054be..7fa4c0f7 100644 --- a/HashLib/src/Base/HlpHashCryptoNotBuildIn.pas +++ b/HashLib/src/Base/HlpHashCryptoNotBuildIn.pas @@ -39,7 +39,7 @@ implementation constructor TBlockHash.Create(AHashSize, ABlockSize, ABufferSize: Int32); begin - Inherited Create(AHashSize, ABlockSize); + inherited Create(AHashSize, ABlockSize); if (ABufferSize = -1) then begin ABufferSize := ABlockSize; @@ -112,7 +112,7 @@ function TBlockHash.TransformFinal: IHashResult; {$ENDIF DEBUG} Initialize(); - result := THashResult.Create(LTempResult); + Result := THashResult.Create(LTempResult); end; end. diff --git a/HashLib/src/Base/HlpHashFactory.pas b/HashLib/src/Base/HlpHashFactory.pas index e8914993..fdf46a59 100644 --- a/HashLib/src/Base/HlpHashFactory.pas +++ b/HashLib/src/Base/HlpHashFactory.pas @@ -394,16 +394,16 @@ TCrypto = class sealed(TObject) class function CreateKeccak_384(): IHash; static; class function CreateKeccak_512(): IHash; static; - class function CreateBlake2B(const AConfig: IBlake2BConfig = Nil; - const ATreeConfig: IBlake2BTreeConfig = Nil): IHash; static; + class function CreateBlake2B(const AConfig: IBlake2BConfig = nil; + const ATreeConfig: IBlake2BTreeConfig = nil): IHash; static; class function CreateBlake2B_160(): IHash; static; class function CreateBlake2B_256(): IHash; static; class function CreateBlake2B_384(): IHash; static; class function CreateBlake2B_512(): IHash; static; - class function CreateBlake2S(const AConfig: IBlake2SConfig = Nil; - const ATreeConfig: IBlake2STreeConfig = Nil): IHash; static; + class function CreateBlake2S(const AConfig: IBlake2SConfig = nil; + const ATreeConfig: IBlake2STreeConfig = nil): IHash; static; class function CreateBlake2S_128(): IHash; static; class function CreateBlake2S_160(): IHash; static; @@ -473,7 +473,7 @@ THMAC = class sealed(TObject) public class function CreateHMAC(const AHash: IHash; - const AHMACKey: THashLibByteArray = Nil): IHMAC; static; + const AHMACKey: THashLibByteArray = nil): IHMAC; static; end; @@ -551,7 +551,7 @@ TPBKDF2_HMAC = class sealed(TObject) /// The PKDF2_HMAC KDF Interface Instance
/// /// - /// The password, salt or algorithm is Nil. + /// The password, salt or algorithm is nil. /// /// /// The iteration is less than 1. @@ -585,7 +585,7 @@ TPBKDF_Argon2 = class sealed(TObject) /// The Argon2 KDF Interface Instance /// /// /// - /// The password or builder instance is Nil. + /// The password or builder instance is nil. /// class function CreatePBKDF_Argon2(const APassword: THashLibByteArray; const AArgon2Parameters: IArgon2Parameters): IPBKDF_Argon2; static; @@ -620,7 +620,7 @@ TPBKDF_Scrypt = class sealed(TObject) /// The PBKDF_Scrypt KDF Interface Instance
/// /// - /// The password, salt is Nil. + /// The password, salt is nil. /// /// /// The cost, blocksize or parallelism is Invalid. @@ -1175,7 +1175,7 @@ class function THashFactory.TCrypto.CreateBlake2B(const AConfig: IBlake2BConfig; LConfig: IBlake2BConfig; begin LConfig := AConfig; - if (LConfig = Nil) then + if (LConfig = nil) then begin LConfig := TBlake2BConfig.Create(); end; @@ -1212,7 +1212,7 @@ class function THashFactory.TCrypto.CreateBlake2S(const AConfig: IBlake2SConfig; LConfig: IBlake2SConfig; begin LConfig := AConfig; - if (LConfig = Nil) then + if (LConfig = nil) then begin LConfig := TBlake2SConfig.Create(); end; @@ -1409,18 +1409,18 @@ class function THashFactory.TXOF.CreateShake_128(AXofSizeInBits: UInt64): IHash; var LXof: IXOF; begin - LXof := (TShake_128.Create() as IXOF); + LXof := TShake_128.Create(); LXof.XOFSizeInBits := AXofSizeInBits; - Result := LXof as IHash; + Result := LXof; end; class function THashFactory.TXOF.CreateShake_256(AXofSizeInBits: UInt64): IHash; var LXof: IXOF; begin - LXof := (TShake_256.Create() as IXOF); + LXof := TShake_256.Create(); LXof.XOFSizeInBits := AXofSizeInBits; - Result := LXof as IHash; + Result := LXof; end; class function THashFactory.TXOF.CreateCShake_128(const AN, @@ -1428,9 +1428,9 @@ class function THashFactory.TXOF.CreateCShake_128(const AN, var LXof: IXOF; begin - LXof := (TCShake_128.Create(AN, &AS) as IXOF); + LXof := TCShake_128.Create(AN, &AS); LXof.XOFSizeInBits := AXofSizeInBits; - Result := LXof as IHash; + Result := LXof; end; class function THashFactory.TXOF.CreateCShake_256(const AN, @@ -1438,9 +1438,9 @@ class function THashFactory.TXOF.CreateCShake_256(const AN, var LXof: IXOF; begin - LXof := (TCShake_256.Create(AN, &AS) as IXOF); + LXof := TCShake_256.Create(AN, &AS); LXof.XOFSizeInBits := AXofSizeInBits; - Result := LXof as IHash; + Result := LXof; end; class function THashFactory.TXOF.CreateBlake2XS(const ABlake2XSConfig @@ -1448,9 +1448,9 @@ class function THashFactory.TXOF.CreateBlake2XS(const ABlake2XSConfig var LXof: IXOF; begin - LXof := (TBlake2XS.Create(ABlake2XSConfig) as IXOF); + LXof := TBlake2XS.Create(ABlake2XSConfig); LXof.XOFSizeInBits := AXofSizeInBits; - Result := LXof as IHash; + Result := LXof; end; class function THashFactory.TXOF.CreateBlake2XS(const AKey: THashLibByteArray; @@ -1460,7 +1460,7 @@ class function THashFactory.TXOF.CreateBlake2XS(const AKey: THashLibByteArray; begin LConfig := TBlake2SConfig.Create(32); LConfig.Key := AKey; - Result := CreateBlake2XS(TBlake2XSConfig.Create(LConfig, Nil), + Result := CreateBlake2XS(TBlake2XSConfig.Create(LConfig, nil), AXofSizeInBits); end; @@ -1469,9 +1469,9 @@ class function THashFactory.TXOF.CreateBlake2XB(const ABlake2XBConfig var LXof: IXOF; begin - LXof := (TBlake2XB.Create(ABlake2XBConfig) as IXOF); + LXof := TBlake2XB.Create(ABlake2XBConfig); LXof.XOFSizeInBits := AXofSizeInBits; - Result := LXof as IHash; + Result := LXof; end; class function THashFactory.TXOF.CreateBlake2XB(const AKey: THashLibByteArray; @@ -1481,7 +1481,7 @@ class function THashFactory.TXOF.CreateBlake2XB(const AKey: THashLibByteArray; begin LConfig := TBlake2BConfig.Create(64); LConfig.Key := AKey; - Result := CreateBlake2XB(TBlake2XBConfig.Create(LConfig, Nil), + Result := CreateBlake2XB(TBlake2XBConfig.Create(LConfig, nil), AXofSizeInBits); end; @@ -1490,9 +1490,9 @@ class function THashFactory.TXOF.CreateBlake3XOF(const AKey: THashLibByteArray; var LXof: IXOF; begin - LXof := (TBlake3XOF.Create(32, AKey) as IXOF); + LXof := TBlake3XOF.Create(32, AKey); LXof.XOFSizeInBits := AXofSizeInBits; - Result := LXof as IHash; + Result := LXof; end; class function THashFactory.TXOF.CreateKMAC128XOF(const AKMACKey, diff --git a/HashLib/src/Base/HlpHashResult.pas b/HashLib/src/Base/HlpHashResult.pas index 5fd5ddb8..8936eb19 100644 --- a/HashLib/src/Base/HlpHashResult.pas +++ b/HashLib/src/Base/HlpHashResult.pas @@ -48,51 +48,51 @@ implementation constructor THashResult.Create(AHash: UInt64); begin - Inherited Create(); + inherited Create(); System.SetLength(FHash, System.SizeOf(UInt64)); TConverters.ReadUInt64AsBytesBE(AHash, FHash, 0); end; constructor THashResult.Create(const AHash: THashLibByteArray); begin - Inherited Create(); + inherited Create(); FHash := AHash; end; constructor THashResult.Create(AHash: UInt32); begin - Inherited Create(); + inherited Create(); System.SetLength(FHash, System.SizeOf(UInt32)); TConverters.ReadUInt32AsBytesBE(AHash, FHash, 0); end; constructor THashResult.Create(AHash: UInt8); begin - Inherited Create(); + inherited Create(); FHash := THashLibByteArray.Create(AHash); end; constructor THashResult.Create(AHash: UInt16); begin - Inherited Create(); + inherited Create(); FHash := THashLibByteArray.Create(Byte(AHash shr 8), Byte(AHash)); end; constructor THashResult.Create(AHash: Int32); begin - Inherited Create(); + inherited Create(); FHash := THashLibByteArray.Create(Byte(TBits.Asr32(AHash, 24)), Byte(TBits.Asr32(AHash, 16)), Byte(TBits.Asr32(AHash, 8)), Byte(AHash)); end; function THashResult.Equals(const AHashResult: IHashResult): Boolean; begin - result := TArrayUtils.ConstantTimeAreEqual(AHashResult.GetBytes(), FHash); + Result := TArrayUtils.ConstantTimeAreEqual(AHashResult.GetBytes(), FHash); end; function THashResult.GetBytes: THashLibByteArray; begin - result := FHash; + Result := FHash; end; function THashResult.GetInt32: Int32; @@ -103,7 +103,7 @@ function THashResult.GetInt32: Int32; @SDifferingSizeOfByteArrayAndIntType, [System.Length(FHash), sizeof(Int32)]); end; - result := Int32((Int32(FHash[0]) shl 24) or (Int32(FHash[1]) shl 16) or + Result := Int32((Int32(FHash[0]) shl 24) or (Int32(FHash[1]) shl 16) or (Int32(FHash[2]) shl 8) or (Int32(FHash[3]))); end; @@ -115,7 +115,7 @@ function THashResult.GetUInt8: UInt8; @SDifferingSizeOfByteArrayAndIntType, [System.Length(FHash), sizeof(UInt8)]); end; - result := (UInt8(FHash[0])); + Result := (UInt8(FHash[0])); end; function THashResult.GetUInt16: UInt16; @@ -126,7 +126,7 @@ function THashResult.GetUInt16: UInt16; @SDifferingSizeOfByteArrayAndIntType, [System.Length(FHash), sizeof(UInt16)]); end; - result := (UInt16(FHash[0]) shl 8) or (UInt16(FHash[1])); + Result := (UInt16(FHash[0]) shl 8) or (UInt16(FHash[1])); end; function THashResult.GetUInt32: UInt32; @@ -137,7 +137,7 @@ function THashResult.GetUInt32: UInt32; @SDifferingSizeOfByteArrayAndIntType, [System.Length(FHash), sizeof(UInt32)]); end; - result := TConverters.ReadBytesAsUInt32BE(PByte(FHash), 0); + Result := TConverters.ReadBytesAsUInt32BE(PByte(FHash), 0); end; function THashResult.GetUInt64: UInt64; @@ -148,12 +148,12 @@ function THashResult.GetUInt64: UInt64; @SDifferingSizeOfByteArrayAndIntType, [System.Length(FHash), sizeof(UInt64)]); end; - result := TConverters.ReadBytesAsUInt64BE(PByte(FHash), 0); + Result := TConverters.ReadBytesAsUInt64BE(PByte(FHash), 0); end; function THashResult.ToString(AGroup: Boolean): String; begin - result := TConverters.ConvertBytesToHexString(FHash, AGroup); + Result := TConverters.ConvertBytesToHexString(FHash, AGroup); end; end. diff --git a/HashLib/src/Base/HlpKDF.pas b/HashLib/src/Base/HlpKDF.pas index d744e329..f81a6e54 100644 --- a/HashLib/src/Base/HlpKDF.pas +++ b/HashLib/src/Base/HlpKDF.pas @@ -42,7 +42,7 @@ implementation constructor TKDF.Create; begin - Inherited Create(); + inherited Create(); end; end. diff --git a/HashLib/src/Base/HlpMultipleTransformNonBlock.pas b/HashLib/src/Base/HlpMultipleTransformNonBlock.pas index 43610af1..17ebe894 100644 --- a/HashLib/src/Base/HlpMultipleTransformNonBlock.pas +++ b/HashLib/src/Base/HlpMultipleTransformNonBlock.pas @@ -44,7 +44,7 @@ implementation function TMultipleTransformNonBlock.Aggregate: THashLibByteArray; begin - Result := Nil; + Result := nil; if FBuffer.Size > 0 then begin FBuffer.Position := 0; @@ -55,7 +55,7 @@ function TMultipleTransformNonBlock.Aggregate: THashLibByteArray; constructor TMultipleTransformNonBlock.Create(AHashSize, ABlockSize: Int32); begin - Inherited Create(AHashSize, ABlockSize); + inherited Create(AHashSize, ABlockSize); FBuffer := TMemoryStream.Create(); end; diff --git a/HashLib/src/Checksum/HlpAdler32.pas b/HashLib/src/Checksum/HlpAdler32.pas index ddb99436..8d2d0b45 100644 --- a/HashLib/src/Checksum/HlpAdler32.pas +++ b/HashLib/src/Checksum/HlpAdler32.pas @@ -18,10 +18,10 @@ TAdler32 = class sealed(THash, IChecksum, IHash32, ITransformBlock) strict private var - FA, FB: UInt32; + FSumA, FSumB: UInt32; const - MOD_ADLER = UInt32(65521); + ModAdler = UInt32(65521); public constructor Create(); @@ -42,29 +42,29 @@ function TAdler32.Clone(): IHash; LHashInstance: TAdler32; begin LHashInstance := TAdler32.Create(); - LHashInstance.FA := FA; - LHashInstance.FB := FB; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + LHashInstance.FSumA := FSumA; + LHashInstance.FSumB := FSumB; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TAdler32.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TAdler32.Initialize; begin - FA := 1; - FB := 0; + FSumA := 1; + FSumB := 0; end; procedure TAdler32.TransformBytes(const AData: THashLibByteArray; AIndex, ALength: Int32); var - LN: Int32; + LChunkLength: Int32; LPtrData: PByte; - LA, LB: UInt32; + LSumA, LSumB: UInt32; begin {$IFDEF DEBUG} System.Assert(AIndex >= 0); @@ -74,17 +74,17 @@ procedure TAdler32.TransformBytes(const AData: THashLibByteArray; LPtrData := PByte(AData) + AIndex; { - LA := FA; - LB := FB; + LSumA := FSumA; + LSumB := FSumB; while ALength > 0 do begin - LA := (LA + LPtrData^) mod MOD_ADLER; - LB := (LB + LA) mod MOD_ADLER; + LSumA := (LSumA + LPtrData^) mod ModAdler; + LSumB := (LSumB + LSumA) mod ModAdler; System.Inc(LPtrData); System.Dec(ALength); end; - FA := LA; - FB := LB; + FSumA := LSumA; + FSumB := LSumB; } // lifted from PngEncoder Adler32.cs @@ -92,29 +92,29 @@ procedure TAdler32.TransformBytes(const AData: THashLibByteArray; while ALength > 0 do begin // We can defer the modulo operation: - // FA maximally grows from 65521 to 65521 + 255 * 3800 - // FB maximally grows by 3800 * median(FA) = 2090079800 < 2^31 - LN := 3800; - if (LN > ALength) then + // FSumA maximally grows from 65521 to 65521 + 255 * 3800 + // FSumB maximally grows by 3800 * median(FSumA) = 2090079800 < 2^31 + LChunkLength := 3800; + if (LChunkLength > ALength) then begin - LN := ALength; + LChunkLength := ALength; end; - ALength := ALength - LN; + ALength := ALength - LChunkLength; - LA := FA; - LB := FB; - while (LN - 1) >= 0 do + LSumA := FSumA; + LSumB := FSumB; + while (LChunkLength - 1) >= 0 do begin - LA := (LA + LPtrData^); - LB := (LB + LA); + LSumA := (LSumA + LPtrData^); + LSumB := (LSumB + LSumA); System.Inc(LPtrData); - System.Dec(LN); + System.Dec(LChunkLength); end; - LA := LA mod MOD_ADLER; - LB := LB mod MOD_ADLER; + LSumA := LSumA mod ModAdler; + LSumB := LSumB mod ModAdler; - FA := LA; - FB := LB; + FSumA := LSumA; + FSumB := LSumB; end; end; @@ -123,9 +123,9 @@ function TAdler32.TransformFinal: IHashResult; LBufferBytes: THashLibByteArray; begin System.SetLength(LBufferBytes, HashSize); - TConverters.ReadUInt32AsBytesBE(UInt32((FB shl 16) or FA), LBufferBytes, 0); + TConverters.ReadUInt32AsBytesBE(UInt32((FSumB shl 16) or FSumA), LBufferBytes, 0); - result := THashResult.Create(LBufferBytes); + Result := THashResult.Create(LBufferBytes); Initialize(); end; diff --git a/HashLib/src/Checksum/HlpCRC.pas b/HashLib/src/Checksum/HlpCRC.pas index 0e868a40..d8589848 100644 --- a/HashLib/src/Checksum/HlpCRC.pas +++ b/HashLib/src/Checksum/HlpCRC.pas @@ -652,42 +652,42 @@ implementation function TCRC.GetCheckValue: UInt64; begin - result := FCheckValue; + Result := FCheckValue; end; function TCRC.GetInitialValue: UInt64; begin - result := FInitialValue; + Result := FInitialValue; end; function TCRC.GetNames: THashLibStringArray; begin - result := FNames; + Result := FNames; end; function TCRC.GetPolynomial: UInt64; begin - result := FPolynomial; + Result := FPolynomial; end; function TCRC.GetIsInputReflected: Boolean; begin - result := FIsInputReflected; + Result := FIsInputReflected; end; function TCRC.GetIsOutputReflected: Boolean; begin - result := FIsOutputReflected; + Result := FIsOutputReflected; end; function TCRC.GetWidth: Int32; begin - result := FWidth; + Result := FWidth; end; function TCRC.GetOutputXor: UInt64; begin - result := FOutputXor; + Result := FOutputXor; end; procedure TCRC.SetCheckValue(AValue: UInt64); @@ -732,7 +732,7 @@ procedure TCRC.SetOutputXor(AValue: UInt64); function TCRC.GetName: String; begin - result := Format('T%s', [(Self as ICRC).Names[0]]); + Result := Format('T%s', [Names[0]]); end; procedure TCRC.CalculateCRCbyTable(AData: PByte; ADataLength, AIndex: Int32); @@ -816,8 +816,8 @@ function TCRC.Clone(): IHash; LHashInstance.FHash := FHash; LHashInstance.FIsTableGenerated := FIsTableGenerated; LHashInstance.FCRCTable := System.Copy(FCRCTable); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TCRC.Create(AWidth: Int32; APolynomial, AInitial: UInt64; @@ -833,7 +833,7 @@ constructor TCRC.Create(AWidth: Int32; APolynomial, AInitial: UInt64; FIsTableGenerated := False; - Inherited Create(-1, -1); // Dummy State + inherited Create(-1, -1); // Dummy State case AWidth of 0 .. 7: @@ -880,452 +880,452 @@ class function TCRC.CreateCRCObject(AValue: TCRCStandard): ICRC; case AValue of TCRCStandard.CRC3_GSM: - result := TCRC.Create(3, $3, $0, False, False, $7, $4, + Result := TCRC.Create(3, $3, $0, False, False, $7, $4, THashLibStringArray.Create('CRC-3/GSM')); TCRCStandard.CRC3_ROHC: - result := TCRC.Create(3, $3, $7, True, True, $0, $6, + Result := TCRC.Create(3, $3, $7, True, True, $0, $6, THashLibStringArray.Create('CRC-3/ROHC')); TCRCStandard.CRC4_INTERLAKEN: - result := TCRC.Create(4, $3, $F, False, False, $F, $B, + Result := TCRC.Create(4, $3, $F, False, False, $F, $B, THashLibStringArray.Create('CRC-4/INTERLAKEN')); TCRCStandard.CRC4_ITU: - result := TCRC.Create(4, $3, $0, True, True, $0, $7, + Result := TCRC.Create(4, $3, $0, True, True, $0, $7, THashLibStringArray.Create('CRC-4/ITU', 'CRC-4/G-704')); TCRCStandard.CRC5_EPC: - result := TCRC.Create(5, $9, $9, False, False, $00, $00, + Result := TCRC.Create(5, $9, $9, False, False, $00, $00, THashLibStringArray.Create('CRC-5/EPC', 'CRC-5/EPC-C1G2')); TCRCStandard.CRC5_ITU: - result := TCRC.Create(5, $15, $00, True, True, $00, $07, + Result := TCRC.Create(5, $15, $00, True, True, $00, $07, THashLibStringArray.Create('CRC-5/ITU', 'CRC-5/G-704')); TCRCStandard.CRC5_USB: - result := TCRC.Create(5, $05, $1F, True, True, $1F, $19, + Result := TCRC.Create(5, $05, $1F, True, True, $1F, $19, THashLibStringArray.Create('CRC-5/USB')); TCRCStandard.CRC6_CDMA2000A: - result := TCRC.Create(6, $27, $3F, False, False, $00, $0D, + Result := TCRC.Create(6, $27, $3F, False, False, $00, $0D, THashLibStringArray.Create('CRC-6/CDMA2000-A')); TCRCStandard.CRC6_CDMA2000B: - result := TCRC.Create(6, $07, $3F, False, False, $00, $3B, + Result := TCRC.Create(6, $07, $3F, False, False, $00, $3B, THashLibStringArray.Create('CRC-6/CDMA2000-B')); TCRCStandard.CRC6_DARC: - result := TCRC.Create(6, $19, $00, True, True, $00, $26, + Result := TCRC.Create(6, $19, $00, True, True, $00, $26, THashLibStringArray.Create('CRC-6/DARC')); TCRCStandard.CRC6_GSM: - result := TCRC.Create(6, $2F, $00, False, False, $3F, $13, + Result := TCRC.Create(6, $2F, $00, False, False, $3F, $13, THashLibStringArray.Create('CRC-6/GSM')); TCRCStandard.CRC6_ITU: - result := TCRC.Create(6, $03, $00, True, True, $00, $06, + Result := TCRC.Create(6, $03, $00, True, True, $00, $06, THashLibStringArray.Create('CRC-6/ITU', 'CRC-6/G-704')); TCRCStandard.CRC7: - result := TCRC.Create(7, $09, $00, False, False, $00, $75, + Result := TCRC.Create(7, $09, $00, False, False, $00, $75, THashLibStringArray.Create('CRC-7', 'CRC-7/MMC')); TCRCStandard.CRC7_ROHC: - result := TCRC.Create(7, $4F, $7F, True, True, $00, $53, + Result := TCRC.Create(7, $4F, $7F, True, True, $00, $53, THashLibStringArray.Create('CRC-7/ROHC')); TCRCStandard.CRC7_UMTS: - result := TCRC.Create(7, $45, $00, False, False, $00, $61, + Result := TCRC.Create(7, $45, $00, False, False, $00, $61, THashLibStringArray.Create('CRC-7/UMTS')); TCRCStandard.CRC8: - result := TCRC.Create(8, $07, $00, False, False, $00, $F4, + Result := TCRC.Create(8, $07, $00, False, False, $00, $F4, THashLibStringArray.Create('CRC-8', 'CRC-8/SMBUS')); TCRCStandard.CRC8_AUTOSAR: - result := TCRC.Create(8, $2F, $FF, False, False, $FF, $DF, + Result := TCRC.Create(8, $2F, $FF, False, False, $FF, $DF, THashLibStringArray.Create('CRC-8/AUTOSAR')); TCRCStandard.CRC8_BLUETOOTH: - result := TCRC.Create(8, $A7, $00, True, True, $00, $26, + Result := TCRC.Create(8, $A7, $00, True, True, $00, $26, THashLibStringArray.Create('CRC-8/BLUETOOTH')); TCRCStandard.CRC8_CDMA2000: - result := TCRC.Create(8, $9B, $FF, False, False, $00, $DA, + Result := TCRC.Create(8, $9B, $FF, False, False, $00, $DA, THashLibStringArray.Create('CRC-8/CDMA2000')); TCRCStandard.CRC8_DARC: - result := TCRC.Create(8, $39, $00, True, True, $00, $15, + Result := TCRC.Create(8, $39, $00, True, True, $00, $15, THashLibStringArray.Create('CRC-8/DARC')); TCRCStandard.CRC8_DVBS2: - result := TCRC.Create(8, $D5, $00, False, False, $00, $BC, + Result := TCRC.Create(8, $D5, $00, False, False, $00, $BC, THashLibStringArray.Create('CRC-8/DVB-S2')); TCRCStandard.CRC8_EBU: - result := TCRC.Create(8, $1D, $FF, True, True, $00, $97, + Result := TCRC.Create(8, $1D, $FF, True, True, $00, $97, THashLibStringArray.Create('CRC-8/EBU', 'CRC-8/AES', 'CRC-8/TECH-3250')); TCRCStandard.CRC8_GSMA: - result := TCRC.Create(8, $1D, $00, False, False, $00, $37, + Result := TCRC.Create(8, $1D, $00, False, False, $00, $37, THashLibStringArray.Create('CRC-8/GSM-A')); TCRCStandard.CRC8_GSMB: - result := TCRC.Create(8, $49, $00, False, False, $FF, $94, + Result := TCRC.Create(8, $49, $00, False, False, $FF, $94, THashLibStringArray.Create('CRC-8/GSM-B')); TCRCStandard.CRC8_ICODE: - result := TCRC.Create(8, $1D, $FD, False, False, $00, $7E, + Result := TCRC.Create(8, $1D, $FD, False, False, $00, $7E, THashLibStringArray.Create('CRC-8/I-CODE')); TCRCStandard.CRC8_ITU: - result := TCRC.Create(8, $07, $00, False, False, $55, $A1, + Result := TCRC.Create(8, $07, $00, False, False, $55, $A1, THashLibStringArray.Create('CRC-8/ITU', 'CRC-8/I-432-1')); TCRCStandard.CRC8_LTE: - result := TCRC.Create(8, $9B, $00, False, False, $00, $EA, + Result := TCRC.Create(8, $9B, $00, False, False, $00, $EA, THashLibStringArray.Create('CRC-8/LTE')); TCRCStandard.CRC8_MAXIM: - result := TCRC.Create(8, $31, $00, True, True, $00, $A1, + Result := TCRC.Create(8, $31, $00, True, True, $00, $A1, THashLibStringArray.Create('CRC-8/MAXIM', 'DOW-CRC', 'CRC-8/MAXIM-DOW')); TCRCStandard.CRC8_OPENSAFETY: - result := TCRC.Create(8, $2F, $00, False, False, $00, $3E, + Result := TCRC.Create(8, $2F, $00, False, False, $00, $3E, THashLibStringArray.Create('CRC-8/OPENSAFETY')); TCRCStandard.CRC8_ROHC: - result := TCRC.Create(8, $07, $FF, True, True, $00, $D0, + Result := TCRC.Create(8, $07, $FF, True, True, $00, $D0, THashLibStringArray.Create('CRC-8/ROHC')); TCRCStandard.CRC8_SAEJ1850: - result := TCRC.Create(8, $1D, $FF, False, False, $FF, $4B, + Result := TCRC.Create(8, $1D, $FF, False, False, $FF, $4B, THashLibStringArray.Create('CRC-8/SAE-J1850')); TCRCStandard.CRC8_WCDMA: - result := TCRC.Create(8, $9B, $00, True, True, $00, $25, + Result := TCRC.Create(8, $9B, $00, True, True, $00, $25, THashLibStringArray.Create('CRC-8/WCDMA')); TCRCStandard.CRC8_MIFAREMAD: - result := TCRC.Create(8, $1D, $C7, False, False, $00, $99, + Result := TCRC.Create(8, $1D, $C7, False, False, $00, $99, THashLibStringArray.Create('CRC-8/MIFARE-MAD')); TCRCStandard.CRC8_NRSC5: - result := TCRC.Create(8, $31, $FF, False, False, $00, $F7, + Result := TCRC.Create(8, $31, $FF, False, False, $00, $F7, THashLibStringArray.Create('CRC-8/NRSC-5')); TCRCStandard.CRC10: - result := TCRC.Create(10, $233, $000, False, False, $000, $199, + Result := TCRC.Create(10, $233, $000, False, False, $000, $199, THashLibStringArray.Create('CRC-10', 'CRC-10/ATM', 'CRC-10/I-610')); TCRCStandard.CRC10_CDMA2000: - result := TCRC.Create(10, $3D9, $3FF, False, False, $000, $233, + Result := TCRC.Create(10, $3D9, $3FF, False, False, $000, $233, THashLibStringArray.Create('CRC-10/CDMA2000')); TCRCStandard.CRC10_GSM: - result := TCRC.Create(10, $175, $000, False, False, $3FF, $12A, + Result := TCRC.Create(10, $175, $000, False, False, $3FF, $12A, THashLibStringArray.Create('CRC-10/GSM')); TCRCStandard.CRC11: - result := TCRC.Create(11, $385, $01A, False, False, $000, $5A3, + Result := TCRC.Create(11, $385, $01A, False, False, $000, $5A3, THashLibStringArray.Create('CRC-11', 'CRC-11/FLEXRAY')); TCRCStandard.CRC11_UMTS: - result := TCRC.Create(11, $307, $000, False, False, $000, $061, + Result := TCRC.Create(11, $307, $000, False, False, $000, $061, THashLibStringArray.Create('CRC-11/UMTS')); TCRCStandard.CRC12_CDMA2000: - result := TCRC.Create(12, $F13, $FFF, False, False, $000, $D4D, + Result := TCRC.Create(12, $F13, $FFF, False, False, $000, $D4D, THashLibStringArray.Create('CRC-12/CDMA2000')); TCRCStandard.CRC12_DECT: - result := TCRC.Create(12, $80F, $000, False, False, $000, $F5B, + Result := TCRC.Create(12, $80F, $000, False, False, $000, $F5B, THashLibStringArray.Create('CRC-12/DECT', 'X-CRC-12')); TCRCStandard.CRC12_GSM: - result := TCRC.Create(12, $D31, $000, False, False, $FFF, $B34, + Result := TCRC.Create(12, $D31, $000, False, False, $FFF, $B34, THashLibStringArray.Create('CRC-12/GSM')); TCRCStandard.CRC12_UMTS: - result := TCRC.Create(12, $80F, $000, False, True, $000, $DAF, + Result := TCRC.Create(12, $80F, $000, False, True, $000, $DAF, THashLibStringArray.Create('CRC-12/UMTS', 'CRC-12/3GPP')); TCRCStandard.CRC13_BBC: - result := TCRC.Create(13, $1CF5, $0000, False, False, $0000, $04FA, + Result := TCRC.Create(13, $1CF5, $0000, False, False, $0000, $04FA, THashLibStringArray.Create('CRC-13/BBC')); TCRCStandard.CRC14_DARC: - result := TCRC.Create(14, $0805, $0000, True, True, $0000, $082D, + Result := TCRC.Create(14, $0805, $0000, True, True, $0000, $082D, THashLibStringArray.Create('CRC-14/DARC')); TCRCStandard.CRC14_GSM: - result := TCRC.Create(14, $202D, $0000, False, False, $3FFF, $30AE, + Result := TCRC.Create(14, $202D, $0000, False, False, $3FFF, $30AE, THashLibStringArray.Create('CRC-14/GSM')); TCRCStandard.CRC15: - result := TCRC.Create(15, $4599, $0000, False, False, $0000, $059E, + Result := TCRC.Create(15, $4599, $0000, False, False, $0000, $059E, THashLibStringArray.Create('CRC-15', 'CRC-15/CAN')); TCRCStandard.CRC15_MPT1327: - result := TCRC.Create(15, $6815, $0000, False, False, $0001, $2566, + Result := TCRC.Create(15, $6815, $0000, False, False, $0001, $2566, THashLibStringArray.Create('CRC-15/MPT1327')); TCRCStandard.ARC: - result := TCRC.Create(16, $8005, $0000, True, True, $0000, $BB3D, + Result := TCRC.Create(16, $8005, $0000, True, True, $0000, $BB3D, THashLibStringArray.Create('CRC-16', 'ARC', 'CRC-IBM', 'CRC-16/ARC', 'CRC-16/LHA')); TCRCStandard.CRC16_AUGCCITT: - result := TCRC.Create(16, $1021, $1D0F, False, False, $0000, $E5CC, + Result := TCRC.Create(16, $1021, $1D0F, False, False, $0000, $E5CC, THashLibStringArray.Create('CRC-16/AUG-CCITT', 'CRC-16/SPI-FUJITSU')); TCRCStandard.CRC16_BUYPASS: - result := TCRC.Create(16, $8005, $0000, False, False, $0000, $FEE8, + Result := TCRC.Create(16, $8005, $0000, False, False, $0000, $FEE8, THashLibStringArray.Create('CRC-16/BUYPASS', 'CRC-16/VERIFONE', 'CRC-16/UMTS')); TCRCStandard.CRC16_CCITTFALSE: - result := TCRC.Create(16, $1021, $FFFF, False, False, $0000, $29B1, - THashLibStringArray.Create('CRC-16/CCITT-FALSE', 'CRC-16/AUTOSAR', + Result := TCRC.Create(16, $1021, $FFFF, False, False, $0000, $29B1, + THashLibStringArray.Create('CRC-16/CCITT-False', 'CRC-16/AUTOSAR', 'CRC-16/IBM-3740')); TCRCStandard.CRC16_CDMA2000: - result := TCRC.Create(16, $C867, $FFFF, False, False, $0000, $4C06, + Result := TCRC.Create(16, $C867, $FFFF, False, False, $0000, $4C06, THashLibStringArray.Create('CRC-16/CDMA2000')); TCRCStandard.CRC16_CMS: - result := TCRC.Create(16, $8005, $FFFF, False, False, $0000, $AEE7, + Result := TCRC.Create(16, $8005, $FFFF, False, False, $0000, $AEE7, THashLibStringArray.Create('CRC-16/CMS')); TCRCStandard.CRC16_DDS110: - result := TCRC.Create(16, $8005, $800D, False, False, $0000, $9ECF, + Result := TCRC.Create(16, $8005, $800D, False, False, $0000, $9ECF, THashLibStringArray.Create('CRC-16/DDS-110')); TCRCStandard.CRC16_DECTR: - result := TCRC.Create(16, $0589, $0000, False, False, $0001, $007E, + Result := TCRC.Create(16, $0589, $0000, False, False, $0001, $007E, THashLibStringArray.Create('CRC-16/DECT-R', 'R-CRC-16')); TCRCStandard.CRC16_DECTX: - result := TCRC.Create(16, $0589, $0000, False, False, $0000, $007F, + Result := TCRC.Create(16, $0589, $0000, False, False, $0000, $007F, THashLibStringArray.Create('CRC-16/DECT-X', 'X-CRC-16')); TCRCStandard.CRC16_DNP: - result := TCRC.Create(16, $3D65, $0000, True, True, $FFFF, $EA82, + Result := TCRC.Create(16, $3D65, $0000, True, True, $FFFF, $EA82, THashLibStringArray.Create('CRC-16/DNP')); TCRCStandard.CRC16_EN13757: - result := TCRC.Create(16, $3D65, $0000, False, False, $FFFF, $C2B7, + Result := TCRC.Create(16, $3D65, $0000, False, False, $FFFF, $C2B7, THashLibStringArray.Create('CRC-16/EN13757')); TCRCStandard.CRC16_GENIBUS: - result := TCRC.Create(16, $1021, $FFFF, False, False, $FFFF, $D64E, + Result := TCRC.Create(16, $1021, $FFFF, False, False, $FFFF, $D64E, THashLibStringArray.Create('CRC-16/GENIBUS', 'CRC-16/EPC', 'CRC-16/I-CODE', 'CRC-16/DARC', 'CRC-16/EPC-C1G2')); TCRCStandard.CRC16_GSM: - result := TCRC.Create(16, $1021, $0000, False, False, $FFFF, $CE3C, + Result := TCRC.Create(16, $1021, $0000, False, False, $FFFF, $CE3C, THashLibStringArray.Create('CRC-16/GSM')); TCRCStandard.CRC16_LJ1200: - result := TCRC.Create(16, $6F63, $0000, False, False, $0000, $BDF4, + Result := TCRC.Create(16, $6F63, $0000, False, False, $0000, $BDF4, THashLibStringArray.Create('CRC-16/LJ1200')); TCRCStandard.CRC16_MAXIM: - result := TCRC.Create(16, $8005, $0000, True, True, $FFFF, $44C2, + Result := TCRC.Create(16, $8005, $0000, True, True, $FFFF, $44C2, THashLibStringArray.Create('CRC-16/MAXIM', 'CRC-16/MAXIM-DOW')); TCRCStandard.CRC16_MCRF4XX: - result := TCRC.Create(16, $1021, $FFFF, True, True, $0000, $6F91, + Result := TCRC.Create(16, $1021, $FFFF, True, True, $0000, $6F91, THashLibStringArray.Create('CRC-16/MCRF4XX')); TCRCStandard.CRC16_OPENSAFETYA: - result := TCRC.Create(16, $5935, $0000, False, False, $0000, $5D38, + Result := TCRC.Create(16, $5935, $0000, False, False, $0000, $5D38, THashLibStringArray.Create('CRC-16/OPENSAFETY-A')); TCRCStandard.CRC16_OPENSAFETYB: - result := TCRC.Create(16, $755B, $0000, False, False, $0000, $20FE, + Result := TCRC.Create(16, $755B, $0000, False, False, $0000, $20FE, THashLibStringArray.Create('CRC-16/OPENSAFETY-B')); TCRCStandard.CRC16_PROFIBUS: - result := TCRC.Create(16, $1DCF, $FFFF, False, False, $FFFF, $A819, + Result := TCRC.Create(16, $1DCF, $FFFF, False, False, $FFFF, $A819, THashLibStringArray.Create('CRC-16/PROFIBUS', 'CRC-16/IEC-61158-2')); TCRCStandard.CRC16_RIELLO: - result := TCRC.Create(16, $1021, $B2AA, True, True, $0000, $63D0, + Result := TCRC.Create(16, $1021, $B2AA, True, True, $0000, $63D0, THashLibStringArray.Create('CRC-16/RIELLO')); TCRCStandard.CRC16_T10DIF: - result := TCRC.Create(16, $8BB7, $0000, False, False, $0000, $D0DB, + Result := TCRC.Create(16, $8BB7, $0000, False, False, $0000, $D0DB, THashLibStringArray.Create('CRC-16/T10-DIF')); TCRCStandard.CRC16_TELEDISK: - result := TCRC.Create(16, $A097, $0000, False, False, $0000, $0FB3, + Result := TCRC.Create(16, $A097, $0000, False, False, $0000, $0FB3, THashLibStringArray.Create('CRC-16/TELEDISK')); TCRCStandard.CRC16_TMS37157: - result := TCRC.Create(16, $1021, $89EC, True, True, $0000, $26B1, + Result := TCRC.Create(16, $1021, $89EC, True, True, $0000, $26B1, THashLibStringArray.Create('CRC-16/TMS37157')); TCRCStandard.CRC16_USB: - result := TCRC.Create(16, $8005, $FFFF, True, True, $FFFF, $B4C8, + Result := TCRC.Create(16, $8005, $FFFF, True, True, $FFFF, $B4C8, THashLibStringArray.Create('CRC-16/USB')); TCRCStandard.CRCA: - result := TCRC.Create(16, $1021, $C6C6, True, True, $0000, $BF05, + Result := TCRC.Create(16, $1021, $C6C6, True, True, $0000, $BF05, THashLibStringArray.Create('CRC-A', 'CRC-16/ISO-IEC-14443-3-A')); TCRCStandard.KERMIT: - result := TCRC.Create(16, $1021, $0000, True, True, $0000, $2189, + Result := TCRC.Create(16, $1021, $0000, True, True, $0000, $2189, THashLibStringArray.Create('KERMIT', 'CRC-16/CCITT', - 'CRC-16/CCITT-TRUE', 'CRC-CCITT', 'CRC-16/KERMIT', 'CRC-16/V-41-LSB')); + 'CRC-16/CCITT-True', 'CRC-CCITT', 'CRC-16/KERMIT', 'CRC-16/V-41-LSB')); TCRCStandard.MODBUS: - result := TCRC.Create(16, $8005, $FFFF, True, True, $0000, $4B37, + Result := TCRC.Create(16, $8005, $FFFF, True, True, $0000, $4B37, THashLibStringArray.Create('MODBUS', 'CRC-16/MODBUS')); TCRCStandard.X25: - result := TCRC.Create(16, $1021, $FFFF, True, True, $FFFF, $906E, + Result := TCRC.Create(16, $1021, $FFFF, True, True, $FFFF, $906E, THashLibStringArray.Create('X-25', 'CRC-16/IBM-SDLC', 'CRC-16/ISO-HDLC', 'CRC-16/ISO-IEC-14443-3-B', 'CRC-B', 'CRC-16/X-25')); TCRCStandard.XMODEM: - result := TCRC.Create(16, $1021, $0000, False, False, $0000, $31C3, + Result := TCRC.Create(16, $1021, $0000, False, False, $0000, $31C3, THashLibStringArray.Create('XMODEM', 'ZMODEM', 'CRC-16/ACORN', 'CRC-16/XMODEM', 'CRC-16/V-41-MSB')); TCRCStandard.CRC16_NRSC5: - result := TCRC.Create(16, $080B, $FFFF, True, True, $0000, $A066, + Result := TCRC.Create(16, $080B, $FFFF, True, True, $0000, $A066, THashLibStringArray.Create('CRC-16/NRSC-5')); TCRCStandard.CRC17_CANFD: - result := TCRC.Create(17, $1685B, $00000, False, False, $00000, $04F03, + Result := TCRC.Create(17, $1685B, $00000, False, False, $00000, $04F03, THashLibStringArray.Create('CRC-17/CAN-FD')); TCRCStandard.CRC21_CANFD: - result := TCRC.Create(21, $102899, $00000, False, False, $00000, $0ED841, + Result := TCRC.Create(21, $102899, $00000, False, False, $00000, $0ED841, THashLibStringArray.Create('CRC-21/CAN-FD')); TCRCStandard.CRC24: - result := TCRC.Create(24, $864CFB, $B704CE, False, False, $000000, + Result := TCRC.Create(24, $864CFB, $B704CE, False, False, $000000, $21CF02, THashLibStringArray.Create('CRC-24', 'CRC-24/OPENPGP')); TCRCStandard.CRC24_BLE: - result := TCRC.Create(24, $00065B, $555555, True, True, $000000, $C25A56, + Result := TCRC.Create(24, $00065B, $555555, True, True, $000000, $C25A56, THashLibStringArray.Create('CRC-24/BLE')); TCRCStandard.CRC24_FLEXRAYA: - result := TCRC.Create(24, $5D6DCB, $FEDCBA, False, False, $000000, + Result := TCRC.Create(24, $5D6DCB, $FEDCBA, False, False, $000000, $7979BD, THashLibStringArray.Create('CRC-24/FLEXRAY-A')); TCRCStandard.CRC24_FLEXRAYB: - result := TCRC.Create(24, $5D6DCB, $ABCDEF, False, False, $000000, + Result := TCRC.Create(24, $5D6DCB, $ABCDEF, False, False, $000000, $1F23B8, THashLibStringArray.Create('CRC-24/FLEXRAY-B')); TCRCStandard.CRC24_INTERLAKEN: - result := TCRC.Create(24, $328B63, $FFFFFF, False, False, $FFFFFF, + Result := TCRC.Create(24, $328B63, $FFFFFF, False, False, $FFFFFF, $B4F3E6, THashLibStringArray.Create('CRC-24/INTERLAKEN')); TCRCStandard.CRC24_LTEA: - result := TCRC.Create(24, $864CFB, $000000, False, False, $000000, + Result := TCRC.Create(24, $864CFB, $000000, False, False, $000000, $CDE703, THashLibStringArray.Create('CRC-24/LTE-A')); TCRCStandard.CRC24_LTEB: - result := TCRC.Create(24, $800063, $000000, False, False, $000000, + Result := TCRC.Create(24, $800063, $000000, False, False, $000000, $23EF52, THashLibStringArray.Create('CRC-24/LTE-B')); TCRCStandard.CRC24_OS9: - result := TCRC.Create(24, $800063, $FFFFFF, False, False, $FFFFFF, + Result := TCRC.Create(24, $800063, $FFFFFF, False, False, $FFFFFF, $200FA5, THashLibStringArray.Create('CRC-24/OS-9')); TCRCStandard.CRC30_CDMA: - result := TCRC.Create(30, $2030B9C7, $3FFFFFFF, False, False, $3FFFFFFF, + Result := TCRC.Create(30, $2030B9C7, $3FFFFFFF, False, False, $3FFFFFFF, $04C34ABF, THashLibStringArray.Create('CRC-30/CDMA')); TCRCStandard.CRC31_PHILIPS: - result := TCRC.Create(31, $04C11DB7, $7FFFFFFF, False, False, $7FFFFFFF, + Result := TCRC.Create(31, $04C11DB7, $7FFFFFFF, False, False, $7FFFFFFF, $0CE9E46C, THashLibStringArray.Create('CRC-31/PHILLIPS')); TCRCStandard.CRC32: - result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, True, True, $FFFFFFFF, + Result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, True, True, $FFFFFFFF, $CBF43926, THashLibStringArray.Create('CRC-32', 'CRC-32/ADCCP', 'CRC-32/V-42', 'CRC-32/XZ', 'PKZIP', 'CRC-32/ISO-HDLC')); TCRCStandard.CRC32_AUTOSAR: - result := TCRC.Create(32, $F4ACFB13, $FFFFFFFF, True, True, $FFFFFFFF, + Result := TCRC.Create(32, $F4ACFB13, $FFFFFFFF, True, True, $FFFFFFFF, $1697D06A, THashLibStringArray.Create('CRC-32/AUTOSAR')); TCRCStandard.CRC32_BZIP2: - result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $FFFFFFFF, + Result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $FFFFFFFF, $FC891918, THashLibStringArray.Create('CRC-32/BZIP2', 'CRC-32/AAL5', 'CRC-32/DECT-B', 'B-CRC-32')); TCRCStandard.CRC32C: - result := TCRC.Create(32, $1EDC6F41, $FFFFFFFF, True, True, $FFFFFFFF, + Result := TCRC.Create(32, $1EDC6F41, $FFFFFFFF, True, True, $FFFFFFFF, $E3069283, THashLibStringArray.Create('CRC-32C', 'CRC-32/BASE91-C', 'CRC-32/CASTAGNOLI', 'CRC-32/INTERLAKEN', 'CRC-32/ISCSI')); TCRCStandard.CRC32D: - result := TCRC.Create(32, $A833982B, $FFFFFFFF, True, True, $FFFFFFFF, + Result := TCRC.Create(32, $A833982B, $FFFFFFFF, True, True, $FFFFFFFF, $87315576, THashLibStringArray.Create('CRC-32D', 'CRC-32/BASE91-D')); TCRCStandard.CRC32_MPEG2: - result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $00000000, + Result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $00000000, $0376E6E7, THashLibStringArray.Create('CRC-32/MPEG-2')); TCRCStandard.CRC32_POSIX: - result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $00000000, + Result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, False, False, $00000000, $0376E6E7, THashLibStringArray.Create('CRC-32/POSIX', 'CKSUM')); TCRCStandard.CRC32Q: - result := TCRC.Create(32, $814141AB, $00000000, False, False, $00000000, + Result := TCRC.Create(32, $814141AB, $00000000, False, False, $00000000, $3010BF7F, THashLibStringArray.Create('CRC-32Q', 'CRC-32/AIXM')); TCRCStandard.JAMCRC: - result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, True, True, $00000000, + Result := TCRC.Create(32, $04C11DB7, $FFFFFFFF, True, True, $00000000, $340BC6D9, THashLibStringArray.Create('JAMCRC', 'CRC-32/JAMCRC')); TCRCStandard.XFER: - result := TCRC.Create(32, $000000AF, $00000000, False, False, $00000000, + Result := TCRC.Create(32, $000000AF, $00000000, False, False, $00000000, $BD0BE338, THashLibStringArray.Create('XFER', 'CRC-32/XFER')); TCRCStandard.CRC32_CDROMEDC: - result := TCRC.Create(32, $8001801B, $00000000, True, True, $00000000, + Result := TCRC.Create(32, $8001801B, $00000000, True, True, $00000000, $6EC2EDC4, THashLibStringArray.Create('CRC-32/CD-ROM-EDC')); TCRCStandard.CRC40_GSM: - result := TCRC.Create(40, $0004820009, $0000000000, False, False, + Result := TCRC.Create(40, $0004820009, $0000000000, False, False, $FFFFFFFFFF, $D4164FC646, THashLibStringArray.Create('CRC-40/GSM')); TCRCStandard.CRC64: - result := TCRC.Create(64, $42F0E1EBA9EA3693, $0000000000000000, False, + Result := TCRC.Create(64, $42F0E1EBA9EA3693, $0000000000000000, False, False, $0000000000000000, $6C40DF5F0B497347, THashLibStringArray.Create('CRC-64', 'CRC-64/ECMA-182')); TCRCStandard.CRC64_GOISO: - result := TCRC.Create(64, $000000000000001B, UInt64($FFFFFFFFFFFFFFFF), + Result := TCRC.Create(64, $000000000000001B, UInt64($FFFFFFFFFFFFFFFF), True, True, UInt64($FFFFFFFFFFFFFFFF), UInt64($B90956C775A41001), THashLibStringArray.Create('CRC-64/GO-ISO')); TCRCStandard.CRC64_WE: - result := TCRC.Create(64, $42F0E1EBA9EA3693, UInt64($FFFFFFFFFFFFFFFF), + Result := TCRC.Create(64, $42F0E1EBA9EA3693, UInt64($FFFFFFFFFFFFFFFF), False, False, UInt64($FFFFFFFFFFFFFFFF), $62EC59E3F1A4F00A, THashLibStringArray.Create('CRC-64/WE')); TCRCStandard.CRC64_XZ: - result := TCRC.Create(64, $42F0E1EBA9EA3693, UInt64($FFFFFFFFFFFFFFFF), + Result := TCRC.Create(64, $42F0E1EBA9EA3693, UInt64($FFFFFFFFFFFFFFFF), True, True, UInt64($FFFFFFFFFFFFFFFF), UInt64($995DC9BBDF1939FA), THashLibStringArray.Create('CRC-64/XZ', 'CRC-64/GO-ECMA')); TCRCStandard.CRC64_1B: - result := TCRC.Create(64, $000000000000001B, UInt64($0000000000000000), + Result := TCRC.Create(64, $000000000000001B, UInt64($0000000000000000), True, True, UInt64($0000000000000000), $46A5A9388A5BEFFE, THashLibStringArray.Create('CRC-64/1B')); TCRCStandard.CRC64_Jones: - result := TCRC.Create(64, UInt64($AD93D23594C935A9), + Result := TCRC.Create(64, UInt64($AD93D23594C935A9), UInt64($FFFFFFFFFFFFFFFF), True, True, UInt64($0000000000000000), UInt64($CAA717168609F281), THashLibStringArray.Create('CRC-64/Jones')) @@ -1403,13 +1403,13 @@ class function TCRC.Reflect(AValue: UInt64; AWidth: Int32): UInt64; LIdx, LJdx: UInt64; begin LJdx := 1; - result := 0; + Result := 0; LIdx := UInt64(1) shl (AWidth - 1); while LIdx <> 0 do begin if ((AValue and LIdx) <> 0) then begin - result := result or LJdx; + Result := Result or LJdx; end; LJdx := LJdx shl 1; LIdx := LIdx shr 1; @@ -1420,7 +1420,7 @@ procedure TCRC.TransformBytes(const AData: THashLibByteArray; AIndex, ALength: Int32); var LIdx: Int32; - PtrAData: PByte; + LPtrAData: PByte; begin {$IFDEF DEBUG} System.Assert(AIndex >= 0); @@ -1434,15 +1434,15 @@ procedure TCRC.TransformBytes(const AData: THashLibByteArray; LIdx := AIndex; - PtrAData := PByte(AData); + LPtrAData := PByte(AData); if (Width > Delta) then begin - CalculateCRCbyTable(PtrAData, ALength, LIdx); + CalculateCRCbyTable(LPtrAData, ALength, LIdx); end else begin - CalculateCRCdirect(PtrAData, ALength, LIdx); + CalculateCRCdirect(LPtrAData, ALength, LIdx); end; end; @@ -1478,7 +1478,7 @@ function TCRC.TransformFinal: IHashResult; begin LUInt32 := UInt32(FHash); - result := THashResult.Create(LUInt32); + Result := THashResult.Create(LUInt32); Initialize(); @@ -1489,7 +1489,7 @@ function TCRC.TransformFinal: IHashResult; 0: begin LUInt8 := UInt8(FHash); - result := THashResult.Create(LUInt8); + Result := THashResult.Create(LUInt8); end; @@ -1497,20 +1497,20 @@ function TCRC.TransformFinal: IHashResult; begin LUInt16 := UInt16(FHash); - result := THashResult.Create(LUInt16); + Result := THashResult.Create(LUInt16); end; 3 .. 4: begin LUInt32 := UInt32(FHash); - result := THashResult.Create(LUInt32); + Result := THashResult.Create(LUInt32); end else begin LUInt64 := (FHash); - result := THashResult.Create(LUInt64); + Result := THashResult.Create(LUInt64); end; end; diff --git a/HashLib/src/Checksum/HlpCRC16.pas b/HashLib/src/Checksum/HlpCRC16.pas index 34888ed2..868b227c 100644 --- a/HashLib/src/Checksum/HlpCRC16.pas +++ b/HashLib/src/Checksum/HlpCRC16.pas @@ -57,7 +57,7 @@ constructor TCRC16.Create(APolynomial, AInitial: UInt64; AIsInputReflected, AIsOutputReflected: Boolean; AOutputXor, ACheckValue: UInt64; const ANames: THashLibStringArray); begin - Inherited Create(2, 1); + inherited Create(2, 1); FCRCAlgorithm := TCRC.Create(16, APolynomial, AInitial, AIsInputReflected, AIsOutputReflected, AOutputXor, ACheckValue, ANames); end; @@ -75,14 +75,14 @@ procedure TCRC16.TransformBytes(const AData: THashLibByteArray; function TCRC16.TransformFinal: IHashResult; begin - result := FCRCAlgorithm.TransformFinal(); + Result := FCRCAlgorithm.TransformFinal(); end; { TCRC16_BUYPASS } constructor TCRC16_BUYPASS.Create; begin - Inherited Create(TCRC16Polynomials.BUYPASS, $0000, false, false, $0000, $FEE8, + inherited Create(TCRC16Polynomials.BUYPASS, $0000, False, False, $0000, $FEE8, THashLibStringArray.Create('CRC-16/BUYPASS', 'CRC-16/VERIFONE', 'CRC-16/UMTS')); end; diff --git a/HashLib/src/Checksum/HlpCRC32.pas b/HashLib/src/Checksum/HlpCRC32.pas index f984206f..bdb1636e 100644 --- a/HashLib/src/Checksum/HlpCRC32.pas +++ b/HashLib/src/Checksum/HlpCRC32.pas @@ -74,7 +74,7 @@ constructor TCRC32.Create(APolynomial, AInitial: UInt64; AIsInputReflected, AIsOutputReflected: Boolean; AOutputXor, ACheckValue: UInt64; const ANames: THashLibStringArray); begin - Inherited Create(4, 1); + inherited Create(4, 1); FCRCAlgorithm := TCRC.Create(32, APolynomial, AInitial, AIsInputReflected, AIsOutputReflected, AOutputXor, ACheckValue, ANames); end; @@ -99,7 +99,7 @@ function TCRC32.TransformFinal: IHashResult; constructor TCRC32_PKZIP.Create; begin - Inherited Create(TCRC32Polynomials.PKZIP, $FFFFFFFF, true, true, $FFFFFFFF, + inherited Create(TCRC32Polynomials.PKZIP, $FFFFFFFF, True, True, $FFFFFFFF, $CBF43926, THashLibStringArray.Create('CRC-32', 'CRC-32/ADCCP', 'CRC-32/V-42', 'CRC-32/XZ', 'PKZIP', 'CRC-32/ISO-HDLC')); @@ -109,7 +109,7 @@ constructor TCRC32_PKZIP.Create; constructor TCRC32_CASTAGNOLI.Create; begin - Inherited Create(TCRC32Polynomials.Castagnoli, $FFFFFFFF, true, true, + inherited Create(TCRC32Polynomials.Castagnoli, $FFFFFFFF, True, True, $FFFFFFFF, $E3069283, THashLibStringArray.Create('CRC-32C', 'CRC-32/BASE91-C', 'CRC-32/CASTAGNOLI', 'CRC-32/INTERLAKEN', 'CRC-32/ISCSI')); diff --git a/HashLib/src/Checksum/HlpCRC32Fast.pas b/HashLib/src/Checksum/HlpCRC32Fast.pas index f9ab1443..b896cd95 100644 --- a/HashLib/src/Checksum/HlpCRC32Fast.pas +++ b/HashLib/src/Checksum/HlpCRC32Fast.pas @@ -24,7 +24,7 @@ TCRC32Fast = class(THash, IChecksum, IHash32, ITransformBlock) procedure LocalCRCCompute(const ACRCTable: THashLibMatrixUInt32Array; const AData: THashLibByteArray; AIndex, ALength: Int32); - class function Init_CRC_Table(APolynomial: UInt32) + class function InitCRCTable(APolynomial: UInt32) : THashLibMatrixUInt32Array; static; public @@ -42,12 +42,12 @@ TCRC32_PKZIP = class sealed(TCRC32Fast) const // Polynomial Reversed - CRC32_PKZIP_Polynomial = UInt32($EDB88320); + Crc32PkzipPolynomial = UInt32($EDB88320); class var - FCRC32_PKZIP_Table: THashLibMatrixUInt32Array; + FCrc32PkzipTable: THashLibMatrixUInt32Array; - class constructor CRC32_PKZIP(); + class constructor Crc32Pkzip(); public constructor Create(); @@ -62,12 +62,12 @@ TCRC32_CASTAGNOLI = class sealed(TCRC32Fast) strict private const - CRC32_CASTAGNOLI_Polynomial = UInt32($82F63B78); // Polynomial Reversed + Crc32CastagnoliPolynomial = UInt32($82F63B78); // Polynomial Reversed class var - FCRC32_CASTAGNOLI_Table: THashLibMatrixUInt32Array; + FCrc32CastagnoliTable: THashLibMatrixUInt32Array; - class constructor CRC32_CASTAGNOLI(); + class constructor Crc32Castagnoli(); public constructor Create(); @@ -81,7 +81,7 @@ implementation { TCRC32Fast } -class function TCRC32Fast.Init_CRC_Table(APolynomial: UInt32) +class function TCRC32Fast.InitCRCTable(APolynomial: UInt32) : THashLibMatrixUInt32Array; var LIdx, LJIdx, LKIdx: Int32; @@ -198,7 +198,7 @@ procedure TCRC32Fast.LocalCRCCompute(const ACRCTable: THashLibMatrixUInt32Array; constructor TCRC32Fast.Create(); begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TCRC32Fast.Initialize; @@ -225,24 +225,24 @@ function TCRC32_PKZIP.Clone(): IHash; begin LHashInstance := TCRC32_PKZIP.Create(); LHashInstance.FCurrentCRC := FCurrentCRC; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TCRC32_PKZIP.Create; begin - Inherited Create(); + inherited Create(); end; procedure TCRC32_PKZIP.TransformBytes(const AData: THashLibByteArray; AIndex, ALength: Int32); begin - LocalCRCCompute(FCRC32_PKZIP_Table, AData, AIndex, ALength); + LocalCRCCompute(FCrc32PkzipTable, AData, AIndex, ALength); end; -class constructor TCRC32_PKZIP.CRC32_PKZIP(); +class constructor TCRC32_PKZIP.Crc32Pkzip(); begin - FCRC32_PKZIP_Table := Init_CRC_Table(CRC32_PKZIP_Polynomial); + FCrc32PkzipTable := InitCRCTable(Crc32PkzipPolynomial); end; { TCRC32_CASTAGNOLI } @@ -253,24 +253,24 @@ function TCRC32_CASTAGNOLI.Clone(): IHash; begin LHashInstance := TCRC32_CASTAGNOLI.Create(); LHashInstance.FCurrentCRC := FCurrentCRC; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TCRC32_CASTAGNOLI.Create; begin - Inherited Create(); + inherited Create(); end; procedure TCRC32_CASTAGNOLI.TransformBytes(const AData: THashLibByteArray; AIndex, ALength: Int32); begin - LocalCRCCompute(FCRC32_CASTAGNOLI_Table, AData, AIndex, ALength); + LocalCRCCompute(FCrc32CastagnoliTable, AData, AIndex, ALength); end; -class constructor TCRC32_CASTAGNOLI.CRC32_CASTAGNOLI(); +class constructor TCRC32_CASTAGNOLI.Crc32Castagnoli(); begin - FCRC32_CASTAGNOLI_Table := Init_CRC_Table(CRC32_CASTAGNOLI_Polynomial); + FCrc32CastagnoliTable := InitCRCTable(Crc32CastagnoliPolynomial); end; end. diff --git a/HashLib/src/Checksum/HlpCRC64.pas b/HashLib/src/Checksum/HlpCRC64.pas index cd29ccee..61e325a7 100644 --- a/HashLib/src/Checksum/HlpCRC64.pas +++ b/HashLib/src/Checksum/HlpCRC64.pas @@ -57,14 +57,14 @@ implementation function TCRC64.Clone(): IHash; begin - result := FCRCAlgorithm.Clone(); + Result := FCRCAlgorithm.Clone(); end; constructor TCRC64.Create(APolynomial, AInitial: UInt64; AIsInputReflected, AIsOutputReflected: Boolean; AOutputXor, ACheckValue: UInt64; const ANames: THashLibStringArray); begin - Inherited Create(8, 1); + inherited Create(8, 1); FCRCAlgorithm := TCRC.Create(64, APolynomial, AInitial, AIsInputReflected, AIsOutputReflected, AOutputXor, ACheckValue, ANames); end; @@ -82,14 +82,14 @@ procedure TCRC64.TransformBytes(const AData: THashLibByteArray; function TCRC64.TransformFinal: IHashResult; begin - result := FCRCAlgorithm.TransformFinal(); + Result := FCRCAlgorithm.TransformFinal(); end; { TCRC64_ECMA_182 } constructor TCRC64_ECMA_182.Create; begin - Inherited Create(TCRC64Polynomials.ECMA_182, $0000000000000000, false, false, + inherited Create(TCRC64Polynomials.ECMA_182, $0000000000000000, False, False, $0000000000000000, $6C40DF5F0B497347, THashLibStringArray.Create('CRC-64', 'CRC-64/ECMA-182')); end; diff --git a/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas b/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas index 7efb1a34..8092a884 100644 --- a/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas +++ b/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas @@ -180,15 +180,15 @@ procedure TBlake2BConfig.ValidateHashSize(AHashSize: Int32); procedure TBlake2BConfig.ValidateKeyLength(const AKey: THashLibByteArray); var - KeyLength: Int32; + LKeyLength: Int32; begin - if (AKey <> Nil) then + if (AKey <> nil) then begin - KeyLength := System.Length(AKey); - if (KeyLength > 64) then + LKeyLength := System.Length(AKey); + if (LKeyLength > 64) then begin raise EArgumentOutOfRangeHashLibException.CreateResFmt(@SInvalidKeyLength, - [KeyLength]); + [LKeyLength]); end; end; end; @@ -198,7 +198,7 @@ procedure TBlake2BConfig.ValidatePersonalisationLength(const APersonalisation var PersonalisationLength: Int32; begin - if (APersonalisation <> Nil) then + if (APersonalisation <> nil) then begin PersonalisationLength := System.Length(APersonalisation); if (PersonalisationLength <> 16) then @@ -211,15 +211,15 @@ procedure TBlake2BConfig.ValidatePersonalisationLength(const APersonalisation procedure TBlake2BConfig.ValidateSaltLength(const ASalt: THashLibByteArray); var - SaltLength: Int32; + LSaltLength: Int32; begin - if (ASalt <> Nil) then + if (ASalt <> nil) then begin - SaltLength := System.Length(ASalt); - if (SaltLength <> 16) then + LSaltLength := System.Length(ASalt); + if (LSaltLength <> 16) then begin raise EArgumentOutOfRangeHashLibException.CreateResFmt - (@SInvalidSaltLength, [SaltLength]); + (@SInvalidSaltLength, [LSaltLength]); end; end; end; @@ -272,7 +272,7 @@ constructor TBlake2BConfig.Create(AHashSize: THashSize); var LHashSize: Int32; begin - Inherited Create(); + inherited Create(); LHashSize := Int32(AHashSize); ValidateHashSize(LHashSize); FHashSize := LHashSize; @@ -280,7 +280,7 @@ constructor TBlake2BConfig.Create(AHashSize: THashSize); constructor TBlake2BConfig.Create(AHashSize: Int32); begin - Inherited Create(); + inherited Create(); ValidateHashSize(AHashSize); FHashSize := AHashSize; end; @@ -428,7 +428,7 @@ procedure TBlake2BTreeConfig.SetNodeOffset(AValue: UInt64); constructor TBlake2BTreeConfig.Create; begin - Inherited Create(); + inherited Create(); FFanOut := 0; FMaxDepth := 0; FLeafSize := 64; @@ -479,7 +479,7 @@ class procedure TBlake2BIvBuilder.VerifyConfigB(const AConfig: IBlake2BConfig; end; // Key length - if (AConfig.Key <> Nil) then + if (AConfig.Key <> nil) then begin if (System.Length(AConfig.Key) > 64) then begin @@ -489,7 +489,7 @@ class procedure TBlake2BIvBuilder.VerifyConfigB(const AConfig: IBlake2BConfig; end; // Personalisation length - if (AConfig.Personalisation <> Nil) then + if (AConfig.Personalisation <> nil) then begin if (System.Length(AConfig.Personalisation) <> 16) then begin @@ -500,7 +500,7 @@ class procedure TBlake2BIvBuilder.VerifyConfigB(const AConfig: IBlake2BConfig; end; // Salt length - if (AConfig.Salt <> Nil) then + if (AConfig.Salt <> nil) then begin if (System.Length(AConfig.Salt) <> 16) then begin @@ -510,7 +510,7 @@ class procedure TBlake2BIvBuilder.VerifyConfigB(const AConfig: IBlake2BConfig; end; // Tree InnerHashSize - if (ATreeConfig <> Nil) then + if (ATreeConfig <> nil) then begin if ((AIsSequential) and ((ATreeConfig.InnerHashSize <> 0))) then @@ -534,7 +534,7 @@ class function TBlake2BIvBuilder.ConfigB(const AConfig: IBlake2BConfig; LIsSequential: Boolean; LBuffer: THashLibByteArray; begin - LIsSequential := ATreeConfig = Nil; + LIsSequential := ATreeConfig = nil; if (LIsSequential) then begin ATreeConfig := TBlake2BTreeConfig.SequentialTreeConfig; @@ -547,7 +547,7 @@ class function TBlake2BIvBuilder.ConfigB(const AConfig: IBlake2BConfig; LBuffer[0] := AConfig.HashSize; LBuffer[1] := System.Length(AConfig.Key); - if ATreeConfig <> Nil then + if ATreeConfig <> nil then begin LBuffer[2] := ATreeConfig.FanOut; LBuffer[3] := ATreeConfig.MaxDepth; @@ -557,12 +557,12 @@ class function TBlake2BIvBuilder.ConfigB(const AConfig: IBlake2BConfig; LBuffer[17] := ATreeConfig.InnerHashSize; end; - if AConfig.Salt <> Nil then + if AConfig.Salt <> nil then begin System.Move(AConfig.Salt[0], LBuffer[32], 16 * System.SizeOf(Byte)); end; - if AConfig.Personalisation <> Nil then + if AConfig.Personalisation <> nil then begin System.Move(AConfig.Personalisation[0], LBuffer[48], 16 * System.SizeOf(Byte)); diff --git a/HashLib/src/Crypto/Blake2SParams/HlpBlake2SParams.pas b/HashLib/src/Crypto/Blake2SParams/HlpBlake2SParams.pas index 340e612d..cf2a9e43 100644 --- a/HashLib/src/Crypto/Blake2SParams/HlpBlake2SParams.pas +++ b/HashLib/src/Crypto/Blake2SParams/HlpBlake2SParams.pas @@ -179,15 +179,15 @@ procedure TBlake2SConfig.ValidateHashSize(AHashSize: Int32); procedure TBlake2SConfig.ValidateKeyLength(const AKey: THashLibByteArray); var - KeyLength: Int32; + LKeyLength: Int32; begin - if (AKey <> Nil) then + if (AKey <> nil) then begin - KeyLength := System.Length(AKey); - if (KeyLength > 32) then + LKeyLength := System.Length(AKey); + if (LKeyLength > 32) then begin raise EArgumentOutOfRangeHashLibException.CreateResFmt(@SInvalidKeyLength, - [KeyLength]); + [LKeyLength]); end; end; end; @@ -195,30 +195,30 @@ procedure TBlake2SConfig.ValidateKeyLength(const AKey: THashLibByteArray); procedure TBlake2SConfig.ValidatePersonalisationLength(const APersonalisation : THashLibByteArray); var - PersonalisationLength: Int32; + LPersonalisationLength: Int32; begin - if (APersonalisation <> Nil) then + if (APersonalisation <> nil) then begin - PersonalisationLength := System.Length(APersonalisation); - if (PersonalisationLength <> 8) then + LPersonalisationLength := System.Length(APersonalisation); + if (LPersonalisationLength <> 8) then begin raise EArgumentOutOfRangeHashLibException.CreateResFmt - (@SInvalidPersonalisationLength, [PersonalisationLength]); + (@SInvalidPersonalisationLength, [LPersonalisationLength]); end; end; end; procedure TBlake2SConfig.ValidateSaltLength(const ASalt: THashLibByteArray); var - SaltLength: Int32; + LSaltLength: Int32; begin - if (ASalt <> Nil) then + if (ASalt <> nil) then begin - SaltLength := System.Length(ASalt); - if (SaltLength <> 8) then + LSaltLength := System.Length(ASalt); + if (LSaltLength <> 8) then begin raise EArgumentOutOfRangeHashLibException.CreateResFmt - (@SInvalidSaltLength, [SaltLength]); + (@SInvalidSaltLength, [LSaltLength]); end; end; end; @@ -271,7 +271,7 @@ constructor TBlake2SConfig.Create(AHashSize: THashSize); var LHashSize: Int32; begin - Inherited Create(); + inherited Create(); LHashSize := Int32(AHashSize); ValidateHashSize(LHashSize); FHashSize := LHashSize; @@ -279,7 +279,7 @@ constructor TBlake2SConfig.Create(AHashSize: THashSize); constructor TBlake2SConfig.Create(AHashSize: Int32); begin - Inherited Create(); + inherited Create(); ValidateHashSize(AHashSize); FHashSize := AHashSize; end; @@ -426,7 +426,7 @@ procedure TBlake2STreeConfig.SetNodeOffset(AValue: UInt64); constructor TBlake2STreeConfig.Create; begin - Inherited Create(); + inherited Create(); FFanOut := 0; FMaxDepth := 0; FLeafSize := 32; @@ -477,7 +477,7 @@ class procedure TBlake2SIvBuilder.VerifyConfigS(const AConfig: IBlake2SConfig; end; // Key length - if (AConfig.Key <> Nil) then + if (AConfig.Key <> nil) then begin if (System.Length(AConfig.Key) > 32) then begin @@ -487,7 +487,7 @@ class procedure TBlake2SIvBuilder.VerifyConfigS(const AConfig: IBlake2SConfig; end; // Personalisation length - if (AConfig.Personalisation <> Nil) then + if (AConfig.Personalisation <> nil) then begin if (System.Length(AConfig.Personalisation) <> 8) then begin @@ -498,7 +498,7 @@ class procedure TBlake2SIvBuilder.VerifyConfigS(const AConfig: IBlake2SConfig; end; // Salt length - if (AConfig.Salt <> Nil) then + if (AConfig.Salt <> nil) then begin if (System.Length(AConfig.Salt) <> 8) then begin @@ -508,7 +508,7 @@ class procedure TBlake2SIvBuilder.VerifyConfigS(const AConfig: IBlake2SConfig; end; // Tree InnerHashSize - if (ATreeConfig <> Nil) then + if (ATreeConfig <> nil) then begin if ((AIsSequential) and ((ATreeConfig.InnerHashSize <> 0))) then @@ -532,7 +532,7 @@ class function TBlake2SIvBuilder.ConfigS(const AConfig: IBlake2SConfig; LIsSequential: Boolean; LBuffer: THashLibByteArray; begin - LIsSequential := ATreeConfig = Nil; + LIsSequential := ATreeConfig = nil; if (LIsSequential) then begin ATreeConfig := TBlake2STreeConfig.SequentialTreeConfig; @@ -545,7 +545,7 @@ class function TBlake2SIvBuilder.ConfigS(const AConfig: IBlake2SConfig; LBuffer[0] := AConfig.HashSize; LBuffer[1] := System.Length(AConfig.Key); - if ATreeConfig <> Nil then + if ATreeConfig <> nil then begin LBuffer[2] := ATreeConfig.FanOut; LBuffer[3] := ATreeConfig.MaxDepth; @@ -560,12 +560,12 @@ class function TBlake2SIvBuilder.ConfigS(const AConfig: IBlake2SConfig; LBuffer[15] := ATreeConfig.InnerHashSize; end; - if AConfig.Salt <> Nil then + if AConfig.Salt <> nil then begin System.Move(AConfig.Salt[0], LBuffer[16], 8 * System.SizeOf(Byte)); end; - if AConfig.Personalisation <> Nil then + if AConfig.Personalisation <> nil then begin System.Move(AConfig.Personalisation[0], LBuffer[24], 8 * System.SizeOf(Byte)); diff --git a/HashLib/src/Crypto/HlpBlake2B.pas b/HashLib/src/Crypto/HlpBlake2B.pas index 881184eb..3ccda61d 100644 --- a/HashLib/src/Crypto/HlpBlake2B.pas +++ b/HashLib/src/Crypto/HlpBlake2B.pas @@ -20,7 +20,7 @@ interface resourcestring SInvalidConfigLength = 'Config Length Must Be 8 Words'; - SConfigNil = 'Config Cannot Be Nil'; + SConfigNil = 'Config Cannot Be nil'; SInvalidXOFSize = 'XOFSize in Bits must be Multiples of 8 and be Between %u and %u Bytes.'; SOutputLengthInvalid = 'Output Length is above the Digest Length'; @@ -71,7 +71,8 @@ TBlake2B = class(THash, ICryptoNotBuildIn, ITransformBlock) procedure Blake2BIncrementCounter(AIncrementCount: UInt64); inline; {$IFNDEF USE_UNROLLED_VARIANT} - procedure G(a, b, c, d, r, i: Int32); inline; + procedure G(AStateIdx0, AStateIdx1, AStateIdx2, AStateIdx3, ARound, + AMixIdx: Int32); inline; {$ENDIF USE_UNROLLED_VARIANT} procedure MixScalar(); procedure Compress(ABlock: PByte; AStart: Int32); inline; @@ -250,22 +251,23 @@ procedure TBlake2B.Blake2BIncrementCounter(AIncrementCount: UInt64); {$IFNDEF USE_UNROLLED_VARIANT} -procedure TBlake2B.G(a, b, c, d, r, i: Int32); +procedure TBlake2B.G(AStateIdx0, AStateIdx1, AStateIdx2, AStateIdx3, ARound, + AMixIdx: Int32); var - p, p0, p1: Int32; + LSigmaBase, LSigmaIdx0, LSigmaIdx1: Int32; begin - p := (r shl 4) + i; - p0 := Sigma[p]; - p1 := Sigma[p + 1]; - - FV[a] := FV[a] + (FV[b] + FM[p0]); - FV[d] := TBits.RotateRight64(FV[d] xor FV[a], 32); - FV[c] := FV[c] + FV[d]; - FV[b] := TBits.RotateRight64(FV[b] xor FV[c], 24); - FV[a] := FV[a] + (FV[b] + FM[p1]); - FV[d] := TBits.RotateRight64(FV[d] xor FV[a], 16); - FV[c] := FV[c] + FV[d]; - FV[b] := TBits.RotateRight64(FV[b] xor FV[c], 63); + LSigmaBase := (ARound shl 4) + AMixIdx; + LSigmaIdx0 := Sigma[LSigmaBase]; + LSigmaIdx1 := Sigma[LSigmaBase + 1]; + + FV[AStateIdx0] := FV[AStateIdx0] + (FV[AStateIdx1] + FM[LSigmaIdx0]); + FV[AStateIdx3] := TBits.RotateRight64(FV[AStateIdx3] xor FV[AStateIdx0], 32); + FV[AStateIdx2] := FV[AStateIdx2] + FV[AStateIdx3]; + FV[AStateIdx1] := TBits.RotateRight64(FV[AStateIdx1] xor FV[AStateIdx2], 24); + FV[AStateIdx0] := FV[AStateIdx0] + (FV[AStateIdx1] + FM[LSigmaIdx1]); + FV[AStateIdx3] := TBits.RotateRight64(FV[AStateIdx3] xor FV[AStateIdx0], 16); + FV[AStateIdx2] := FV[AStateIdx2] + FV[AStateIdx3]; + FV[AStateIdx1] := TBits.RotateRight64(FV[AStateIdx1] xor FV[AStateIdx2], 63); end; {$ENDIF USE_UNROLLED_VARIANT} @@ -274,8 +276,8 @@ function TBlake2B.CloneInternal(): TBlake2B; var LTreeConfig: IBlake2BTreeConfig; begin - LTreeConfig := Nil; - if FTreeConfig <> Nil then + LTreeConfig := nil; + if FTreeConfig <> nil then begin LTreeConfig := FTreeConfig.Clone(); end; @@ -296,1423 +298,1423 @@ function TBlake2B.CloneInternal(): TBlake2B; function TBlake2B.Clone(): IHash; begin - Result := CloneInternal() as IHash; + Result := CloneInternal(); end; procedure TBlake2B.MixScalar; var {$IFDEF USE_UNROLLED_VARIANT} - m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, v0, v1, - v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15: UInt64; + LBlock0, LBlock1, LBlock2, LBlock3, LBlock4, LBlock5, LBlock6, LBlock7, LBlock8, LBlock9, LBlock10, LBlock11, LBlock12, LBlock13, LBlock14, LBlock15, LWorking0, LWorking1, + LWorking2, LWorking3, LWorking4, LWorking5, LWorking6, LWorking7, LWorking8, LWorking9, LWorking10, LWorking11, LWorking12, LWorking13, LWorking14, LWorking15: UInt64; {$ELSE} - i, r: Int32; + LWordIdx, LRound: Int32; {$ENDIF USE_UNROLLED_VARIANT} begin {$IFDEF USE_UNROLLED_VARIANT} - m0 := FM[0]; - m1 := FM[1]; - m2 := FM[2]; - m3 := FM[3]; - m4 := FM[4]; - m5 := FM[5]; - m6 := FM[6]; - m7 := FM[7]; - m8 := FM[8]; - m9 := FM[9]; - m10 := FM[10]; - m11 := FM[11]; - m12 := FM[12]; - m13 := FM[13]; - m14 := FM[14]; - m15 := FM[15]; - - v0 := FState[0]; - v1 := FState[1]; - v2 := FState[2]; - v3 := FState[3]; - v4 := FState[4]; - v5 := FState[5]; - v6 := FState[6]; - v7 := FState[7]; - - v8 := IV0; - v9 := IV1; - v10 := IV2; - v11 := IV3; - v12 := IV4 xor FCounter0; - v13 := IV5 xor FCounter1; - v14 := IV6 xor FFinalizationFlag0; - v15 := IV7 xor FFinalizationFlag1; + LBlock0 := FM[0]; + LBlock1 := FM[1]; + LBlock2 := FM[2]; + LBlock3 := FM[3]; + LBlock4 := FM[4]; + LBlock5 := FM[5]; + LBlock6 := FM[6]; + LBlock7 := FM[7]; + LBlock8 := FM[8]; + LBlock9 := FM[9]; + LBlock10 := FM[10]; + LBlock11 := FM[11]; + LBlock12 := FM[12]; + LBlock13 := FM[13]; + LBlock14 := FM[14]; + LBlock15 := FM[15]; + + LWorking0 := FState[0]; + LWorking1 := FState[1]; + LWorking2 := FState[2]; + LWorking3 := FState[3]; + LWorking4 := FState[4]; + LWorking5 := FState[5]; + LWorking6 := FState[6]; + LWorking7 := FState[7]; + + LWorking8 := IV0; + LWorking9 := IV1; + LWorking10 := IV2; + LWorking11 := IV3; + LWorking12 := IV4 xor FCounter0; + LWorking13 := IV5 xor FCounter1; + LWorking14 := IV6 xor FFinalizationFlag0; + LWorking15 := IV7 xor FFinalizationFlag1; // Rounds // ##### Round(0) - // G(0, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m0; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m1; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(0, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m2; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m3; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(0, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m4; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m5; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(0, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m6; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m7; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(0, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m8; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m9; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(0, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m10; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m11; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(0, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m12; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m13; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(0, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m14; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m15; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(0, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock0; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock1; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(0, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock2; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock3; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(0, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock4; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock5; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(0, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock6; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(0, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock8; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock9; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(0, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock10; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock11; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(0, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock12; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock13; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(0, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock14; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock15; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(1) - // G(1, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m14; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m10; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(1, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m4; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m8; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(1, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m9; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m15; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(1, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m13; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m6; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(1, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m1; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m12; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(1, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m0; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m2; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(1, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m11; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m7; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(1, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m5; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m3; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(1, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock14; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock10; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(1, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock4; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock8; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(1, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock9; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock15; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(1, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock13; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock6; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(1, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock1; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock12; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(1, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock0; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock2; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(1, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock11; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(1, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock5; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock3; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(2) - // G(2, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m11; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m8; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(2, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m12; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m0; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(2, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m5; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m2; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(2, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m15; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m13; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(2, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m10; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m14; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(2, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m3; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m6; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(2, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m7; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m1; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(2, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m9; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m4; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(2, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock11; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock8; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(2, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock12; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock0; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(2, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock5; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock2; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(2, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock15; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock13; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(2, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock10; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock14; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(2, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock3; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(2, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock1; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(2, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock9; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(3) - // G(3, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m7; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m9; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(3, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m3; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m1; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(3, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m13; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m12; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(3, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m11; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m14; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(3, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m2; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m6; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(3, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m5; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m10; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(3, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m4; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m0; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(3, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m15; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m8; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(3, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock7; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock9; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(3, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock3; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock1; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(3, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock13; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock12; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(3, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock11; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock14; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(3, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock2; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock6; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(3, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock5; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock10; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(3, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock4; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock0; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(3, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock15; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock8; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(4) - // G(4, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m9; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m0; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(4, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m5; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m7; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(4, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m2; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m4; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(4, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m10; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m15; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(4, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m14; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m1; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(4, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m11; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m12; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(4, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m6; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m8; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(4, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m3; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m13; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(4, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock9; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock0; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(4, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock7; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(4, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock2; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock4; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(4, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock10; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock15; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(4, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock14; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock1; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(4, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock11; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock12; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(4, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock6; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock8; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(4, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock3; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock13; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(5) - // G(5, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m2; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m12; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(5, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m6; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m10; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(5, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m0; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m11; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(5, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m8; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m3; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(5, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m4; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m13; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(5, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m7; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m5; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(5, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m15; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m14; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(5, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m1; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m9; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(5, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock2; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock12; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(5, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock6; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock10; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(5, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock0; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock11; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(5, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock8; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock3; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(5, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock4; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock13; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(5, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock7; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock5; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(5, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock15; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock14; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(5, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock1; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock9; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(6) - // G(6, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m12; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m5; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(6, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m1; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m15; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(6, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m14; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m13; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(6, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m4; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m10; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(6, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m0; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m7; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(6, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m6; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m3; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(6, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m9; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m2; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(6, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m8; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m11; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(6, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock12; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock5; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(6, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock1; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock15; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(6, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock14; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock13; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(6, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock4; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock10; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(6, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock0; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock7; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(6, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock3; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(6, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock9; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock2; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(6, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock8; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock11; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(7) - // G(7, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m13; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m11; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(7, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m7; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m14; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(7, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m12; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m1; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(7, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m3; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m9; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(7, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m5; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m0; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(7, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m15; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m4; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(7, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m8; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m6; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(7, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m2; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m10; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(7, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock13; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock11; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(7, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock7; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock14; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(7, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock12; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock1; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(7, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock3; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock9; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(7, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock0; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(7, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock15; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock4; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(7, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock8; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock6; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(7, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock2; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock10; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(8) - // G(8, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m6; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m15; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(8, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m14; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m9; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(8, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m11; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m3; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(8, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m0; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m8; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(8, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m12; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m2; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(8, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m13; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m7; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(8, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m1; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m4; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(8, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m10; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m5; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(8, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock6; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock15; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(8, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock14; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock9; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(8, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock11; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock3; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(8, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock0; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock8; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(8, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock12; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock2; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(8, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock13; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock7; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(8, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock1; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock4; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(8, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock10; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock5; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(9) - // G(9, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m10; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m2; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(9, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m8; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m4; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(9, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m7; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m6; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(9, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m1; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m5; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(9, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m15; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m11; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(9, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m9; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m14; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(9, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m3; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m12; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(9, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m13; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m0; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(9, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock10; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock2; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(9, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock8; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock4; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(9, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock7; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(9, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock1; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock5; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(9, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock15; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock11; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(9, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock9; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock14; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(9, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock3; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock12; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(9, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock13; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock0; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(10) - // G(10, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m0; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m1; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(10, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m2; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m3; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(10, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m4; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m5; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(10, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m6; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m7; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(10, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m8; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m9; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(10, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m10; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m11; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(10, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m12; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m13; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(10, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m14; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m15; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(10, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock0; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock1; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(10, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock2; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock3; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(10, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock4; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock5; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(10, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock6; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(10, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock8; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock9; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(10, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock10; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock11; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(10, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock12; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock13; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(10, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock14; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock15; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // ##### Round(11) - // G(11, 0, v0, v4, v8, v12) - v0 := v0 + v4 + m14; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 32); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 24); - v0 := v0 + v4 + m10; - v12 := v12 xor v0; - v12 := TBits.RotateRight64(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight64(v4, 63); - - // G(11, 1, v1, v5, v9, v13) - v1 := v1 + v5 + m4; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 32); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 24); - v1 := v1 + v5 + m8; - v13 := v13 xor v1; - v13 := TBits.RotateRight64(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight64(v5, 63); - - // G(11, 2, v2, v6, v10, v14) - v2 := v2 + v6 + m9; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 32); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 24); - v2 := v2 + v6 + m15; - v14 := v14 xor v2; - v14 := TBits.RotateRight64(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight64(v6, 63); - - // G(11, 3, v3, v7, v11, v15) - v3 := v3 + v7 + m13; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 32); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 24); - v3 := v3 + v7 + m6; - v15 := v15 xor v3; - v15 := TBits.RotateRight64(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight64(v7, 63); - - // G(11, 4, v0, v5, v10, v15) - v0 := v0 + v5 + m1; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 32); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 24); - v0 := v0 + v5 + m12; - v15 := v15 xor v0; - v15 := TBits.RotateRight64(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight64(v5, 63); - - // G(11, 5, v1, v6, v11, v12) - v1 := v1 + v6 + m0; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 32); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 24); - v1 := v1 + v6 + m2; - v12 := v12 xor v1; - v12 := TBits.RotateRight64(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight64(v6, 63); - - // G(11, 6, v2, v7, v8, v13) - v2 := v2 + v7 + m11; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 32); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 24); - v2 := v2 + v7 + m7; - v13 := v13 xor v2; - v13 := TBits.RotateRight64(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight64(v7, 63); - - // G(11, 7, v3, v4, v9, v14) - v3 := v3 + v4 + m5; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 32); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 24); - v3 := v3 + v4 + m3; - v14 := v14 xor v3; - v14 := TBits.RotateRight64(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight64(v4, 63); + // G(11, 0, LWorking0, LWorking4, LWorking8, LWorking12) + LWorking0 := LWorking0 + LWorking4 + LBlock14; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking0 := LWorking0 + LWorking4 + LBlock10; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight64(LWorking4, 63); + + // G(11, 1, LWorking1, LWorking5, LWorking9, LWorking13) + LWorking1 := LWorking1 + LWorking5 + LBlock4; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking1 := LWorking1 + LWorking5 + LBlock8; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(11, 2, LWorking2, LWorking6, LWorking10, LWorking14) + LWorking2 := LWorking2 + LWorking6 + LBlock9; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking2 := LWorking2 + LWorking6 + LBlock15; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(11, 3, LWorking3, LWorking7, LWorking11, LWorking15) + LWorking3 := LWorking3 + LWorking7 + LBlock13; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking3 := LWorking3 + LWorking7 + LBlock6; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(11, 4, LWorking0, LWorking5, LWorking10, LWorking15) + LWorking0 := LWorking0 + LWorking5 + LBlock1; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 32); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 24); + LWorking0 := LWorking0 + LWorking5 + LBlock12; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight64(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight64(LWorking5, 63); + + // G(11, 5, LWorking1, LWorking6, LWorking11, LWorking12) + LWorking1 := LWorking1 + LWorking6 + LBlock0; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 32); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 24); + LWorking1 := LWorking1 + LWorking6 + LBlock2; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight64(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight64(LWorking6, 63); + + // G(11, 6, LWorking2, LWorking7, LWorking8, LWorking13) + LWorking2 := LWorking2 + LWorking7 + LBlock11; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 32); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 24); + LWorking2 := LWorking2 + LWorking7 + LBlock7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight64(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight64(LWorking7, 63); + + // G(11, 7, LWorking3, LWorking4, LWorking9, LWorking14) + LWorking3 := LWorking3 + LWorking4 + LBlock5; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 32); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 24); + LWorking3 := LWorking3 + LWorking4 + LBlock3; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight64(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight64(LWorking4, 63); // Finalization - FState[0] := FState[0] xor (v0 xor v8); - FState[1] := FState[1] xor (v1 xor v9); - FState[2] := FState[2] xor (v2 xor v10); - FState[3] := FState[3] xor (v3 xor v11); - FState[4] := FState[4] xor (v4 xor v12); - FState[5] := FState[5] xor (v5 xor v13); - FState[6] := FState[6] xor (v6 xor v14); - FState[7] := FState[7] xor (v7 xor v15); + FState[0] := FState[0] xor (LWorking0 xor LWorking8); + FState[1] := FState[1] xor (LWorking1 xor LWorking9); + FState[2] := FState[2] xor (LWorking2 xor LWorking10); + FState[3] := FState[3] xor (LWorking3 xor LWorking11); + FState[4] := FState[4] xor (LWorking4 xor LWorking12); + FState[5] := FState[5] xor (LWorking5 xor LWorking13); + FState[6] := FState[6] xor (LWorking6 xor LWorking14); + FState[7] := FState[7] xor (LWorking7 xor LWorking15); {$ELSE} FV[0] := FState[0]; @@ -1735,22 +1737,22 @@ procedure TBlake2B.MixScalar; FV[15] := IV7 xor FFinalizationFlag1; - for r := 0 to System.Pred(NumberOfRounds) do + for LRound := 0 to System.Pred(NumberOfRounds) do begin - G(0, 4, 8, 12, r, 0); - G(1, 5, 9, 13, r, 2); - G(2, 6, 10, 14, r, 4); - G(3, 7, 11, 15, r, 6); - G(3, 4, 9, 14, r, 14); - G(2, 7, 8, 13, r, 12); - G(0, 5, 10, 15, r, 8); - G(1, 6, 11, 12, r, 10); + G(0, 4, 8, 12, LRound, 0); + G(1, 5, 9, 13, LRound, 2); + G(2, 6, 10, 14, LRound, 4); + G(3, 7, 11, 15, LRound, 6); + G(3, 4, 9, 14, LRound, 14); + G(2, 7, 8, 13, LRound, 12); + G(0, 5, 10, 15, LRound, 8); + G(1, 6, 11, 12, LRound, 10); end; - for i := 0 to 7 do + for LWordIdx := 0 to 7 do begin - FState[i] := FState[i] xor (FV[i] xor FV[i + 8]); + FState[LWordIdx] := FState[LWordIdx] xor (FV[LWordIdx] xor FV[LWordIdx + 8]); end; {$ENDIF USE_UNROLLED_VARIANT} @@ -1764,7 +1766,7 @@ procedure TBlake2B.Compress(ABlock: PByte; AStart: Int32); constructor TBlake2B.Create(const AConfig: IBlake2BConfig); begin - Create(AConfig, Nil); + Create(AConfig, nil); end; constructor TBlake2B.Create(const AConfig: IBlake2BConfig; @@ -1774,7 +1776,7 @@ constructor TBlake2B.Create(const AConfig: IBlake2BConfig; FTreeConfig := ATreeConfig; FDoTransformKeyBlock := ADoTransformKeyBlock; - if (FConfig = Nil) then + if (FConfig = nil) then begin FConfig := TBlake2BConfig.DefaultConfig; end; @@ -1783,7 +1785,7 @@ constructor TBlake2B.Create(const AConfig: IBlake2BConfig; System.SetLength(FBuffer, BlockSizeInBytes); - Inherited Create(FConfig.HashSize, BlockSizeInBytes); + inherited Create(FConfig.HashSize, BlockSizeInBytes); end; procedure TBlake2B.Finish; @@ -1796,7 +1798,7 @@ procedure TBlake2B.Finish; FFinalizationFlag0 := System.High(UInt64); - if (FTreeConfig <> Nil) and (FTreeConfig.IsLastNode) then + if (FTreeConfig <> nil) and (FTreeConfig.IsLastNode) then begin FFinalizationFlag1 := System.High(UInt64); end; @@ -1819,11 +1821,11 @@ procedure TBlake2B.Initialize; LRawConfig: THashLibUInt64Array; begin LRawConfig := TBlake2BIvBuilder.ConfigB(FConfig, FTreeConfig); - LBlock := Nil; + LBlock := nil; if FDoTransformKeyBlock then begin - if ((FConfig.Key <> Nil) and (System.Length(FConfig.Key) <> 0)) then + if ((FConfig.Key <> nil) and (System.Length(FConfig.Key) <> 0)) then begin LBlock := System.Copy(FConfig.Key, System.Low(FConfig.Key), System.Length(FConfig.Key)); @@ -1831,7 +1833,7 @@ procedure TBlake2B.Initialize; end; end; - if (LRawConfig = Nil) then + if (LRawConfig = nil) then begin raise EArgumentNilHashLibException.CreateRes(@SConfigNil); end; @@ -1870,7 +1872,7 @@ procedure TBlake2B.Initialize; if FDoTransformKeyBlock then begin - if (LBlock <> Nil) then + if (LBlock <> nil) then begin TransformBytes(LBlock, 0, System.Length(LBlock)); TArrayUtils.ZeroFill(LBlock); // burn key from memory @@ -1961,13 +1963,13 @@ procedure TBlake2XBConfig.SetBlake2BTreeConfig(const AValue function TBlake2XBConfig.Clone(): TBlake2XBConfig; begin - Result := Default (TBlake2XBConfig); - if FBlake2BConfig <> Nil then + Result := Default(TBlake2XBConfig); + if FBlake2BConfig <> nil then begin Result.Blake2BConfig := FBlake2BConfig.Clone(); end; - if FBlake2BTreeConfig <> Nil then + if FBlake2BTreeConfig <> nil then begin Result.Blake2BTreeConfig := FBlake2BTreeConfig.Clone(); end; @@ -1997,7 +1999,7 @@ function TBlake2XB.SetXOFSizeInBitsInternal(AXofSizeInBits: UInt64): IXOF; LXofSizeInBytes: UInt64; begin LXofSizeInBytes := AXofSizeInBits shr 3; - If ((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1) or + if ((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1) or (LXofSizeInBytes > UInt64(UnknownDigestLengthInBytes)) then begin raise EArgumentInvalidHashLibException.CreateResFmt(@SInvalidXOFSize, @@ -2074,7 +2076,7 @@ function TBlake2XB.Clone(): IHash; LHashInstance.FFinalizationFlag0 := FFinalizationFlag0; LHashInstance.FFinalizationFlag1 := FFinalizationFlag1; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -2088,11 +2090,11 @@ constructor TBlake2XB.Create(const ABlake2XBConfig: TBlake2XBConfig); begin FBlake2XBConfig := ABlake2XBConfig; // Create root hash config. - FRootConfig := Default (TBlake2XBConfig); + FRootConfig := Default(TBlake2XBConfig); FRootConfig.Blake2BConfig := FBlake2XBConfig.Blake2BConfig; - if FRootConfig.Blake2BConfig = Nil then + if FRootConfig.Blake2BConfig = nil then begin FRootConfig.Blake2BConfig := TBlake2BConfig.Create(); end @@ -2106,7 +2108,7 @@ constructor TBlake2XB.Create(const ABlake2XBConfig: TBlake2XBConfig); FRootConfig.Blake2BTreeConfig := FBlake2XBConfig.Blake2BTreeConfig; - if FRootConfig.Blake2BTreeConfig = Nil then + if FRootConfig.Blake2BTreeConfig = nil then begin FRootConfig.Blake2BTreeConfig := TBlake2BTreeConfig.Create(); FRootConfig.Blake2BTreeConfig.FanOut := 1; @@ -2120,7 +2122,7 @@ constructor TBlake2XB.Create(const ABlake2XBConfig: TBlake2XBConfig); end; // Create initial config for output hashes. - FOutputConfig := Default (TBlake2XBConfig); + FOutputConfig := Default(TBlake2XBConfig); FOutputConfig.Blake2BConfig := TBlake2BConfig.Create(); FOutputConfig.Blake2BConfig.Salt := FRootConfig.Blake2BConfig.Salt; @@ -2146,7 +2148,7 @@ procedure TBlake2XB.Initialize; FOutputConfig.Blake2BTreeConfig.NodeOffset := NodeOffsetWithXOFDigestLength (LXofSizeInBytes); - FRootHashDigest := Nil; + FRootHashDigest := nil; FDigestPosition := 0; FFinalized := False; TArrayUtils.ZeroFill(FBlake2XBBuffer); @@ -2157,6 +2159,7 @@ procedure TBlake2XB.DoOutput(const ADestination: THashLibByteArray; ADestinationOffset, AOutputLength: UInt64); var LDiff, LCount, LBlockOffset: UInt64; + LHash: IHash; begin if (UInt64(System.Length(ADestination)) - ADestinationOffset) < AOutputLength @@ -2185,7 +2188,7 @@ procedure TBlake2XB.DoOutput(const ADestination: THashLibByteArray; FFinalized := True; end; - if (FRootHashDigest = Nil) then + if (FRootHashDigest = nil) then begin // Get root digest System.SetLength(FRootHashDigest, Blake2BHashSize); @@ -2200,9 +2203,8 @@ procedure TBlake2XB.DoOutput(const ADestination: THashLibByteArray; FOutputConfig.Blake2BConfig.HashSize := ComputeStepLength(); FOutputConfig.Blake2BTreeConfig.InnerHashSize := Blake2BHashSize; - FBlake2XBBuffer := (TBlake2B.Create(FOutputConfig.Blake2BConfig, - FOutputConfig.Blake2BTreeConfig) as IHash).ComputeBytes(FRootHashDigest) - .GetBytes(); + LHash := TBlake2B.Create(FOutputConfig.Blake2BConfig, FOutputConfig.Blake2BTreeConfig); + FBlake2XBBuffer := LHash.ComputeBytes(FRootHashDigest).GetBytes(); FOutputConfig.Blake2BTreeConfig.NodeOffset := FOutputConfig.Blake2BTreeConfig.NodeOffset + 1; end; @@ -2278,7 +2280,7 @@ function TBlake2BMACNotBuildInAdapter.Clone(): IHash; LHashInstance: TBlake2BMACNotBuildInAdapter; begin LHashInstance := TBlake2BMACNotBuildInAdapter.Create(FHash.Clone(), FKey); - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -2291,13 +2293,13 @@ constructor TBlake2BMACNotBuildInAdapter.Create(const ABlake2BKey, ASalt, LConfig.Key := ABlake2BKey; LConfig.Salt := ASalt; LConfig.Personalisation := APersonalisation; - Create(TBlake2B.Create(LConfig, Nil) as IHash, ABlake2BKey); + Create(TBlake2B.Create(LConfig, nil) as IHash, ABlake2BKey); end; constructor TBlake2BMACNotBuildInAdapter.Create(const AHash: IHash; const ABlake2BKey: THashLibByteArray); begin - Inherited Create(AHash.HashSize, AHash.BlockSize); + inherited Create(AHash.HashSize, AHash.BlockSize); SetKey(ABlake2BKey); FHash := AHash; end; @@ -2333,9 +2335,9 @@ procedure TBlake2BMACNotBuildInAdapter.Initialize; procedure TBlake2BMACNotBuildInAdapter.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin - FKey := Nil; + FKey := nil; end else begin diff --git a/HashLib/src/Crypto/HlpBlake2BP.pas b/HashLib/src/Crypto/HlpBlake2BP.pas index f2d62ace..0db92351 100644 --- a/HashLib/src/Crypto/HlpBlake2BP.pas +++ b/HashLib/src/Crypto/HlpBlake2BP.pas @@ -42,10 +42,10 @@ TBlake2BP = class sealed(THash, ICryptoNotBuildIn, ITransformBlock) /// of these instances is given by TBlake2BTreeConfig.InnerSize /// instead.
/// - function Blake2BPCreateLeafParam(const ABlake2BConfig: IBlake2BConfig; + function CreateLeafParam(const ABlake2BConfig: IBlake2BConfig; const ABlake2BTreeConfig: IBlake2BTreeConfig): TBlake2B; - function Blake2BPCreateLeaf(AOffset: UInt64): TBlake2B; - function Blake2BPCreateRoot(): TBlake2B; + function CreateLeaf(AOffset: UInt64): TBlake2B; + function CreateRoot(): TBlake2B; // Each lane processes its own "stripe" of the input procedure ProcessLeafLane(AIdx: Int32; APtrData: PByte; @@ -77,13 +77,13 @@ implementation { TBlake2BP } -function TBlake2BP.Blake2BPCreateLeafParam(const ABlake2BConfig: IBlake2BConfig; +function TBlake2BP.CreateLeafParam(const ABlake2BConfig: IBlake2BConfig; const ABlake2BTreeConfig: IBlake2BTreeConfig): TBlake2B; begin Result := TBlake2B.Create(ABlake2BConfig, ABlake2BTreeConfig); end; -function TBlake2BP.Blake2BPCreateLeaf(AOffset: UInt64): TBlake2B; +function TBlake2BP.CreateLeaf(AOffset: UInt64): TBlake2B; var LBlake2BConfig: IBlake2BConfig; LBlake2BTreeConfig: IBlake2BTreeConfig; @@ -104,10 +104,10 @@ function TBlake2BP.Blake2BPCreateLeaf(AOffset: UInt64): TBlake2B; LBlake2BTreeConfig.IsLastNode := True; end; - Result := Blake2BPCreateLeafParam(LBlake2BConfig, LBlake2BTreeConfig); + Result := CreateLeafParam(LBlake2BConfig, LBlake2BTreeConfig); end; -function TBlake2BP.Blake2BPCreateRoot(): TBlake2B; +function TBlake2BP.CreateRoot(): TBlake2B; var LBlake2BConfig: IBlake2BConfig; LBlake2BTreeConfig: IBlake2BTreeConfig; @@ -151,7 +151,7 @@ function TBlake2BP.Clone(): IHash; LHashInstance := TBlake2BP.CreateInternal(HashSize); LHashInstance.FKey := System.Copy(FKey); - if FRootHash <> Nil then + if FRootHash <> nil then begin LHashInstance.FRootHash := FRootHash.CloneInternal(); end; @@ -160,30 +160,30 @@ function TBlake2BP.Clone(): IHash; LHashInstance.FBuffer := System.Copy(FBuffer); LHashInstance.FBufferLength := FBufferLength; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TBlake2BP.CreateInternal(AHashSize: Int32); begin - Inherited Create(AHashSize, BlockSizeInBytes); + inherited Create(AHashSize, BlockSizeInBytes); end; constructor TBlake2BP.Create(AHashSize: Int32; const AKey: THashLibByteArray); var LIdx: Int32; begin - Inherited Create(AHashSize, BlockSizeInBytes); + inherited Create(AHashSize, BlockSizeInBytes); System.SetLength(FBuffer, ParallelismDegree * BlockSizeInBytes); System.SetLength(FLeafHashes, ParallelismDegree); FKey := System.Copy(AKey); - FRootHash := Blake2BPCreateRoot; + FRootHash := CreateRoot; for LIdx := 0 to System.Pred(ParallelismDegree) do begin - FLeafHashes[LIdx] := Blake2BPCreateLeaf(LIdx); + FLeafHashes[LIdx] := CreateLeaf(LIdx); end; end; @@ -194,15 +194,15 @@ destructor TBlake2BP.Destroy; Clear(); FRootHash.Free; - FRootHash := Nil; + FRootHash := nil; for LIdx := System.Low(FLeafHashes) to System.High(FLeafHashes) do begin FLeafHashes[LIdx].Free; - FLeafHashes[LIdx] := Nil; + FLeafHashes[LIdx] := nil; end; - FLeafHashes := Nil; + FLeafHashes := nil; inherited Destroy; end; @@ -243,7 +243,7 @@ procedure TBlake2BP.ProcessLeafLane(AIdx: Int32; APtrData: PByte; LLeafHashes := FLeafHashes; // Start at lane offset - Inc(LPtrData, AIdx * BlockSizeInBytes); + System.Inc(LPtrData, AIdx * BlockSizeInBytes); // Process all full "stripes" of ParallelismDegree * BlockSizeInBytes while (LCounter >= StripeSize) do @@ -251,7 +251,7 @@ procedure TBlake2BP.ProcessLeafLane(AIdx: Int32; APtrData: PByte; System.Move(LPtrData^, LTemp[0], BlockSizeInBytes); LLeafHashes[AIdx].TransformBytes(LTemp, 0, BlockSizeInBytes); - Inc(LPtrData, UInt64(StripeSize)); + System.Inc(LPtrData, UInt64(StripeSize)); LCounter := LCounter - UInt64(StripeSize); end; end; @@ -325,7 +325,7 @@ procedure TBlake2BP.TransformBytes(const AData: THashLibByteArray; // Move pointer past processed data (everything except the remainder) LProcessed := (LDataLength div StripeSize) * StripeSize; - Inc(LPtrData, LProcessed); + System.Inc(LPtrData, LProcessed); // Keep the remainder in the buffer LDataLength := LDataLength - LProcessed; @@ -350,10 +350,6 @@ function TBlake2BP.TransformFinal: IHashResult; LRootHash := FRootHash; System.SetLength(LHash, ParallelismDegree); - for LIdx := System.Low(LHash) to System.High(LHash) do - begin - System.SetLength(LHash[LIdx], OutSizeInBytes); - end; // Finalize each leaf with the remaining buffered bytes for LIdx := 0 to System.Pred(ParallelismDegree) do diff --git a/HashLib/src/Crypto/HlpBlake2S.pas b/HashLib/src/Crypto/HlpBlake2S.pas index 2ae234aa..3def3e3c 100644 --- a/HashLib/src/Crypto/HlpBlake2S.pas +++ b/HashLib/src/Crypto/HlpBlake2S.pas @@ -20,7 +20,7 @@ interface resourcestring SInvalidConfigLength = 'Config Length Must Be 8 Words'; - SConfigNil = 'Config Cannot Be Nil'; + SConfigNil = 'Config Cannot Be nil'; SInvalidXOFSize = 'XOFSize in Bits must be Multiples of 8 and be Between %u and %u Bytes.'; SOutputLengthInvalid = 'Output Length is above the Digest Length'; @@ -71,7 +71,8 @@ TBlake2S = class(THash, ICryptoNotBuildIn, ITransformBlock) procedure Blake2SIncrementCounter(AIncrementCount: UInt32); inline; {$IFNDEF USE_UNROLLED_VARIANT} - procedure G(a, b, c, d, r, i: Int32); inline; + procedure G(AStateIdx0, AStateIdx1, AStateIdx2, AStateIdx3, ARound, + AMixIdx: Int32); inline; {$ENDIF USE_UNROLLED_VARIANT} procedure MixScalar(); procedure Compress(ABlock: PByte; AStart: Int32); inline; @@ -248,16 +249,19 @@ procedure TBlake2S.Blake2SIncrementCounter(AIncrementCount: UInt32); {$IFNDEF USE_UNROLLED_VARIANT} -procedure TBlake2S.G(a, b, c, d, r, i: Int32); +procedure TBlake2S.G(AStateIdx0, AStateIdx1, AStateIdx2, AStateIdx3, ARound, + AMixIdx: Int32); begin - FV[a] := FV[a] + (FV[b] + FM[Sigma[r][2 * i + 0]]); - FV[d] := TBits.RotateRight32(FV[d] xor FV[a], 16); - FV[c] := FV[c] + FV[d]; - FV[b] := TBits.RotateRight32(FV[b] xor FV[c], 12); - FV[a] := FV[a] + (FV[b] + FM[Sigma[r][2 * i + 1]]); - FV[d] := TBits.RotateRight32(FV[d] xor FV[a], 8); - FV[c] := FV[c] + FV[d]; - FV[b] := TBits.RotateRight32(FV[b] xor FV[c], 7); + FV[AStateIdx0] := FV[AStateIdx0] + (FV[AStateIdx1] + + FM[Sigma[ARound][2 * AMixIdx + 0]]); + FV[AStateIdx3] := TBits.RotateRight32(FV[AStateIdx3] xor FV[AStateIdx0], 16); + FV[AStateIdx2] := FV[AStateIdx2] + FV[AStateIdx3]; + FV[AStateIdx1] := TBits.RotateRight32(FV[AStateIdx1] xor FV[AStateIdx2], 12); + FV[AStateIdx0] := FV[AStateIdx0] + (FV[AStateIdx1] + + FM[Sigma[ARound][2 * AMixIdx + 1]]); + FV[AStateIdx3] := TBits.RotateRight32(FV[AStateIdx3] xor FV[AStateIdx0], 8); + FV[AStateIdx2] := FV[AStateIdx2] + FV[AStateIdx3]; + FV[AStateIdx1] := TBits.RotateRight32(FV[AStateIdx1] xor FV[AStateIdx2], 7); end; {$ENDIF USE_UNROLLED_VARIANT} @@ -266,8 +270,8 @@ function TBlake2S.CloneInternal(): TBlake2S; var LTreeConfig: IBlake2STreeConfig; begin - LTreeConfig := Nil; - if FTreeConfig <> Nil then + LTreeConfig := nil; + if FTreeConfig <> nil then begin LTreeConfig := FTreeConfig.Clone(); end; @@ -288,1208 +292,1208 @@ function TBlake2S.CloneInternal(): TBlake2S; function TBlake2S.Clone(): IHash; begin - Result := CloneInternal() as IHash; + Result := CloneInternal(); end; procedure TBlake2S.MixScalar; var {$IFDEF USE_UNROLLED_VARIANT} - m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, v0, v1, - v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15: UInt32; + LBlock0, LBlock1, LBlock2, LBlock3, LBlock4, LBlock5, LBlock6, LBlock7, LBlock8, LBlock9, LBlock10, LBlock11, LBlock12, LBlock13, LBlock14, LBlock15, LWorking0, LWorking1, + LWorking2, LWorking3, LWorking4, LWorking5, LWorking6, LWorking7, LWorking8, LWorking9, LWorking10, LWorking11, LWorking12, LWorking13, LWorking14, LWorking15: UInt32; {$ELSE} - i, r: Int32; + LWordIdx, LRound: Int32; {$ENDIF USE_UNROLLED_VARIANT} begin {$IFDEF USE_UNROLLED_VARIANT} - m0 := FM[0]; - m1 := FM[1]; - m2 := FM[2]; - m3 := FM[3]; - m4 := FM[4]; - m5 := FM[5]; - m6 := FM[6]; - m7 := FM[7]; - m8 := FM[8]; - m9 := FM[9]; - m10 := FM[10]; - m11 := FM[11]; - m12 := FM[12]; - m13 := FM[13]; - m14 := FM[14]; - m15 := FM[15]; - - v0 := FState[0]; - v1 := FState[1]; - v2 := FState[2]; - v3 := FState[3]; - v4 := FState[4]; - v5 := FState[5]; - v6 := FState[6]; - v7 := FState[7]; - - v8 := IV0; - v9 := IV1; - v10 := IV2; - v11 := IV3; - v12 := IV4 xor FCounter0; - v13 := IV5 xor FCounter1; - v14 := IV6 xor FFinalizationFlag0; - v15 := IV7 xor FFinalizationFlag1; + LBlock0 := FM[0]; + LBlock1 := FM[1]; + LBlock2 := FM[2]; + LBlock3 := FM[3]; + LBlock4 := FM[4]; + LBlock5 := FM[5]; + LBlock6 := FM[6]; + LBlock7 := FM[7]; + LBlock8 := FM[8]; + LBlock9 := FM[9]; + LBlock10 := FM[10]; + LBlock11 := FM[11]; + LBlock12 := FM[12]; + LBlock13 := FM[13]; + LBlock14 := FM[14]; + LBlock15 := FM[15]; + + LWorking0 := FState[0]; + LWorking1 := FState[1]; + LWorking2 := FState[2]; + LWorking3 := FState[3]; + LWorking4 := FState[4]; + LWorking5 := FState[5]; + LWorking6 := FState[6]; + LWorking7 := FState[7]; + + LWorking8 := IV0; + LWorking9 := IV1; + LWorking10 := IV2; + LWorking11 := IV3; + LWorking12 := IV4 xor FCounter0; + LWorking13 := IV5 xor FCounter1; + LWorking14 := IV6 xor FFinalizationFlag0; + LWorking15 := IV7 xor FFinalizationFlag1; // Rounds // * // Round 1. - v0 := v0 + m0; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m2; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m4; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m6; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m5; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m7; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m3; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m1; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m8; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m10; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m12; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m14; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m13; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m15; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m11; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m9; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock0; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock2; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock4; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock6; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock5; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock7; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock3; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock1; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock8; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock10; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock12; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock14; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock13; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock15; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock11; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock9; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 2. - v0 := v0 + m14; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m4; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m9; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m13; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m15; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m6; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m8; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m10; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m1; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m0; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m11; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m5; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m7; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m3; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m2; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m12; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock14; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock4; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock9; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock13; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock15; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock6; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock8; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock10; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock1; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock0; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock11; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock5; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock7; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock3; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock2; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock12; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 3. - v0 := v0 + m11; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m12; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m5; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m15; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m2; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m13; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m0; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m8; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m10; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m3; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m7; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m9; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m1; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m4; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m6; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m14; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock11; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock12; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock5; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock15; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock2; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock13; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock0; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock8; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock10; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock3; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock7; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock9; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock1; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock4; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock6; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock14; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 4. - v0 := v0 + m7; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m3; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m13; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m11; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m12; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m14; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m1; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m9; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m2; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m5; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m4; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m15; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m0; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m8; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m10; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m6; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock7; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock3; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock13; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock11; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock12; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock14; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock1; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock9; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock2; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock5; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock4; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock15; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock0; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock8; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock10; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock6; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 5. - v0 := v0 + m9; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m5; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m2; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m10; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m4; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m15; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m7; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m0; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m14; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m11; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m6; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m3; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m8; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m13; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m12; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m1; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock9; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock5; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock2; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock10; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock4; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock15; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock7; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock0; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock14; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock11; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock6; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock3; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock8; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock13; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock12; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock1; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 6. - v0 := v0 + m2; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m6; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m0; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m8; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m11; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m3; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m10; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m12; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m4; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m7; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m15; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m1; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m14; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m9; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m5; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m13; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock2; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock6; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock0; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock8; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock11; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock3; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock10; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock12; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock4; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock7; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock15; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock1; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock14; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock9; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock5; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock13; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 7. - v0 := v0 + m12; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m1; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m14; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m4; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m13; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m10; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m15; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m5; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m0; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m6; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m9; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m8; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m2; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m11; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m3; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m7; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock12; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock1; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock14; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock4; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock13; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock10; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock15; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock5; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock0; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock6; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock9; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock8; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock2; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock11; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock3; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock7; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 8. - v0 := v0 + m13; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m7; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m12; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m3; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m1; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m9; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m14; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m11; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m5; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m15; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m8; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m2; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m6; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m10; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m4; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m0; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock13; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock7; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock12; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock3; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock1; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock9; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock14; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock11; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock5; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock15; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock8; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock2; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock6; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock10; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock4; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock0; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 9. - v0 := v0 + m6; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m14; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m11; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m0; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m3; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m8; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m9; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m15; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m12; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m13; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m1; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m10; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m4; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m5; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m7; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m2; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock6; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock14; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock11; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock0; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock3; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock8; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock9; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock15; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock12; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock13; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock1; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock10; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock4; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock5; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock7; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock2; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // Round 10. - v0 := v0 + m10; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 16); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 12); - v1 := v1 + m8; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 16); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 12); - v2 := v2 + m7; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 16); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 12); - v3 := v3 + m1; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 16); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 12); - v2 := v2 + m6; - v2 := v2 + v6; - v14 := v14 xor v2; - v14 := TBits.RotateRight32(v14, 8); - v10 := v10 + v14; - v6 := v6 xor v10; - v6 := TBits.RotateRight32(v6, 7); - v3 := v3 + m5; - v3 := v3 + v7; - v15 := v15 xor v3; - v15 := TBits.RotateRight32(v15, 8); - v11 := v11 + v15; - v7 := v7 xor v11; - v7 := TBits.RotateRight32(v7, 7); - v1 := v1 + m4; - v1 := v1 + v5; - v13 := v13 xor v1; - v13 := TBits.RotateRight32(v13, 8); - v9 := v9 + v13; - v5 := v5 xor v9; - v5 := TBits.RotateRight32(v5, 7); - v0 := v0 + m2; - v0 := v0 + v4; - v12 := v12 xor v0; - v12 := TBits.RotateRight32(v12, 8); - v8 := v8 + v12; - v4 := v4 xor v8; - v4 := TBits.RotateRight32(v4, 7); - v0 := v0 + m15; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 16); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 12); - v1 := v1 + m9; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 16); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 12); - v2 := v2 + m3; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 16); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 12); - v3 := v3 + m13; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 16); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 12); - v2 := v2 + m12; - v2 := v2 + v7; - v13 := v13 xor v2; - v13 := TBits.RotateRight32(v13, 8); - v8 := v8 + v13; - v7 := v7 xor v8; - v7 := TBits.RotateRight32(v7, 7); - v3 := v3 + m0; - v3 := v3 + v4; - v14 := v14 xor v3; - v14 := TBits.RotateRight32(v14, 8); - v9 := v9 + v14; - v4 := v4 xor v9; - v4 := TBits.RotateRight32(v4, 7); - v1 := v1 + m14; - v1 := v1 + v6; - v12 := v12 xor v1; - v12 := TBits.RotateRight32(v12, 8); - v11 := v11 + v12; - v6 := v6 xor v11; - v6 := TBits.RotateRight32(v6, 7); - v0 := v0 + m11; - v0 := v0 + v5; - v15 := v15 xor v0; - v15 := TBits.RotateRight32(v15, 8); - v10 := v10 + v15; - v5 := v5 xor v10; - v5 := TBits.RotateRight32(v5, 7); + LWorking0 := LWorking0 + LBlock10; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking1 := LWorking1 + LBlock8; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking2 := LWorking2 + LBlock7; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking3 := LWorking3 + LBlock1; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking2 := LWorking2 + LBlock6; + LWorking2 := LWorking2 + LWorking6; + LWorking14 := LWorking14 xor LWorking2; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking10 := LWorking10 + LWorking14; + LWorking6 := LWorking6 xor LWorking10; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking3 := LWorking3 + LBlock5; + LWorking3 := LWorking3 + LWorking7; + LWorking15 := LWorking15 xor LWorking3; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking11 := LWorking11 + LWorking15; + LWorking7 := LWorking7 xor LWorking11; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking1 := LWorking1 + LBlock4; + LWorking1 := LWorking1 + LWorking5; + LWorking13 := LWorking13 xor LWorking1; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking9 := LWorking9 + LWorking13; + LWorking5 := LWorking5 xor LWorking9; + LWorking5 := TBits.RotateRight32(LWorking5, 7); + LWorking0 := LWorking0 + LBlock2; + LWorking0 := LWorking0 + LWorking4; + LWorking12 := LWorking12 xor LWorking0; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking8 := LWorking8 + LWorking12; + LWorking4 := LWorking4 xor LWorking8; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking0 := LWorking0 + LBlock15; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 16); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 12); + LWorking1 := LWorking1 + LBlock9; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 16); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 12); + LWorking2 := LWorking2 + LBlock3; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 16); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 12); + LWorking3 := LWorking3 + LBlock13; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 16); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 12); + LWorking2 := LWorking2 + LBlock12; + LWorking2 := LWorking2 + LWorking7; + LWorking13 := LWorking13 xor LWorking2; + LWorking13 := TBits.RotateRight32(LWorking13, 8); + LWorking8 := LWorking8 + LWorking13; + LWorking7 := LWorking7 xor LWorking8; + LWorking7 := TBits.RotateRight32(LWorking7, 7); + LWorking3 := LWorking3 + LBlock0; + LWorking3 := LWorking3 + LWorking4; + LWorking14 := LWorking14 xor LWorking3; + LWorking14 := TBits.RotateRight32(LWorking14, 8); + LWorking9 := LWorking9 + LWorking14; + LWorking4 := LWorking4 xor LWorking9; + LWorking4 := TBits.RotateRight32(LWorking4, 7); + LWorking1 := LWorking1 + LBlock14; + LWorking1 := LWorking1 + LWorking6; + LWorking12 := LWorking12 xor LWorking1; + LWorking12 := TBits.RotateRight32(LWorking12, 8); + LWorking11 := LWorking11 + LWorking12; + LWorking6 := LWorking6 xor LWorking11; + LWorking6 := TBits.RotateRight32(LWorking6, 7); + LWorking0 := LWorking0 + LBlock11; + LWorking0 := LWorking0 + LWorking5; + LWorking15 := LWorking15 xor LWorking0; + LWorking15 := TBits.RotateRight32(LWorking15, 8); + LWorking10 := LWorking10 + LWorking15; + LWorking5 := LWorking5 xor LWorking10; + LWorking5 := TBits.RotateRight32(LWorking5, 7); // */ // Finalization - FState[0] := FState[0] xor (v0 xor v8); - FState[1] := FState[1] xor (v1 xor v9); - FState[2] := FState[2] xor (v2 xor v10); - FState[3] := FState[3] xor (v3 xor v11); - FState[4] := FState[4] xor (v4 xor v12); - FState[5] := FState[5] xor (v5 xor v13); - FState[6] := FState[6] xor (v6 xor v14); - FState[7] := FState[7] xor (v7 xor v15); + FState[0] := FState[0] xor (LWorking0 xor LWorking8); + FState[1] := FState[1] xor (LWorking1 xor LWorking9); + FState[2] := FState[2] xor (LWorking2 xor LWorking10); + FState[3] := FState[3] xor (LWorking3 xor LWorking11); + FState[4] := FState[4] xor (LWorking4 xor LWorking12); + FState[5] := FState[5] xor (LWorking5 xor LWorking13); + FState[6] := FState[6] xor (LWorking6 xor LWorking14); + FState[7] := FState[7] xor (LWorking7 xor LWorking15); {$ELSE} FV[0] := FState[0]; @@ -1512,23 +1516,23 @@ procedure TBlake2S.MixScalar; FV[15] := IV7 xor FFinalizationFlag1; - for r := 0 to System.Pred(NumberOfRounds) do + for LRound := 0 to System.Pred(NumberOfRounds) do begin - G(0, 4, 8, 12, r, 0); - G(1, 5, 9, 13, r, 1); - G(2, 6, 10, 14, r, 2); - G(3, 7, 11, 15, r, 3); - G(0, 5, 10, 15, r, 4); - G(1, 6, 11, 12, r, 5); - G(2, 7, 8, 13, r, 6); - G(3, 4, 9, 14, r, 7); + G(0, 4, 8, 12, LRound, 0); + G(1, 5, 9, 13, LRound, 1); + G(2, 6, 10, 14, LRound, 2); + G(3, 7, 11, 15, LRound, 3); + G(0, 5, 10, 15, LRound, 4); + G(1, 6, 11, 12, LRound, 5); + G(2, 7, 8, 13, LRound, 6); + G(3, 4, 9, 14, LRound, 7); end; - for i := 0 to 7 do + for LWordIdx := 0 to 7 do begin - FState[i] := FState[i] xor (FV[i] xor FV[i + 8]); + FState[LWordIdx] := FState[LWordIdx] xor (FV[LWordIdx] xor FV[LWordIdx + 8]); end; {$ENDIF USE_UNROLLED_VARIANT} @@ -1542,7 +1546,7 @@ procedure TBlake2S.Compress(ABlock: PByte; AStart: Int32); constructor TBlake2S.Create(const AConfig: IBlake2SConfig); begin - Create(AConfig, Nil); + Create(AConfig, nil); end; constructor TBlake2S.Create(const AConfig: IBlake2SConfig; @@ -1552,7 +1556,7 @@ constructor TBlake2S.Create(const AConfig: IBlake2SConfig; FTreeConfig := ATreeConfig; FDoTransformKeyBlock := ADoTransformKeyBlock; - if (FConfig = Nil) then + if (FConfig = nil) then begin FConfig := TBlake2SConfig.DefaultConfig; end; @@ -1561,7 +1565,7 @@ constructor TBlake2S.Create(const AConfig: IBlake2SConfig; System.SetLength(FBuffer, BlockSizeInBytes); - Inherited Create(FConfig.HashSize, BlockSizeInBytes); + inherited Create(FConfig.HashSize, BlockSizeInBytes); end; procedure TBlake2S.Finish; @@ -1574,7 +1578,7 @@ procedure TBlake2S.Finish; FFinalizationFlag0 := System.High(UInt32); - if (FTreeConfig <> Nil) and (FTreeConfig.IsLastNode) then + if (FTreeConfig <> nil) and (FTreeConfig.IsLastNode) then begin FFinalizationFlag1 := System.High(UInt32); end; @@ -1597,11 +1601,11 @@ procedure TBlake2S.Initialize; LRawConfig: THashLibUInt32Array; begin LRawConfig := TBlake2SIvBuilder.ConfigS(FConfig, FTreeConfig); - LBlock := Nil; + LBlock := nil; if FDoTransformKeyBlock then begin - if ((FConfig.Key <> Nil) and (System.Length(FConfig.Key) <> 0)) then + if ((FConfig.Key <> nil) and (System.Length(FConfig.Key) <> 0)) then begin LBlock := System.Copy(FConfig.Key, System.Low(FConfig.Key), System.Length(FConfig.Key)); @@ -1609,7 +1613,7 @@ procedure TBlake2S.Initialize; end; end; - if (LRawConfig = Nil) then + if (LRawConfig = nil) then begin raise EArgumentNilHashLibException.CreateRes(@SConfigNil); end; @@ -1648,7 +1652,7 @@ procedure TBlake2S.Initialize; if FDoTransformKeyBlock then begin - if (LBlock <> Nil) then + if (LBlock <> nil) then begin TransformBytes(LBlock, 0, System.Length(LBlock)); TArrayUtils.ZeroFill(LBlock); // burn key from memory @@ -1739,13 +1743,13 @@ procedure TBlake2XSConfig.SetBlake2STreeConfig(const AValue function TBlake2XSConfig.Clone(): TBlake2XSConfig; begin - Result := Default (TBlake2XSConfig); - if FBlake2SConfig <> Nil then + Result := Default(TBlake2XSConfig); + if FBlake2SConfig <> nil then begin Result.Blake2SConfig := FBlake2SConfig.Clone(); end; - if FBlake2STreeConfig <> Nil then + if FBlake2STreeConfig <> nil then begin Result.Blake2STreeConfig := FBlake2STreeConfig.Clone(); end; @@ -1775,7 +1779,7 @@ function TBlake2XS.SetXOFSizeInBitsInternal(AXofSizeInBits: UInt64): IXOF; LXofSizeInBytes: UInt64; begin LXofSizeInBytes := AXofSizeInBits shr 3; - If ((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1) or + if ((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1) or (LXofSizeInBytes > UInt64(UnknownDigestLengthInBytes)) then begin raise EArgumentInvalidHashLibException.CreateResFmt(@SInvalidXOFSize, @@ -1851,7 +1855,7 @@ function TBlake2XS.Clone(): IHash; LHashInstance.FFinalizationFlag0 := FFinalizationFlag0; LHashInstance.FFinalizationFlag1 := FFinalizationFlag1; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -1865,11 +1869,11 @@ constructor TBlake2XS.Create(const ABlake2XSConfig: TBlake2XSConfig); begin FBlake2XSConfig := ABlake2XSConfig; // Create root hash config. - FRootConfig := Default (TBlake2XSConfig); + FRootConfig := Default(TBlake2XSConfig); FRootConfig.Blake2SConfig := FBlake2XSConfig.Blake2SConfig; - if FRootConfig.Blake2SConfig = Nil then + if FRootConfig.Blake2SConfig = nil then begin FRootConfig.Blake2SConfig := TBlake2SConfig.Create(); end @@ -1883,7 +1887,7 @@ constructor TBlake2XS.Create(const ABlake2XSConfig: TBlake2XSConfig); FRootConfig.Blake2STreeConfig := FBlake2XSConfig.Blake2STreeConfig; - if FRootConfig.Blake2STreeConfig = Nil then + if FRootConfig.Blake2STreeConfig = nil then begin FRootConfig.Blake2STreeConfig := TBlake2STreeConfig.Create(); FRootConfig.Blake2STreeConfig.FanOut := 1; @@ -1897,7 +1901,7 @@ constructor TBlake2XS.Create(const ABlake2XSConfig: TBlake2XSConfig); end; // Create initial config for output hashes. - FOutputConfig := Default (TBlake2XSConfig); + FOutputConfig := Default(TBlake2XSConfig); FOutputConfig.Blake2SConfig := TBlake2SConfig.Create(); FOutputConfig.Blake2SConfig.Salt := FRootConfig.Blake2SConfig.Salt; @@ -1921,7 +1925,7 @@ procedure TBlake2XS.Initialize; FOutputConfig.Blake2STreeConfig.NodeOffset := NodeOffsetWithXOFDigestLength (LXofSizeInBytes); - FRootHashDigest := Nil; + FRootHashDigest := nil; FDigestPosition := 0; FFinalized := False; TArrayUtils.ZeroFill(FBlake2XSBuffer); @@ -1932,6 +1936,7 @@ procedure TBlake2XS.DoOutput(const ADestination: THashLibByteArray; ADestinationOffset, AOutputLength: UInt64); var LDiff, LCount, LBlockOffset: UInt64; + LHash: IHash; begin if (UInt64(System.Length(ADestination)) - ADestinationOffset) < AOutputLength @@ -1960,7 +1965,7 @@ procedure TBlake2XS.DoOutput(const ADestination: THashLibByteArray; FFinalized := True; end; - if (FRootHashDigest = Nil) then + if (FRootHashDigest = nil) then begin // Get root digest System.SetLength(FRootHashDigest, Blake2SHashSize); @@ -1975,9 +1980,8 @@ procedure TBlake2XS.DoOutput(const ADestination: THashLibByteArray; FOutputConfig.Blake2SConfig.HashSize := ComputeStepLength(); FOutputConfig.Blake2STreeConfig.InnerHashSize := Blake2SHashSize; - FBlake2XSBuffer := (TBlake2S.Create(FOutputConfig.Blake2SConfig, - FOutputConfig.Blake2STreeConfig) as IHash).ComputeBytes(FRootHashDigest) - .GetBytes(); + LHash := TBlake2S.Create(FOutputConfig.Blake2SConfig, FOutputConfig.Blake2STreeConfig); + FBlake2XSBuffer := LHash.ComputeBytes(FRootHashDigest).GetBytes(); FOutputConfig.Blake2STreeConfig.NodeOffset := FOutputConfig.Blake2STreeConfig.NodeOffset + 1; end; @@ -2053,7 +2057,7 @@ function TBlake2SMACNotBuildInAdapter.Clone(): IHash; LHashInstance: TBlake2SMACNotBuildInAdapter; begin LHashInstance := TBlake2SMACNotBuildInAdapter.Create(FHash.Clone(), FKey); - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -2066,13 +2070,13 @@ constructor TBlake2SMACNotBuildInAdapter.Create(const ABlake2SKey, ASalt, LConfig.Key := ABlake2SKey; LConfig.Salt := ASalt; LConfig.Personalisation := APersonalisation; - Create(TBlake2S.Create(LConfig, Nil) as IHash, ABlake2SKey); + Create(TBlake2S.Create(LConfig, nil) as IHash, ABlake2SKey); end; constructor TBlake2SMACNotBuildInAdapter.Create(const AHash: IHash; const ABlake2SKey: THashLibByteArray); begin - Inherited Create(AHash.HashSize, AHash.BlockSize); + inherited Create(AHash.HashSize, AHash.BlockSize); SetKey(ABlake2SKey); FHash := AHash; end; @@ -2108,9 +2112,9 @@ procedure TBlake2SMACNotBuildInAdapter.Initialize; procedure TBlake2SMACNotBuildInAdapter.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin - FKey := Nil; + FKey := nil; end else begin diff --git a/HashLib/src/Crypto/HlpBlake2SP.pas b/HashLib/src/Crypto/HlpBlake2SP.pas index 21688813..98e2f04f 100644 --- a/HashLib/src/Crypto/HlpBlake2SP.pas +++ b/HashLib/src/Crypto/HlpBlake2SP.pas @@ -42,10 +42,10 @@ TBlake2SP = class sealed(THash, ICryptoNotBuildIn, ITransformBlock) /// of these instances is given by TBlake2STreeConfig.InnerSize /// instead.
/// - function Blake2SPCreateLeafParam(const ABlake2SConfig: IBlake2SConfig; + function CreateLeafParam(const ABlake2SConfig: IBlake2SConfig; const ABlake2STreeConfig: IBlake2STreeConfig): TBlake2S; - function Blake2SPCreateLeaf(AOffset: UInt64): TBlake2S; - function Blake2SPCreateRoot(): TBlake2S; + function CreateLeaf(AOffset: UInt64): TBlake2S; + function CreateRoot(): TBlake2S; // Each lane processes its own "stripe" of the input procedure ProcessLeafLane(AIdx: Int32; APtrData: PByte; @@ -77,13 +77,13 @@ implementation { TBlake2SP } -function TBlake2SP.Blake2SPCreateLeafParam(const ABlake2SConfig: IBlake2SConfig; +function TBlake2SP.CreateLeafParam(const ABlake2SConfig: IBlake2SConfig; const ABlake2STreeConfig: IBlake2STreeConfig): TBlake2S; begin Result := TBlake2S.Create(ABlake2SConfig, ABlake2STreeConfig); end; -function TBlake2SP.Blake2SPCreateLeaf(AOffset: UInt64): TBlake2S; +function TBlake2SP.CreateLeaf(AOffset: UInt64): TBlake2S; var LBlake2SConfig: IBlake2SConfig; LBlake2STreeConfig: IBlake2STreeConfig; @@ -104,10 +104,10 @@ function TBlake2SP.Blake2SPCreateLeaf(AOffset: UInt64): TBlake2S; LBlake2STreeConfig.IsLastNode := True; end; - Result := Blake2SPCreateLeafParam(LBlake2SConfig, LBlake2STreeConfig); + Result := CreateLeafParam(LBlake2SConfig, LBlake2STreeConfig); end; -function TBlake2SP.Blake2SPCreateRoot(): TBlake2S; +function TBlake2SP.CreateRoot(): TBlake2S; var LBlake2SConfig: IBlake2SConfig; LBlake2STreeConfig: IBlake2STreeConfig; @@ -151,7 +151,7 @@ function TBlake2SP.Clone(): IHash; LHashInstance := TBlake2SP.CreateInternal(HashSize); LHashInstance.FKey := System.Copy(FKey); - if FRootHash <> Nil then + if FRootHash <> nil then begin LHashInstance.FRootHash := FRootHash.CloneInternal(); end; @@ -160,30 +160,30 @@ function TBlake2SP.Clone(): IHash; LHashInstance.FBuffer := System.Copy(FBuffer); LHashInstance.FBufferLength := FBufferLength; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TBlake2SP.CreateInternal(AHashSize: Int32); begin - Inherited Create(AHashSize, BlockSizeInBytes); + inherited Create(AHashSize, BlockSizeInBytes); end; constructor TBlake2SP.Create(AHashSize: Int32; const AKey: THashLibByteArray); var LIdx: Int32; begin - Inherited Create(AHashSize, BlockSizeInBytes); + inherited Create(AHashSize, BlockSizeInBytes); System.SetLength(FBuffer, ParallelismDegree * BlockSizeInBytes); System.SetLength(FLeafHashes, ParallelismDegree); FKey := System.Copy(AKey); - FRootHash := Blake2SPCreateRoot; + FRootHash := CreateRoot; for LIdx := 0 to System.Pred(ParallelismDegree) do begin - FLeafHashes[LIdx] := Blake2SPCreateLeaf(LIdx); + FLeafHashes[LIdx] := CreateLeaf(LIdx); end; end; @@ -194,15 +194,15 @@ destructor TBlake2SP.Destroy; Clear(); FRootHash.Free; - FRootHash := Nil; + FRootHash := nil; for LIdx := System.Low(FLeafHashes) to System.High(FLeafHashes) do begin FLeafHashes[LIdx].Free; - FLeafHashes[LIdx] := Nil; + FLeafHashes[LIdx] := nil; end; - FLeafHashes := Nil; + FLeafHashes := nil; inherited Destroy; end; @@ -243,7 +243,7 @@ procedure TBlake2SP.ProcessLeafLane(AIdx: Int32; APtrData: PByte; LLeafHashes := FLeafHashes; // Start at lane offset - Inc(LPtrData, AIdx * BlockSizeInBytes); + System.Inc(LPtrData, AIdx * BlockSizeInBytes); // Process all full "stripes" of ParallelismDegree * BlockSizeInBytes while (LCounter >= StripeSize) do @@ -251,7 +251,7 @@ procedure TBlake2SP.ProcessLeafLane(AIdx: Int32; APtrData: PByte; System.Move(LPtrData^, LTemp[0], BlockSizeInBytes); LLeafHashes[AIdx].TransformBytes(LTemp, 0, BlockSizeInBytes); - Inc(LPtrData, UInt64(StripeSize)); + System.Inc(LPtrData, UInt64(StripeSize)); LCounter := LCounter - UInt64(StripeSize); end; end; @@ -315,7 +315,7 @@ procedure TBlake2SP.TransformBytes(const AData: THashLibByteArray; BlockSizeInBytes); end; - Inc(LPtrData, LFill); + System.Inc(LPtrData, LFill); LDataLength := LDataLength - LFill; LLeft := 0; end; @@ -325,7 +325,7 @@ procedure TBlake2SP.TransformBytes(const AData: THashLibByteArray; // Move pointer past processed data (everything except the remainder) LProcessed := (LDataLength div StripeSize) * StripeSize; - Inc(LPtrData, LProcessed); + System.Inc(LPtrData, LProcessed); // Keep the remainder in the buffer LDataLength := LDataLength - LProcessed; @@ -350,10 +350,6 @@ function TBlake2SP.TransformFinal: IHashResult; LRootHash := FRootHash; System.SetLength(LHash, ParallelismDegree); - for LIdx := System.Low(LHash) to System.High(LHash) do - begin - System.SetLength(LHash[LIdx], OutSizeInBytes); - end; // Finalize each leaf with the remaining buffered bytes for LIdx := 0 to System.Pred(ParallelismDegree) do diff --git a/HashLib/src/Crypto/HlpBlake3.pas b/HashLib/src/Crypto/HlpBlake3.pas index 3376929c..eb45af47 100644 --- a/HashLib/src/Crypto/HlpBlake3.pas +++ b/HashLib/src/Crypto/HlpBlake3.pas @@ -36,13 +36,13 @@ TBlake3 = class(THash, ICryptoNotBuildIn, ITransformBlock) BlockSizeInBytes = Int32(64); KeyLengthInBytes = Int32(32); - flagChunkStart = UInt32(1 shl 0); - flagChunkEnd = UInt32(1 shl 1); - flagParent = UInt32(1 shl 2); - flagRoot = UInt32(1 shl 3); - flagKeyedHash = UInt32(1 shl 4); - flagDeriveKeyContext = UInt32(1 shl 5); - flagDeriveKeyMaterial = UInt32(1 shl 6); + FlagChunkStart = UInt32(1 shl 0); + FlagChunkEnd = UInt32(1 shl 1); + FlagParent = UInt32(1 shl 2); + FlagRoot = UInt32(1 shl 3); + FlagKeyedHash = UInt32(1 shl 4); + FlagDeriveKeyContext = UInt32(1 shl 5); + FlagDeriveKeyMaterial = UInt32(1 shl 6); // maximum size in bytes this digest output reader can produce MaxDigestLengthInBytes = UInt64(System.High(UInt64)); @@ -186,7 +186,7 @@ TBlake3OutputReader = record public constructor Create(AHashSize: THashSize = THashSize.hsHashSize256; - const AKey: THashLibByteArray = Nil); overload; + const AKey: THashLibByteArray = nil); overload; procedure Initialize; override; procedure TransformBytes(const AData: THashLibByteArray; AIndex, ADataLength: Int32); override; @@ -253,7 +253,7 @@ implementation class function TBlake3.TBlake3Node.DefaultBlake3Node: TBlake3Node; begin - Result := Default (TBlake3Node); + Result := Default(TBlake3Node); Result.Counter := 0; Result.BlockLen := 0; Result.Flags := 0; @@ -284,27 +284,27 @@ function TBlake3.TBlake3Node.Clone: TBlake3Node; procedure TBlake3.TBlake3Node.G(APtrState: PCardinal; A, B, C, D, X, Y: UInt32); var - LA, LB, LC, LD: UInt32; + LRegA, LRegB, LRegC, LRegD: UInt32; begin - LA := APtrState[A]; - LB := APtrState[B]; - LC := APtrState[C]; - LD := APtrState[D]; + LRegA := APtrState[A]; + LRegB := APtrState[B]; + LRegC := APtrState[C]; + LRegD := APtrState[D]; - LA := LA + LB + X; - LD := TBits.RotateRight32(LD xor LA, 16); - LC := LC + LD; - LB := TBits.RotateRight32(LB xor LC, 12); - LA := LA + LB + Y; - LD := TBits.RotateRight32(LD xor LA, 8); - LC := LC + LD; - LB := TBits.RotateRight32(LB xor LC, 7); + LRegA := LRegA + LRegB + X; + LRegD := TBits.RotateRight32(LRegD xor LRegA, 16); + LRegC := LRegC + LRegD; + LRegB := TBits.RotateRight32(LRegB xor LRegC, 12); + LRegA := LRegA + LRegB + Y; + LRegD := TBits.RotateRight32(LRegD xor LRegA, 8); + LRegC := LRegC + LRegD; + LRegB := TBits.RotateRight32(LRegB xor LRegC, 7); - APtrState[A] := LA; - APtrState[B] := LB; - APtrState[C] := LC; - APtrState[D] := LD; + APtrState[A] := LRegA; + APtrState[B] := LRegB; + APtrState[C] := LRegC; + APtrState[D] := LRegD; end; procedure TBlake3.TBlake3Node.Compress(APtrState: PCardinal); @@ -455,7 +455,7 @@ class function TBlake3.TBlake3Node.ParentNode(const ALeft, ARight, begin LBlockWords := TArrayUtils.Concatenate(ALeft, ARight); Result := TBlake3Node.CreateBlake3Node(AKey, LBlockWords, 0, BlockSizeInBytes, - AFlags or flagParent); + AFlags or FlagParent); end; { TBlake3.TBlake3ChunkState } @@ -463,7 +463,7 @@ class function TBlake3.TBlake3Node.ParentNode(const ALeft, ARight, class function TBlake3.TBlake3ChunkState.DefaultBlake3ChunkState : TBlake3ChunkState; begin - Result := Default (TBlake3ChunkState); + Result := Default(TBlake3ChunkState); Result.N := TBlake3Node.DefaultBlake3Node; Result.BlockLen := 0; Result.BytesConsumed := 0; @@ -484,7 +484,7 @@ class function TBlake3.TBlake3ChunkState.CreateBlake3ChunkState Result.N.Counter := AChunkCounter; Result.N.BlockLen := BlockSizeInBytes; // compress the first block with the start flag set - Result.N.Flags := AFlags or flagChunkStart; + Result.N.Flags := AFlags or FlagChunkStart; end; function TBlake3.TBlake3ChunkState.ChunkCounter: UInt64; @@ -510,7 +510,7 @@ function TBlake3.TBlake3ChunkState.Node: TBlake3Node; TConverters.le32_copy(@(Block[0]), 0, @(Result.Block[0]), 0, BlockSizeInBytes); Result.BlockLen := UInt32(BlockLen); - Result.Flags := Result.Flags or flagChunkEnd; + Result.Flags := Result.Flags or FlagChunkEnd; end; procedure TBlake3.TBlake3ChunkState.Update(APtrData: PByte; ADataLength: Int32); @@ -534,7 +534,7 @@ procedure TBlake3.TBlake3ChunkState.Update(APtrData: PByte; ADataLength: Int32); TConverters.le32_copy(LBytePtr, 0, LCardinalPtr, 0, BlockSizeInBytes); N.ChainingValue(LCVPtr); // clear the start flag for all but the first block - N.Flags := N.Flags and (N.Flags xor flagChunkStart); + N.Flags := N.Flags and (N.Flags xor FlagChunkStart); BlockLen := 0; end; @@ -554,7 +554,7 @@ procedure TBlake3.TBlake3ChunkState.Update(APtrData: PByte; ADataLength: Int32); class function TBlake3.TBlake3OutputReader.DefaultBlake3OutputReader : TBlake3OutputReader; begin - Result := Default (TBlake3OutputReader); + Result := Default(TBlake3OutputReader); Result.N := TBlake3Node.DefaultBlake3Node(); Result.Offset := 0; end; @@ -627,7 +627,7 @@ procedure TBlake3.TBlake3OutputReader. { TBlake3 } -// Len64 returns the minimum number of bits required to represent x; the result is 0 for x == 0. +// Len64 returns the minimum number of bits required to represent x; zero yields 0. class function TBlake3.Len64(AValue: UInt64): Int32; function Len8(AValue: Byte): Byte; inline; @@ -684,7 +684,7 @@ constructor TBlake3.CreateInternal(AHashSize: Int32; var LIdx: Int32; begin - Inherited Create(AHashSize, BlockSizeInBytes); + inherited Create(AHashSize, BlockSizeInBytes); FKey := System.Copy(AKeyWords); FFlags := AFlags; System.SetLength(FStack, 54); @@ -700,7 +700,7 @@ constructor TBlake3.Create(AHashSize: Int32; const AKey: THashLibByteArray); LKeyLength: Int32; begin System.SetLength(LKeyWords, 8); - if AKey = Nil then + if AKey = nil then begin System.Move(IV, LKeyWords[0], System.SizeOf(IV)); CreateInternal(AHashSize, LKeyWords, 0); @@ -714,7 +714,7 @@ constructor TBlake3.Create(AHashSize: Int32; const AKey: THashLibByteArray); [KeyLengthInBytes, LKeyLength]); end; TConverters.le32_copy(PByte(AKey), 0, PCardinal(LKeyWords), 0, LKeyLength); - CreateInternal(AHashSize, LKeyWords, flagKeyedHash); + CreateInternal(AHashSize, LKeyWords, FlagKeyedHash); end; end; @@ -746,7 +746,7 @@ function TBlake3.Clone: IHash; LHashInstance.FOutputReader := FOutputReader.Clone(); LHashInstance.FStack := TArrayUtils.Clone(FStack); LHashInstance.FUsed := FUsed; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -807,7 +807,7 @@ function TBlake3.RootNode: TBlake3Node; Result := TBlake3Node.ParentNode(FStack[LIdx], LTemp, FKey, FFlags); end; end; - Result.Flags := Result.Flags or flagRoot; + Result.Flags := Result.Flags or FlagRoot; end; procedure TBlake3.TransformBytes(const AData: THashLibByteArray; @@ -866,12 +866,12 @@ class procedure TBlake3.DeriveKey(const ASrcKey, ACtx, System.Move(IV, LIVWords[0], System.SizeOf(IV)); // construct the derivation Hasher and get the DerivationIV LDerivationIV := (TBlake3.CreateInternal(derivationIVLen, LIVWords, - flagDeriveKeyContext) as IHash).ComputeBytes(ACtx).GetBytes(); + FlagDeriveKeyContext) as IHash).ComputeBytes(ACtx).GetBytes(); TConverters.le32_copy(PByte(LDerivationIV), 0, PCardinal(LIVWords), 0, KeyLengthInBytes); // derive the SubKey - LXof := TBlake3XOF.Create(32, LIVWords, flagDeriveKeyMaterial) as IXOF; + LXof := TBlake3XOF.Create(32, LIVWords, FlagDeriveKeyMaterial); LXof.XOFSizeInBits := System.Length(ASubKey) * 8; LXof.Initialize; LXof.TransformBytes(ASrcKey); @@ -897,8 +897,8 @@ function TBlake3XOF.Clone: IHash; LXof: IXOF; begin // Xof Cloning - LXof := (TBlake3XOF.Create(HashSize, Nil) as IXOF); - LXof.XOFSizeInBits := (Self as IXOF).XOFSizeInBits; + LXof := TBlake3XOF.Create(HashSize, nil); + LXof.XOFSizeInBits := XOFSizeInBits; // Blake3XOF Cloning LHashInstance := LXof as TBlake3XOF; @@ -912,20 +912,20 @@ function TBlake3XOF.Clone: IHash; LHashInstance.FFlags := FFlags; LHashInstance.FKey := System.Copy(FKey); - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TBlake3XOF.Create(AHashSize: Int32; const AKey: THashLibByteArray); begin - Inherited Create(AHashSize, AKey); + inherited Create(AHashSize, AKey); FFinalized := False; end; constructor TBlake3XOF.Create(AHashSize: Int32; const AKeyWords: THashLibUInt32Array; AFlags: UInt32); begin - Inherited CreateInternal(AHashSize, AKeyWords, AFlags); + inherited CreateInternal(AHashSize, AKeyWords, AFlags); FFinalized := False; end; @@ -980,7 +980,7 @@ function TBlake3XOF.SetXOFSizeInBitsInternal(AXofSizeInBits: UInt64): IXOF; LXofSizeInBytes: UInt64; begin LXofSizeInBytes := AXofSizeInBits shr 3; - If (((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1)) then + if (((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1)) then begin raise EArgumentInvalidHashLibException.CreateRes(@SInvalidXOFSize); end; diff --git a/HashLib/src/Crypto/HlpGOST3411_2012.pas b/HashLib/src/Crypto/HlpGOST3411_2012.pas index 57cf4f14..a5f2886a 100644 --- a/HashLib/src/Crypto/HlpGOST3411_2012.pas +++ b/HashLib/src/Crypto/HlpGOST3411_2012.pas @@ -23,12 +23,14 @@ TGOST3411_2012 = class abstract(THash, ICryptoNotBuildIn, ITransformBlock) FT: THashLibMatrixUInt64Array; procedure InternalUpdate(AInput: Byte); inline; - procedure xor512(const A, B: THashLibByteArray); inline; - procedure E(const K, M: THashLibByteArray); - procedure F(const V: THashLibByteArray); - procedure GN(const AH, AN, AM: THashLibByteArray); inline; - procedure AddMod512(const A: THashLibByteArray; Num: Int32); overload; - procedure AddMod512(const A, B: THashLibByteArray); overload; + procedure Xor512(const ADest, AXorWith: THashLibByteArray); inline; + procedure E(const ARoundKey, AMessage: THashLibByteArray); + procedure F(const AVector: THashLibByteArray); + procedure GN(const AHashState, ACounter, AMessageBlock + : THashLibByteArray); inline; + procedure AddMod512(const ADest: THashLibByteArray; + AIncrement: Int32); overload; + procedure AddMod512(const ADest, AAddend: THashLibByteArray); overload; procedure Reverse(const ASource, ADestination: THashLibByteArray); class constructor GOST3411_2012(); @@ -40,7 +42,7 @@ TGOST3411_2012 = class abstract(THash, ICryptoNotBuildIn, ITransformBlock) FBOff: Int32; - constructor Create(AHashSize: Int32; const IV: THashLibByteArray); + constructor Create(AHashSize: Int32; const AIV: THashLibByteArray); public procedure Initialize; override; @@ -83,56 +85,59 @@ implementation { TGOST3411_2012Base } -procedure TGOST3411_2012.xor512(const A, B: THashLibByteArray); +procedure TGOST3411_2012.Xor512(const ADest, AXorWith: THashLibByteArray); var - i: Int32; + LIdx: Int32; begin - for i := 0 to System.Pred(64) do + for LIdx := 0 to System.Pred(64) do begin - A[i] := A[i] xor B[i]; + ADest[LIdx] := ADest[LIdx] xor AXorWith[LIdx]; end; end; -procedure TGOST3411_2012.AddMod512(const A: THashLibByteArray; Num: Int32); +procedure TGOST3411_2012.AddMod512(const ADest: THashLibByteArray; + AIncrement: Int32); var - c, i: Int32; + LCarry, LIdx: Int32; begin - c := (A[63] and $FF) + (Num and $FF); - A[63] := Byte(c); + LCarry := (ADest[63] and $FF) + (AIncrement and $FF); + ADest[63] := Byte(LCarry); - c := (A[62] and $FF) + ((TBits.Asr32(Num, 8)) and $FF) + (TBits.Asr32(c, 8)); - A[62] := Byte(c); + LCarry := (ADest[62] and $FF) + + ((TBits.Asr32(AIncrement, 8)) and $FF) + (TBits.Asr32(LCarry, 8)); + ADest[62] := Byte(LCarry); - i := 61; + LIdx := 61; - while ((i >= 0) and (c > 0)) do + while ((LIdx >= 0) and (LCarry > 0)) do begin - c := (A[i] and $FF) + (TBits.Asr32(c, 8)); - A[i] := Byte(c); - System.Dec(i); + LCarry := (ADest[LIdx] and $FF) + (TBits.Asr32(LCarry, 8)); + ADest[LIdx] := Byte(LCarry); + System.Dec(LIdx); end; end; -procedure TGOST3411_2012.AddMod512(const A, B: THashLibByteArray); +procedure TGOST3411_2012.AddMod512(const ADest, AAddend: THashLibByteArray); var - i, c: Int32; + LIdx, LCarry: Int32; begin - c := 0; - i := 63; + LCarry := 0; + LIdx := 63; - while i >= 0 do + while LIdx >= 0 do begin - c := Int32(A[i] and $FF) + Int32(B[i] and $FF) + (TBits.Asr32(c, 8)); - A[i] := Byte(c); - System.Dec(i); + LCarry := Int32(ADest[LIdx] and $FF) + Int32(AAddend[LIdx] and $FF) + + (TBits.Asr32(LCarry, 8)); + ADest[LIdx] := Byte(LCarry); + System.Dec(LIdx); end; end; constructor TGOST3411_2012.Create(AHashSize: Int32; - const IV: THashLibByteArray); + const AIV: THashLibByteArray); begin - Inherited Create(AHashSize, 64); + inherited Create(AHashSize, 64); System.SetLength(FIV, 64); System.SetLength(FN, 64); System.SetLength(FSigma, 64); @@ -146,204 +151,204 @@ constructor TGOST3411_2012.Create(AHashSize: Int32; FBOff := 64; - System.Move(IV[0], FIV[0], 64 * System.SizeOf(Byte)); - System.Move(IV[0], FH[0], 64 * System.SizeOf(Byte)); + System.Move(AIV[0], FIV[0], 64 * System.SizeOf(Byte)); + System.Move(AIV[0], FH[0], 64 * System.SizeOf(Byte)); end; -procedure TGOST3411_2012.E(const K, M: THashLibByteArray); +procedure TGOST3411_2012.E(const ARoundKey, AMessage: THashLibByteArray); var - i: Int32; + LRound: Int32; begin - System.Move(K[0], FKi[0], 64 * System.SizeOf(Byte)); - xor512(K, M); - F(K); - for i := 0 to System.Pred(11) do + System.Move(ARoundKey[0], FKi[0], 64 * System.SizeOf(Byte)); + Xor512(ARoundKey, AMessage); + F(ARoundKey); + for LRound := 0 to System.Pred(11) do begin - xor512(FKi, FC[i]); + Xor512(FKi, FC[LRound]); F(FKi); - xor512(K, FKi); - F(K); + Xor512(ARoundKey, FKi); + F(ARoundKey); end; - xor512(FKi, FC[11]); + Xor512(FKi, FC[11]); F(FKi); - xor512(K, FKi); + Xor512(ARoundKey, FKi); end; -procedure TGOST3411_2012.F(const V: THashLibByteArray); +procedure TGOST3411_2012.F(const AVector: THashLibByteArray); var - res: array [0 .. 7] of UInt64; - r: UInt64; + LQWords: array [0 .. 7] of UInt64; + LAcc: UInt64; begin - r := 0; - r := r xor (FT[0][(V[56] and $FF)]); - r := r xor (FT[1][(V[48] and $FF)]); - r := r xor (FT[2][(V[40] and $FF)]); - r := r xor (FT[3][(V[32] and $FF)]); - r := r xor (FT[4][(V[24] and $FF)]); - r := r xor (FT[5][(V[16] and $FF)]); - r := r xor (FT[6][(V[8] and $FF)]); - r := r xor (FT[7][(V[0] and $FF)]); - res[0] := r; - - r := 0; - r := r xor (FT[0][(V[57] and $FF)]); - r := r xor (FT[1][(V[49] and $FF)]); - r := r xor (FT[2][(V[41] and $FF)]); - r := r xor (FT[3][(V[33] and $FF)]); - r := r xor (FT[4][(V[25] and $FF)]); - r := r xor (FT[5][(V[17] and $FF)]); - r := r xor (FT[6][(V[9] and $FF)]); - r := r xor (FT[7][(V[1] and $FF)]); - res[1] := r; - - r := 0; - r := r xor (FT[0][(V[58] and $FF)]); - r := r xor (FT[1][(V[50] and $FF)]); - r := r xor (FT[2][(V[42] and $FF)]); - r := r xor (FT[3][(V[34] and $FF)]); - r := r xor (FT[4][(V[26] and $FF)]); - r := r xor (FT[5][(V[18] and $FF)]); - r := r xor (FT[6][(V[10] and $FF)]); - r := r xor (FT[7][(V[2] and $FF)]); - res[2] := r; - - r := 0; - r := r xor (FT[0][(V[59] and $FF)]); - r := r xor (FT[1][(V[51] and $FF)]); - r := r xor (FT[2][(V[43] and $FF)]); - r := r xor (FT[3][(V[35] and $FF)]); - r := r xor (FT[4][(V[27] and $FF)]); - r := r xor (FT[5][(V[19] and $FF)]); - r := r xor (FT[6][(V[11] and $FF)]); - r := r xor (FT[7][(V[3] and $FF)]); - res[3] := r; - - r := 0; - r := r xor (FT[0][(V[60] and $FF)]); - r := r xor (FT[1][(V[52] and $FF)]); - r := r xor (FT[2][(V[44] and $FF)]); - r := r xor (FT[3][(V[36] and $FF)]); - r := r xor (FT[4][(V[28] and $FF)]); - r := r xor (FT[5][(V[20] and $FF)]); - r := r xor (FT[6][(V[12] and $FF)]); - r := r xor (FT[7][(V[4] and $FF)]); - res[4] := r; - - r := 0; - r := r xor (FT[0][(V[61] and $FF)]); - r := r xor (FT[1][(V[53] and $FF)]); - r := r xor (FT[2][(V[45] and $FF)]); - r := r xor (FT[3][(V[37] and $FF)]); - r := r xor (FT[4][(V[29] and $FF)]); - r := r xor (FT[5][(V[21] and $FF)]); - r := r xor (FT[6][(V[13] and $FF)]); - r := r xor (FT[7][(V[5] and $FF)]); - res[5] := r; - - r := 0; - r := r xor (FT[0][(V[62] and $FF)]); - r := r xor (FT[1][(V[54] and $FF)]); - r := r xor (FT[2][(V[46] and $FF)]); - r := r xor (FT[3][(V[38] and $FF)]); - r := r xor (FT[4][(V[30] and $FF)]); - r := r xor (FT[5][(V[22] and $FF)]); - r := r xor (FT[6][(V[14] and $FF)]); - r := r xor (FT[7][(V[6] and $FF)]); - res[6] := r; - - r := 0; - r := r xor (FT[0][(V[63] and $FF)]); - r := r xor (FT[1][(V[55] and $FF)]); - r := r xor (FT[2][(V[47] and $FF)]); - r := r xor (FT[3][(V[39] and $FF)]); - r := r xor (FT[4][(V[31] and $FF)]); - r := r xor (FT[5][(V[23] and $FF)]); - r := r xor (FT[6][(V[15] and $FF)]); - r := r xor (FT[7][(V[7] and $FF)]); - res[7] := r; - - r := res[0]; - V[7] := Byte(r shr 56); - V[6] := Byte(r shr 48); - V[5] := Byte(r shr 40); - V[4] := Byte(r shr 32); - V[3] := Byte(r shr 24); - V[2] := Byte(r shr 16); - V[1] := Byte(r shr 8); - V[0] := Byte(r); - - r := res[1]; - V[15] := Byte(r shr 56); - V[14] := Byte(r shr 48); - V[13] := Byte(r shr 40); - V[12] := Byte(r shr 32); - V[11] := Byte(r shr 24); - V[10] := Byte(r shr 16); - V[9] := Byte(r shr 8); - V[8] := Byte(r); - - r := res[2]; - V[23] := Byte(r shr 56); - V[22] := Byte(r shr 48); - V[21] := Byte(r shr 40); - V[20] := Byte(r shr 32); - V[19] := Byte(r shr 24); - V[18] := Byte(r shr 16); - V[17] := Byte(r shr 8); - V[16] := Byte(r); - - r := res[3]; - V[31] := Byte(r shr 56); - V[30] := Byte(r shr 48); - V[29] := Byte(r shr 40); - V[28] := Byte(r shr 32); - V[27] := Byte(r shr 24); - V[26] := Byte(r shr 16); - V[25] := Byte(r shr 8); - V[24] := Byte(r); - - r := res[4]; - V[39] := Byte(r shr 56); - V[38] := Byte(r shr 48); - V[37] := Byte(r shr 40); - V[36] := Byte(r shr 32); - V[35] := Byte(r shr 24); - V[34] := Byte(r shr 16); - V[33] := Byte(r shr 8); - V[32] := Byte(r); - - r := res[5]; - V[47] := Byte(r shr 56); - V[46] := Byte(r shr 48); - V[45] := Byte(r shr 40); - V[44] := Byte(r shr 32); - V[43] := Byte(r shr 24); - V[42] := Byte(r shr 16); - V[41] := Byte(r shr 8); - V[40] := Byte(r); - - r := res[6]; - V[55] := Byte(r shr 56); - V[54] := Byte(r shr 48); - V[53] := Byte(r shr 40); - V[52] := Byte(r shr 32); - V[51] := Byte(r shr 24); - V[50] := Byte(r shr 16); - V[49] := Byte(r shr 8); - V[48] := Byte(r); - - r := res[7]; - V[63] := Byte(r shr 56); - V[62] := Byte(r shr 48); - V[61] := Byte(r shr 40); - V[60] := Byte(r shr 32); - V[59] := Byte(r shr 24); - V[58] := Byte(r shr 16); - V[57] := Byte(r shr 8); - V[56] := Byte(r); - - System.FillChar(res, System.SizeOf(res), UInt64(0)); + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[56] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[48] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[40] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[32] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[24] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[16] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[8] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[0] and $FF)]); + LQWords[0] := LAcc; + + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[57] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[49] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[41] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[33] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[25] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[17] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[9] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[1] and $FF)]); + LQWords[1] := LAcc; + + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[58] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[50] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[42] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[34] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[26] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[18] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[10] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[2] and $FF)]); + LQWords[2] := LAcc; + + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[59] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[51] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[43] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[35] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[27] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[19] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[11] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[3] and $FF)]); + LQWords[3] := LAcc; + + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[60] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[52] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[44] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[36] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[28] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[20] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[12] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[4] and $FF)]); + LQWords[4] := LAcc; + + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[61] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[53] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[45] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[37] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[29] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[21] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[13] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[5] and $FF)]); + LQWords[5] := LAcc; + + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[62] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[54] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[46] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[38] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[30] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[22] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[14] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[6] and $FF)]); + LQWords[6] := LAcc; + + LAcc := 0; + LAcc := LAcc xor (FT[0][(AVector[63] and $FF)]); + LAcc := LAcc xor (FT[1][(AVector[55] and $FF)]); + LAcc := LAcc xor (FT[2][(AVector[47] and $FF)]); + LAcc := LAcc xor (FT[3][(AVector[39] and $FF)]); + LAcc := LAcc xor (FT[4][(AVector[31] and $FF)]); + LAcc := LAcc xor (FT[5][(AVector[23] and $FF)]); + LAcc := LAcc xor (FT[6][(AVector[15] and $FF)]); + LAcc := LAcc xor (FT[7][(AVector[7] and $FF)]); + LQWords[7] := LAcc; + + LAcc := LQWords[0]; + AVector[7] := Byte(LAcc shr 56); + AVector[6] := Byte(LAcc shr 48); + AVector[5] := Byte(LAcc shr 40); + AVector[4] := Byte(LAcc shr 32); + AVector[3] := Byte(LAcc shr 24); + AVector[2] := Byte(LAcc shr 16); + AVector[1] := Byte(LAcc shr 8); + AVector[0] := Byte(LAcc); + + LAcc := LQWords[1]; + AVector[15] := Byte(LAcc shr 56); + AVector[14] := Byte(LAcc shr 48); + AVector[13] := Byte(LAcc shr 40); + AVector[12] := Byte(LAcc shr 32); + AVector[11] := Byte(LAcc shr 24); + AVector[10] := Byte(LAcc shr 16); + AVector[9] := Byte(LAcc shr 8); + AVector[8] := Byte(LAcc); + + LAcc := LQWords[2]; + AVector[23] := Byte(LAcc shr 56); + AVector[22] := Byte(LAcc shr 48); + AVector[21] := Byte(LAcc shr 40); + AVector[20] := Byte(LAcc shr 32); + AVector[19] := Byte(LAcc shr 24); + AVector[18] := Byte(LAcc shr 16); + AVector[17] := Byte(LAcc shr 8); + AVector[16] := Byte(LAcc); + + LAcc := LQWords[3]; + AVector[31] := Byte(LAcc shr 56); + AVector[30] := Byte(LAcc shr 48); + AVector[29] := Byte(LAcc shr 40); + AVector[28] := Byte(LAcc shr 32); + AVector[27] := Byte(LAcc shr 24); + AVector[26] := Byte(LAcc shr 16); + AVector[25] := Byte(LAcc shr 8); + AVector[24] := Byte(LAcc); + + LAcc := LQWords[4]; + AVector[39] := Byte(LAcc shr 56); + AVector[38] := Byte(LAcc shr 48); + AVector[37] := Byte(LAcc shr 40); + AVector[36] := Byte(LAcc shr 32); + AVector[35] := Byte(LAcc shr 24); + AVector[34] := Byte(LAcc shr 16); + AVector[33] := Byte(LAcc shr 8); + AVector[32] := Byte(LAcc); + + LAcc := LQWords[5]; + AVector[47] := Byte(LAcc shr 56); + AVector[46] := Byte(LAcc shr 48); + AVector[45] := Byte(LAcc shr 40); + AVector[44] := Byte(LAcc shr 32); + AVector[43] := Byte(LAcc shr 24); + AVector[42] := Byte(LAcc shr 16); + AVector[41] := Byte(LAcc shr 8); + AVector[40] := Byte(LAcc); + + LAcc := LQWords[6]; + AVector[55] := Byte(LAcc shr 56); + AVector[54] := Byte(LAcc shr 48); + AVector[53] := Byte(LAcc shr 40); + AVector[52] := Byte(LAcc shr 32); + AVector[51] := Byte(LAcc shr 24); + AVector[50] := Byte(LAcc shr 16); + AVector[49] := Byte(LAcc shr 8); + AVector[48] := Byte(LAcc); + + LAcc := LQWords[7]; + AVector[63] := Byte(LAcc shr 56); + AVector[62] := Byte(LAcc shr 48); + AVector[61] := Byte(LAcc shr 40); + AVector[60] := Byte(LAcc shr 32); + AVector[59] := Byte(LAcc shr 24); + AVector[58] := Byte(LAcc shr 16); + AVector[57] := Byte(LAcc shr 8); + AVector[56] := Byte(LAcc); + + System.FillChar(LQWords, System.SizeOf(LQWords), UInt64(0)); end; class constructor TGOST3411_2012.GOST3411_2012; @@ -1515,16 +1520,17 @@ procedure TGOST3411_2012.F(const V: THashLibByteArray); {$ENDREGION} end; -procedure TGOST3411_2012.GN(const AH, AN, AM: THashLibByteArray); +procedure TGOST3411_2012.GN(const AHashState, ACounter, AMessageBlock + : THashLibByteArray); begin - System.Move(AH[0], FTemp[0], 64 * System.SizeOf(Byte)); + System.Move(AHashState[0], FTemp[0], 64 * System.SizeOf(Byte)); - xor512(AH, AN); - F(AH); + Xor512(AHashState, ACounter); + F(AHashState); - E(AH, AM); - xor512(AH, FTemp); - xor512(AH, AM); + E(AHashState, AMessageBlock); + Xor512(AHashState, FTemp); + Xor512(AHashState, AMessageBlock); end; procedure TGOST3411_2012.Initialize; @@ -1554,12 +1560,12 @@ procedure TGOST3411_2012.InternalUpdate(AInput: Byte); procedure TGOST3411_2012.Reverse(const ASource, ADestination : THashLibByteArray); var - len, i: Int32; + LLength, LIdx: Int32; begin - len := System.Length(ASource); - for i := 0 to System.Pred(len) do + LLength := System.Length(ASource); + for LIdx := 0 to System.Pred(LLength) do begin - ADestination[len - 1 - i] := ASource[i]; + ADestination[LLength - 1 - LIdx] := ASource[LIdx]; end; end; @@ -1594,38 +1600,39 @@ procedure TGOST3411_2012.TransformBytes(const AData: THashLibByteArray; function TGOST3411_2012.TransformFinal: IHashResult; var - tempRes: THashLibByteArray; - lenM, i: Int32; + LTempResult: THashLibByteArray; + LMessageByteCount, LIdx: Int32; begin - lenM := 64 - FBOff; + LMessageByteCount := 64 - FBOff; - // At this point it is certain that lenM is smaller than 64 - i := 0; - while i <> (64 - lenM) do + // At this point it is certain that LMessageByteCount is smaller than 64 + LIdx := 0; + while LIdx <> (64 - LMessageByteCount) do begin - FM[i] := 0; - System.Inc(i); + FM[LIdx] := 0; + System.Inc(LIdx); end; - FM[63 - lenM] := 1; + FM[63 - LMessageByteCount] := 1; if (FBOff <> 64) then begin - System.Move(FBlock[FBOff], FM[64 - lenM], lenM * System.SizeOf(Byte)); + System.Move(FBlock[FBOff], FM[64 - LMessageByteCount], + LMessageByteCount * System.SizeOf(Byte)); end; GN(FH, FN, FM); - AddMod512(FN, lenM * 8); + AddMod512(FN, LMessageByteCount * 8); AddMod512(FSigma, FM); GN(FH, FZero, FN); GN(FH, FZero, FSigma); Reverse(FH, FTemp); - System.SetLength(tempRes, 64); - System.Move(FTemp[0], tempRes[0], 64 * System.SizeOf(Byte)); + System.SetLength(LTempResult, 64); + System.Move(FTemp[0], LTempResult[0], 64 * System.SizeOf(Byte)); - result := THashResult.Create(tempRes); + Result := THashResult.Create(LTempResult); Initialize(); end; @@ -1646,8 +1653,8 @@ function TGOST3411_2012_256.Clone(): IHash; LHashInstance.FTemp := System.Copy(FTemp); LHashInstance.FBlock := System.Copy(FBlock); LHashInstance.FBOff := FBOff; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TGOST3411_2012_256.Create(); @@ -1671,7 +1678,7 @@ function TGOST3411_2012_256.TransformFinal: IHashResult; LOutput := inherited TransformFinal().GetBytes; System.SetLength(LTempRes, HashSize); System.Move(LOutput[32], LTempRes[0], 32 * System.SizeOf(Byte)); - result := THashResult.Create(LTempRes); + Result := THashResult.Create(LTempRes); end; { TGOST3411_2012_512 } @@ -1690,8 +1697,8 @@ function TGOST3411_2012_512.Clone(): IHash; LHashInstance.FTemp := System.Copy(FTemp); LHashInstance.FBlock := System.Copy(FBlock); LHashInstance.FBOff := FBOff; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TGOST3411_2012_512.Create(); diff --git a/HashLib/src/Crypto/HlpGost.pas b/HashLib/src/Crypto/HlpGost.pas index 0ca16711..9ea0931b 100644 --- a/HashLib/src/Crypto/HlpGost.pas +++ b/HashLib/src/Crypto/HlpGost.pas @@ -65,292 +65,292 @@ function TGost.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; procedure TGost.Compress(APtr: PCardinal); var - u0, u1, u2, u3, u4, u5, u6, u7, v0, v1, v2, v3, v4, v5, v6, v7, w0, w1, w2, - w3, w4, w5, w6, w7, key0, key1, key2, key3, key4, key5, key6, key7, r, l, - t: UInt32; - i: Int32; - s: array [0 .. 7] of UInt32; + LUWord0, LUWord1, LUWord2, LUWord3, LUWord4, LUWord5, LUWord6, LUWord7, LVWord0, LVWord1, LVWord2, LVWord3, LVWord4, LVWord5, LVWord6, LVWord7, LWWord0, LWWord1, LWWord2, + LWWord3, LWWord4, LWWord5, LWWord6, LWWord7, LKey0, LKey1, LKey2, LKey3, LKey4, LKey5, LKey6, LKey7, LRight, LLeft, + LTemp: UInt32; + LStep: Int32; + LScratch: array [0 .. 7] of UInt32; begin - u0 := FHash[0]; - u1 := FHash[1]; - u2 := FHash[2]; - u3 := FHash[3]; - u4 := FHash[4]; - u5 := FHash[5]; - u6 := FHash[6]; - u7 := FHash[7]; - - v0 := APtr[0]; - v1 := APtr[1]; - v2 := APtr[2]; - v3 := APtr[3]; - v4 := APtr[4]; - v5 := APtr[5]; - v6 := APtr[6]; - v7 := APtr[7]; - - i := 0; - - while i < 8 do + LUWord0 := FHash[0]; + LUWord1 := FHash[1]; + LUWord2 := FHash[2]; + LUWord3 := FHash[3]; + LUWord4 := FHash[4]; + LUWord5 := FHash[5]; + LUWord6 := FHash[6]; + LUWord7 := FHash[7]; + + LVWord0 := APtr[0]; + LVWord1 := APtr[1]; + LVWord2 := APtr[2]; + LVWord3 := APtr[3]; + LVWord4 := APtr[4]; + LVWord5 := APtr[5]; + LVWord6 := APtr[6]; + LVWord7 := APtr[7]; + + LStep := 0; + + while LStep < 8 do begin - w0 := u0 xor v0; - w1 := u1 xor v1; - w2 := u2 xor v2; - w3 := u3 xor v3; - w4 := u4 xor v4; - w5 := u5 xor v5; - w6 := u6 xor v6; - w7 := u7 xor v7; - - key0 := UInt32(Byte(w0)) or (UInt32(Byte(w2)) shl 8) or - (UInt32(Byte(w4)) shl 16) or (UInt32(Byte(w6)) shl 24); - key1 := UInt32(Byte(w0 shr 8)) or (w2 and $0000FF00) or - ((w4 and $0000FF00) shl 8) or ((w6 and $0000FF00) shl 16); - key2 := UInt32(Byte(w0 shr 16)) or ((w2 and $00FF0000) shr 8) or - (w4 and $00FF0000) or ((w6 and $00FF0000) shl 8); - key3 := (w0 shr 24) or ((w2 and $FF000000) shr 16) or - ((w4 and $FF000000) shr 8) or (w6 and $FF000000); - key4 := UInt32(Byte(w1)) or ((w3 and $000000FF) shl 8) or - ((w5 and $000000FF) shl 16) or ((w7 and $000000FF) shl 24); - key5 := UInt32(Byte(w1 shr 8)) or (w3 and $0000FF00) or - ((w5 and $0000FF00) shl 8) or ((w7 and $0000FF00) shl 16); - key6 := UInt32(Byte(w1 shr 16)) or ((w3 and $00FF0000) shr 8) or - (w5 and $00FF0000) or ((w7 and $00FF0000) shl 8); - key7 := (w1 shr 24) or ((w3 and $FF000000) shr 16) or - ((w5 and $FF000000) shr 8) or (w7 and $FF000000); - - r := FHash[i]; - l := FHash[i + 1]; - - t := key0 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key1 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key2 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key3 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key4 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key5 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key6 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key7 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key0 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key1 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key2 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key3 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key4 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key5 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key6 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key7 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key0 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key1 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key2 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key3 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key4 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key5 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key6 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key7 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key7 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key6 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key5 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key4 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key3 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key2 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key1 + r; - l := l xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - t := key0 + l; - r := r xor (FSBox1[Byte(t)] xor FSBox2[Byte(t shr 8)] xor FSBox3 - [Byte(t shr 16)] xor FSBox4[t shr 24]); - - t := r; - r := l; - l := t; - - s[i] := r; - s[i + 1] := l; - - if (i = 6) then + LWWord0 := LUWord0 xor LVWord0; + LWWord1 := LUWord1 xor LVWord1; + LWWord2 := LUWord2 xor LVWord2; + LWWord3 := LUWord3 xor LVWord3; + LWWord4 := LUWord4 xor LVWord4; + LWWord5 := LUWord5 xor LVWord5; + LWWord6 := LUWord6 xor LVWord6; + LWWord7 := LUWord7 xor LVWord7; + + LKey0 := UInt32(Byte(LWWord0)) or (UInt32(Byte(LWWord2)) shl 8) or + (UInt32(Byte(LWWord4)) shl 16) or (UInt32(Byte(LWWord6)) shl 24); + LKey1 := UInt32(Byte(LWWord0 shr 8)) or (LWWord2 and $0000FF00) or + ((LWWord4 and $0000FF00) shl 8) or ((LWWord6 and $0000FF00) shl 16); + LKey2 := UInt32(Byte(LWWord0 shr 16)) or ((LWWord2 and $00FF0000) shr 8) or + (LWWord4 and $00FF0000) or ((LWWord6 and $00FF0000) shl 8); + LKey3 := (LWWord0 shr 24) or ((LWWord2 and $FF000000) shr 16) or + ((LWWord4 and $FF000000) shr 8) or (LWWord6 and $FF000000); + LKey4 := UInt32(Byte(LWWord1)) or ((LWWord3 and $000000FF) shl 8) or + ((LWWord5 and $000000FF) shl 16) or ((LWWord7 and $000000FF) shl 24); + LKey5 := UInt32(Byte(LWWord1 shr 8)) or (LWWord3 and $0000FF00) or + ((LWWord5 and $0000FF00) shl 8) or ((LWWord7 and $0000FF00) shl 16); + LKey6 := UInt32(Byte(LWWord1 shr 16)) or ((LWWord3 and $00FF0000) shr 8) or + (LWWord5 and $00FF0000) or ((LWWord7 and $00FF0000) shl 8); + LKey7 := (LWWord1 shr 24) or ((LWWord3 and $FF000000) shr 16) or + ((LWWord5 and $FF000000) shr 8) or (LWWord7 and $FF000000); + + LRight := FHash[LStep]; + LLeft := FHash[LStep + 1]; + + LTemp := LKey0 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey1 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey2 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey3 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey4 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey5 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey6 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey7 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey0 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey1 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey2 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey3 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey4 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey5 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey6 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey7 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey0 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey1 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey2 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey3 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey4 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey5 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey6 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey7 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey7 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey6 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey5 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey4 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey3 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey2 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey1 + LRight; + LLeft := LLeft xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + LTemp := LKey0 + LLeft; + LRight := LRight xor (FSBox1[Byte(LTemp)] xor FSBox2[Byte(LTemp shr 8)] xor FSBox3 + [Byte(LTemp shr 16)] xor FSBox4[LTemp shr 24]); + + LTemp := LRight; + LRight := LLeft; + LLeft := LTemp; + + LScratch[LStep] := LRight; + LScratch[LStep + 1] := LLeft; + + if (LStep = 6) then break; - l := u0 xor u2; - r := u1 xor u3; - u0 := u2; - u1 := u3; - u2 := u4; - u3 := u5; - u4 := u6; - u5 := u7; - u6 := l; - u7 := r; - - if (i = 2) then + LLeft := LUWord0 xor LUWord2; + LRight := LUWord1 xor LUWord3; + LUWord0 := LUWord2; + LUWord1 := LUWord3; + LUWord2 := LUWord4; + LUWord3 := LUWord5; + LUWord4 := LUWord6; + LUWord5 := LUWord7; + LUWord6 := LLeft; + LUWord7 := LRight; + + if (LStep = 2) then begin - u0 := u0 xor $FF00FF00; - u1 := u1 xor $FF00FF00; - u2 := u2 xor $00FF00FF; - u3 := u3 xor $00FF00FF; - u4 := u4 xor $00FFFF00; - u5 := u5 xor $FF0000FF; - u6 := u6 xor $000000FF; - u7 := u7 xor $FF00FFFF; + LUWord0 := LUWord0 xor $FF00FF00; + LUWord1 := LUWord1 xor $FF00FF00; + LUWord2 := LUWord2 xor $00FF00FF; + LUWord3 := LUWord3 xor $00FF00FF; + LUWord4 := LUWord4 xor $00FFFF00; + LUWord5 := LUWord5 xor $FF0000FF; + LUWord6 := LUWord6 xor $000000FF; + LUWord7 := LUWord7 xor $FF00FFFF; end; - l := v0; - r := v2; - v0 := v4; - v2 := v6; - v4 := l xor r; - v6 := v0 xor r; - l := v1; - r := v3; - v1 := v5; - v3 := v7; - v5 := l xor r; - v7 := v1 xor r; - - System.Inc(i, 2); + LLeft := LVWord0; + LRight := LVWord2; + LVWord0 := LVWord4; + LVWord2 := LVWord6; + LVWord4 := LLeft xor LRight; + LVWord6 := LVWord0 xor LRight; + LLeft := LVWord1; + LRight := LVWord3; + LVWord1 := LVWord5; + LVWord3 := LVWord7; + LVWord5 := LLeft xor LRight; + LVWord7 := LVWord1 xor LRight; + + System.Inc(LStep, 2); end; - u0 := APtr[0] xor s[6]; - u1 := APtr[1] xor s[7]; - u2 := APtr[2] xor (s[0] shl 16) xor (s[0] shr 16) xor (s[0] and $FFFF) - xor (s[1] and $FFFF) xor (s[1] shr 16) xor (s[2] shl 16) - xor s[6] xor (s[6] shl 16) xor (s[7] and $FFFF0000) xor (s[7] shr 16); - u3 := APtr[3] xor (s[0] and $FFFF) xor (s[0] shl 16) xor (s[1] and $FFFF) - xor (s[1] shl 16) xor (s[1] shr 16) xor (s[2] shl 16) xor (s[2] shr 16) - xor (s[3] shl 16) xor s[6] xor (s[6] shl 16) xor (s[6] shr 16) - xor (s[7] and $FFFF) xor (s[7] shl 16) xor (s[7] shr 16); - u4 := APtr[4] xor (s[0] and $FFFF0000) xor (s[0] shl 16) xor (s[0] shr 16) - xor (s[1] and $FFFF0000) xor (s[1] shr 16) xor (s[2] shl 16) - xor (s[2] shr 16) xor (s[3] shl 16) xor (s[3] shr 16) xor (s[4] shl 16) - xor (s[6] shl 16) xor (s[6] shr 16) xor (s[7] and $FFFF) xor (s[7] shl 16) - xor (s[7] shr 16); - u5 := APtr[5] xor (s[0] shl 16) xor (s[0] shr 16) xor (s[0] and $FFFF0000) - xor (s[1] and $FFFF) xor s[2] xor (s[2] shr 16) xor (s[3] shl 16) - xor (s[3] shr 16) xor (s[4] shl 16) xor (s[4] shr 16) xor (s[5] shl 16) - xor (s[6] shl 16) xor (s[6] shr 16) xor (s[7] and $FFFF0000) - xor (s[7] shl 16) xor (s[7] shr 16); - u6 := APtr[6] xor s[0] xor (s[1] shr 16) xor (s[2] shl 16) - xor s[3] xor (s[3] shr 16) xor (s[4] shl 16) xor (s[4] shr 16) - xor (s[5] shl 16) xor (s[5] shr 16) xor s[6] xor (s[6] shl 16) - xor (s[6] shr 16) xor (s[7] shl 16); - u7 := APtr[7] xor (s[0] and $FFFF0000) xor (s[0] shl 16) xor (s[1] and $FFFF) - xor (s[1] shl 16) xor (s[2] shr 16) xor (s[3] shl 16) - xor s[4] xor (s[4] shr 16) xor (s[5] shl 16) xor (s[5] shr 16) - xor (s[6] shr 16) xor (s[7] and $FFFF) xor (s[7] shl 16) xor (s[7] shr 16); - - v0 := FHash[0] xor (u1 shl 16) xor (u0 shr 16); - v1 := FHash[1] xor (u2 shl 16) xor (u1 shr 16); - v2 := FHash[2] xor (u3 shl 16) xor (u2 shr 16); - v3 := FHash[3] xor (u4 shl 16) xor (u3 shr 16); - v4 := FHash[4] xor (u5 shl 16) xor (u4 shr 16); - v5 := FHash[5] xor (u6 shl 16) xor (u5 shr 16); - v6 := FHash[6] xor (u7 shl 16) xor (u6 shr 16); - v7 := FHash[7] xor (u0 and $FFFF0000) xor (u0 shl 16) xor (u7 shr 16) - xor (u1 and $FFFF0000) xor (u1 shl 16) xor (u6 shl 16) - xor (u7 and $FFFF0000); - - FHash[0] := (v0 and $FFFF0000) xor (v0 shl 16) xor (v0 shr 16) xor (v1 shr 16) - xor (v1 and $FFFF0000) xor (v2 shl 16) xor (v3 shr 16) xor (v4 shl 16) - xor (v5 shr 16) xor v5 xor (v6 shr 16) xor (v7 shl 16) xor (v7 shr 16) - xor (v7 and $FFFF); - FHash[1] := (v0 shl 16) xor (v0 shr 16) xor (v0 and $FFFF0000) - xor (v1 and $FFFF) xor v2 xor (v2 shr 16) xor (v3 shl 16) xor (v4 shr 16) - xor (v5 shl 16) xor (v6 shl 16) xor v6 xor (v7 and $FFFF0000) - xor (v7 shr 16); - FHash[2] := (v0 and $FFFF) xor (v0 shl 16) xor (v1 shl 16) xor (v1 shr 16) - xor (v1 and $FFFF0000) xor (v2 shl 16) xor (v3 shr 16) - xor v3 xor (v4 shl 16) xor (v5 shr 16) xor v6 xor (v6 shr 16) - xor (v7 and $FFFF) xor (v7 shl 16) xor (v7 shr 16); - FHash[3] := (v0 shl 16) xor (v0 shr 16) xor (v0 and $FFFF0000) - xor (v1 and $FFFF0000) xor (v1 shr 16) xor (v2 shl 16) xor (v2 shr 16) - xor v2 xor (v3 shl 16) xor (v4 shr 16) xor v4 xor (v5 shl 16) - xor (v6 shl 16) xor (v7 and $FFFF) xor (v7 shr 16); - FHash[4] := (v0 shr 16) xor (v1 shl 16) xor v1 xor (v2 shr 16) - xor v2 xor (v3 shl 16) xor (v3 shr 16) xor v3 xor (v4 shl 16) - xor (v5 shr 16) xor v5 xor (v6 shl 16) xor (v6 shr 16) xor (v7 shl 16); - FHash[5] := (v0 shl 16) xor (v0 and $FFFF0000) xor (v1 shl 16) xor (v1 shr 16) - xor (v1 and $FFFF0000) xor (v2 shl 16) xor v2 xor (v3 shr 16) - xor v3 xor (v4 shl 16) xor (v4 shr 16) xor v4 xor (v5 shl 16) - xor (v6 shl 16) xor (v6 shr 16) xor v6 xor (v7 shl 16) xor (v7 shr 16) - xor (v7 and $FFFF0000); - FHash[6] := v0 xor v2 xor (v2 shr 16) xor v3 xor (v3 shl 16) - xor v4 xor (v4 shr 16) xor (v5 shl 16) xor (v5 shr 16) - xor v5 xor (v6 shl 16) xor (v6 shr 16) xor v6 xor (v7 shl 16) xor v7; - FHash[7] := v0 xor (v0 shr 16) xor (v1 shl 16) xor (v1 shr 16) xor (v2 shl 16) - xor (v3 shr 16) xor v3 xor (v4 shl 16) xor v4 xor (v5 shr 16) - xor v5 xor (v6 shl 16) xor (v6 shr 16) xor (v7 shl 16) xor v7; + LUWord0 := APtr[0] xor LScratch[6]; + LUWord1 := APtr[1] xor LScratch[7]; + LUWord2 := APtr[2] xor (LScratch[0] shl 16) xor (LScratch[0] shr 16) xor (LScratch[0] and $FFFF) + xor (LScratch[1] and $FFFF) xor (LScratch[1] shr 16) xor (LScratch[2] shl 16) + xor LScratch[6] xor (LScratch[6] shl 16) xor (LScratch[7] and $FFFF0000) xor (LScratch[7] shr 16); + LUWord3 := APtr[3] xor (LScratch[0] and $FFFF) xor (LScratch[0] shl 16) xor (LScratch[1] and $FFFF) + xor (LScratch[1] shl 16) xor (LScratch[1] shr 16) xor (LScratch[2] shl 16) xor (LScratch[2] shr 16) + xor (LScratch[3] shl 16) xor LScratch[6] xor (LScratch[6] shl 16) xor (LScratch[6] shr 16) + xor (LScratch[7] and $FFFF) xor (LScratch[7] shl 16) xor (LScratch[7] shr 16); + LUWord4 := APtr[4] xor (LScratch[0] and $FFFF0000) xor (LScratch[0] shl 16) xor (LScratch[0] shr 16) + xor (LScratch[1] and $FFFF0000) xor (LScratch[1] shr 16) xor (LScratch[2] shl 16) + xor (LScratch[2] shr 16) xor (LScratch[3] shl 16) xor (LScratch[3] shr 16) xor (LScratch[4] shl 16) + xor (LScratch[6] shl 16) xor (LScratch[6] shr 16) xor (LScratch[7] and $FFFF) xor (LScratch[7] shl 16) + xor (LScratch[7] shr 16); + LUWord5 := APtr[5] xor (LScratch[0] shl 16) xor (LScratch[0] shr 16) xor (LScratch[0] and $FFFF0000) + xor (LScratch[1] and $FFFF) xor LScratch[2] xor (LScratch[2] shr 16) xor (LScratch[3] shl 16) + xor (LScratch[3] shr 16) xor (LScratch[4] shl 16) xor (LScratch[4] shr 16) xor (LScratch[5] shl 16) + xor (LScratch[6] shl 16) xor (LScratch[6] shr 16) xor (LScratch[7] and $FFFF0000) + xor (LScratch[7] shl 16) xor (LScratch[7] shr 16); + LUWord6 := APtr[6] xor LScratch[0] xor (LScratch[1] shr 16) xor (LScratch[2] shl 16) + xor LScratch[3] xor (LScratch[3] shr 16) xor (LScratch[4] shl 16) xor (LScratch[4] shr 16) + xor (LScratch[5] shl 16) xor (LScratch[5] shr 16) xor LScratch[6] xor (LScratch[6] shl 16) + xor (LScratch[6] shr 16) xor (LScratch[7] shl 16); + LUWord7 := APtr[7] xor (LScratch[0] and $FFFF0000) xor (LScratch[0] shl 16) xor (LScratch[1] and $FFFF) + xor (LScratch[1] shl 16) xor (LScratch[2] shr 16) xor (LScratch[3] shl 16) + xor LScratch[4] xor (LScratch[4] shr 16) xor (LScratch[5] shl 16) xor (LScratch[5] shr 16) + xor (LScratch[6] shr 16) xor (LScratch[7] and $FFFF) xor (LScratch[7] shl 16) xor (LScratch[7] shr 16); + + LVWord0 := FHash[0] xor (LUWord1 shl 16) xor (LUWord0 shr 16); + LVWord1 := FHash[1] xor (LUWord2 shl 16) xor (LUWord1 shr 16); + LVWord2 := FHash[2] xor (LUWord3 shl 16) xor (LUWord2 shr 16); + LVWord3 := FHash[3] xor (LUWord4 shl 16) xor (LUWord3 shr 16); + LVWord4 := FHash[4] xor (LUWord5 shl 16) xor (LUWord4 shr 16); + LVWord5 := FHash[5] xor (LUWord6 shl 16) xor (LUWord5 shr 16); + LVWord6 := FHash[6] xor (LUWord7 shl 16) xor (LUWord6 shr 16); + LVWord7 := FHash[7] xor (LUWord0 and $FFFF0000) xor (LUWord0 shl 16) xor (LUWord7 shr 16) + xor (LUWord1 and $FFFF0000) xor (LUWord1 shl 16) xor (LUWord6 shl 16) + xor (LUWord7 and $FFFF0000); + + FHash[0] := (LVWord0 and $FFFF0000) xor (LVWord0 shl 16) xor (LVWord0 shr 16) xor (LVWord1 shr 16) + xor (LVWord1 and $FFFF0000) xor (LVWord2 shl 16) xor (LVWord3 shr 16) xor (LVWord4 shl 16) + xor (LVWord5 shr 16) xor LVWord5 xor (LVWord6 shr 16) xor (LVWord7 shl 16) xor (LVWord7 shr 16) + xor (LVWord7 and $FFFF); + FHash[1] := (LVWord0 shl 16) xor (LVWord0 shr 16) xor (LVWord0 and $FFFF0000) + xor (LVWord1 and $FFFF) xor LVWord2 xor (LVWord2 shr 16) xor (LVWord3 shl 16) xor (LVWord4 shr 16) + xor (LVWord5 shl 16) xor (LVWord6 shl 16) xor LVWord6 xor (LVWord7 and $FFFF0000) + xor (LVWord7 shr 16); + FHash[2] := (LVWord0 and $FFFF) xor (LVWord0 shl 16) xor (LVWord1 shl 16) xor (LVWord1 shr 16) + xor (LVWord1 and $FFFF0000) xor (LVWord2 shl 16) xor (LVWord3 shr 16) + xor LVWord3 xor (LVWord4 shl 16) xor (LVWord5 shr 16) xor LVWord6 xor (LVWord6 shr 16) + xor (LVWord7 and $FFFF) xor (LVWord7 shl 16) xor (LVWord7 shr 16); + FHash[3] := (LVWord0 shl 16) xor (LVWord0 shr 16) xor (LVWord0 and $FFFF0000) + xor (LVWord1 and $FFFF0000) xor (LVWord1 shr 16) xor (LVWord2 shl 16) xor (LVWord2 shr 16) + xor LVWord2 xor (LVWord3 shl 16) xor (LVWord4 shr 16) xor LVWord4 xor (LVWord5 shl 16) + xor (LVWord6 shl 16) xor (LVWord7 and $FFFF) xor (LVWord7 shr 16); + FHash[4] := (LVWord0 shr 16) xor (LVWord1 shl 16) xor LVWord1 xor (LVWord2 shr 16) + xor LVWord2 xor (LVWord3 shl 16) xor (LVWord3 shr 16) xor LVWord3 xor (LVWord4 shl 16) + xor (LVWord5 shr 16) xor LVWord5 xor (LVWord6 shl 16) xor (LVWord6 shr 16) xor (LVWord7 shl 16); + FHash[5] := (LVWord0 shl 16) xor (LVWord0 and $FFFF0000) xor (LVWord1 shl 16) xor (LVWord1 shr 16) + xor (LVWord1 and $FFFF0000) xor (LVWord2 shl 16) xor LVWord2 xor (LVWord3 shr 16) + xor LVWord3 xor (LVWord4 shl 16) xor (LVWord4 shr 16) xor LVWord4 xor (LVWord5 shl 16) + xor (LVWord6 shl 16) xor (LVWord6 shr 16) xor LVWord6 xor (LVWord7 shl 16) xor (LVWord7 shr 16) + xor (LVWord7 and $FFFF0000); + FHash[6] := LVWord0 xor LVWord2 xor (LVWord2 shr 16) xor LVWord3 xor (LVWord3 shl 16) + xor LVWord4 xor (LVWord4 shr 16) xor (LVWord5 shl 16) xor (LVWord5 shr 16) + xor LVWord5 xor (LVWord6 shl 16) xor (LVWord6 shr 16) xor LVWord6 xor (LVWord7 shl 16) xor LVWord7; + FHash[7] := LVWord0 xor (LVWord0 shr 16) xor (LVWord1 shl 16) xor (LVWord1 shr 16) xor (LVWord2 shl 16) + xor (LVWord3 shr 16) xor LVWord3 xor (LVWord4 shl 16) xor LVWord4 xor (LVWord5 shr 16) + xor LVWord5 xor (LVWord6 shl 16) xor (LVWord6 shr 16) xor (LVWord7 shl 16) xor LVWord7; end; class procedure TGost.ComputeSBoxes(const ASBox: THashLibMatrixUInt32Array; out ASBox1, ASBox2, ASBox3, ASBox4: THashLibUInt32Array); var - LIdx, LA, LB: Int32; - ax, bx, cx, dx: UInt32; + LIdx, LRowIdx, LColIdx: Int32; + LWordA, LWordB, LWordC, LWordD: UInt32; begin System.SetLength(ASBox1, 256); System.SetLength(ASBox2, 256); @@ -359,20 +359,20 @@ class procedure TGost.ComputeSBoxes(const ASBox: THashLibMatrixUInt32Array; LIdx := 0; - for LA := 0 to 15 do + for LRowIdx := 0 to 15 do begin - ax := ASBox[1, LA] shl 15; - bx := ASBox[3, LA] shl 23; - cx := ASBox[5, LA]; - cx := TBits.RotateRight32(cx, 1); - dx := ASBox[7, LA] shl 7; + LWordA := ASBox[1, LRowIdx] shl 15; + LWordB := ASBox[3, LRowIdx] shl 23; + LWordC := ASBox[5, LRowIdx]; + LWordC := TBits.RotateRight32(LWordC, 1); + LWordD := ASBox[7, LRowIdx] shl 7; - for LB := 0 to 15 do + for LColIdx := 0 to 15 do begin - ASBox1[LIdx] := ax or (ASBox[0, LB] shl 11); - ASBox2[LIdx] := bx or (ASBox[2, LB] shl 19); - ASBox3[LIdx] := cx or (ASBox[4, LB] shl 27); - ASBox4[LIdx] := dx or (ASBox[6, LB] shl 3); + ASBox1[LIdx] := LWordA or (ASBox[0, LColIdx] shl 11); + ASBox2[LIdx] := LWordB or (ASBox[2, LColIdx] shl 19); + ASBox3[LIdx] := LWordC or (ASBox[4, LColIdx] shl 27); + ASBox4[LIdx] := LWordD or (ASBox[6, LColIdx] shl 3); System.Inc(LIdx); end; end; @@ -380,7 +380,7 @@ class procedure TGost.ComputeSBoxes(const ASBox: THashLibMatrixUInt32Array; constructor TGost.Create(ASBoxType: TGostSBox); begin - Inherited Create(32, 32); + inherited Create(32, 32); System.SetLength(FState, 8); System.SetLength(FHash, 8); FSBoxType := ASBoxType; @@ -426,9 +426,9 @@ procedure TGost.Finish; function TGost.GetResult: THashLibByteArray; begin - System.SetLength(result, 8 * System.SizeOf(UInt32)); - TConverters.le32_copy(PCardinal(FHash), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 8 * System.SizeOf(UInt32)); + TConverters.le32_copy(PCardinal(FHash), 0, PByte(Result), 0, + System.Length(Result)); end; class constructor TGost.Gost; @@ -469,39 +469,39 @@ procedure TGost.Initialize; begin TArrayUtils.ZeroFill(FState); TArrayUtils.ZeroFill(FHash); - Inherited Initialize(); + inherited Initialize(); end; procedure TGost.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - LData, LM: array [0 .. 7] of UInt32; - LC, LA, LB: UInt32; + LData, LCompressBuffer: array [0 .. 7] of UInt32; + LCarry, LBlockWord, LPriorState: UInt32; LIdx: Int32; begin - LC := 0; + LCarry := 0; TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); for LIdx := 0 to 7 do begin - LA := LData[LIdx]; - LM[LIdx] := LA; - LB := FState[LIdx]; - LC := LA + LC + FState[LIdx]; - FState[LIdx] := LC; - if ((LC < LA) or (LC < LB)) then + LBlockWord := LData[LIdx]; + LCompressBuffer[LIdx] := LBlockWord; + LPriorState := FState[LIdx]; + LCarry := LBlockWord + LCarry + FState[LIdx]; + FState[LIdx] := LCarry; + if ((LCarry < LBlockWord) or (LCarry < LPriorState)) then begin - LC := UInt32(1) + LCarry := UInt32(1) end else begin - LC := UInt32(0); + LCarry := UInt32(0); end; end; - Compress(@(LM[0])); + Compress(@(LCompressBuffer[0])); - System.FillChar(LM, System.SizeOf(LM), UInt32(0)); + System.FillChar(LCompressBuffer, System.SizeOf(LCompressBuffer), UInt32(0)); System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpGrindahl256.pas b/HashLib/src/Crypto/HlpGrindahl256.pas index de73c882..ef90851b 100644 --- a/HashLib/src/Crypto/HlpGrindahl256.pas +++ b/HashLib/src/Crypto/HlpGrindahl256.pas @@ -26,7 +26,7 @@ TGrindahl256 = class sealed(TBlockHash, ICryptoNotBuildIn, ITransformBlock) {$REGION 'Consts'} const - SMasterTable: array [0 .. 255] of UInt32 = ($C66363A5, $F87C7C84, $EE777799, + MasterTable: array [0 .. 255] of UInt32 = ($C66363A5, $F87C7C84, $EE777799, $F67B7B8D, $FFF2F20D, $D66B6BBD, $DE6F6FB1, $91C5C554, $60303050, $02010103, $CE6767A9, $562B2B7D, $E7FEFE19, $B5D7D762, $4DABABE6, $EC76769A, $8FCACA45, $1F82829D, $89C9C940, $FA7D7D87, $EFFAFA15, @@ -97,15 +97,15 @@ implementation class function TGrindahl256.CalcTable(AI: Int32): THashLibUInt32Array; var - Jdx: Int32; + LJdx: Int32; begin - System.SetLength(result, 256); - Jdx := 0; - while Jdx < 256 do + System.SetLength(Result, 256); + LJdx := 0; + while LJdx < 256 do begin - result[Jdx] := UInt32((SMasterTable[Jdx] shr (AI * 8)) or - (SMasterTable[Jdx] shl (32 - AI * 8))); - System.Inc(Jdx); + Result[LJdx] := UInt32((MasterTable[LJdx] shr (AI * 8)) or + (MasterTable[LJdx] shl (32 - AI * 8))); + System.Inc(LJdx); end; end; @@ -118,13 +118,13 @@ function TGrindahl256.Clone(): IHash; LHashInstance.FTemp := System.Copy(FTemp); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TGrindahl256.Create; begin - Inherited Create(32, 4); + inherited Create(32, 4); System.SetLength(FState, 13); System.SetLength(FTemp, 13); end; @@ -152,35 +152,35 @@ procedure TGrindahl256.Finish; FState[0] := TConverters.be2me_32(FState[0]); - InjectMsg(true); + InjectMsg(True); LIdx := 0; while LIdx < 8 do begin - InjectMsg(true); + InjectMsg(True); System.Inc(LIdx); end; end; function TGrindahl256.GetResult: THashLibByteArray; begin - System.SetLength(result, 8 * System.SizeOf(UInt32)); + System.SetLength(Result, 8 * System.SizeOf(UInt32)); TConverters.be32_copy(PCardinal(FState), 5 * System.SizeOf(UInt32), - PByte(result), 0, System.Length(result)); + PByte(Result), 0, System.Length(Result)); end; class constructor TGrindahl256.Grindahl256; var LLowIndex1, LLowIndex2: Int32; begin - System.SetLength(FSTable0, System.Length(SMasterTable)); + System.SetLength(FSTable0, System.Length(MasterTable)); - LLowIndex1 := System.Low(SMasterTable); + LLowIndex1 := System.Low(MasterTable); LLowIndex2 := System.Low(FSTable0); - System.Move(SMasterTable[LLowIndex1], FSTable0[LLowIndex2], - System.SizeOf(SMasterTable)); + System.Move(MasterTable[LLowIndex1], FSTable0[LLowIndex2], + System.SizeOf(MasterTable)); FSTable1 := CalcTable(1); FSTable2 := CalcTable(2); @@ -191,12 +191,12 @@ procedure TGrindahl256.Initialize; begin TArrayUtils.ZeroFill(FState); TArrayUtils.ZeroFill(FTemp); - Inherited Initialize(); + inherited Initialize(); end; procedure TGrindahl256.InjectMsg(AFullProcess: Boolean); var - LU: THashLibUInt32Array; + LSwapTemp: THashLibUInt32Array; begin FState[12] := FState[12] xor $01; @@ -255,9 +255,9 @@ procedure TGrindahl256.InjectMsg(AFullProcess: Boolean); [Byte(FState[10] shr 16)] xor FSTable2[Byte(FState[8] shr 8)] xor FSTable3 [Byte(FState[2])]; - LU := FTemp; + LSwapTemp := FTemp; FTemp := FState; - FState := LU; + FState := LSwapTemp; end; procedure TGrindahl256.TransformBlock(AData: PByte; ADataLength: Int32; @@ -265,7 +265,7 @@ procedure TGrindahl256.TransformBlock(AData: PByte; ADataLength: Int32; begin FState[0] := TConverters.ReadBytesAsUInt32LE(AData, AIndex); FState[0] := TConverters.be2me_32(FState[0]); - InjectMsg(false); + InjectMsg(False); end; end. diff --git a/HashLib/src/Crypto/HlpGrindahl512.pas b/HashLib/src/Crypto/HlpGrindahl512.pas index 682bd5f9..60d70d1c 100644 --- a/HashLib/src/Crypto/HlpGrindahl512.pas +++ b/HashLib/src/Crypto/HlpGrindahl512.pas @@ -28,7 +28,7 @@ TGrindahl512 = class sealed(TBlockHash, ICryptoNotBuildIn, ITransformBlock) {$REGION 'Consts'} const - SMasterTable: array [0 .. 255] of UInt64 = (UInt64($C6636397633551A2), + MasterTable: array [0 .. 255] of UInt64 = (UInt64($C6636397633551A2), UInt64($F87C7CEB7CCD1326), UInt64($EE7777C777952952), UInt64($F67B7BF77BF50102), UInt64($FFF2F2E5F2D11A34), UInt64($D66B6BB76B7561C2), UInt64($DE6F6FA76F5579F2), @@ -184,14 +184,14 @@ implementation class function TGrindahl512.CalcTable(AI: Int32): THashLibUInt64Array; var - Jdx: Int32; + LJdx: Int32; begin - System.SetLength(result, 256); - Jdx := 0; - while Jdx < 256 do + System.SetLength(Result, 256); + LJdx := 0; + while LJdx < 256 do begin - result[Jdx] := TBits.RotateRight64(SMasterTable[Jdx], AI * 8); - System.Inc(Jdx); + Result[LJdx] := TBits.RotateRight64(MasterTable[LJdx], AI * 8); + System.Inc(LJdx); end; end; @@ -204,13 +204,13 @@ function TGrindahl512.Clone(): IHash; LHashInstance.FTemp := System.Copy(FTemp); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TGrindahl512.Create; begin - Inherited Create(64, 8); + inherited Create(64, 8); System.SetLength(FState, 13); System.SetLength(FTemp, 13); end; @@ -238,35 +238,35 @@ procedure TGrindahl512.Finish; FState[0] := TConverters.be2me_64(FState[0]); - InjectMsg(true); + InjectMsg(True); LIdx := 0; while LIdx < 8 do begin - InjectMsg(true); + InjectMsg(True); System.Inc(LIdx); end; end; function TGrindahl512.GetResult: THashLibByteArray; begin - System.SetLength(result, 8 * System.SizeOf(UInt64)); + System.SetLength(Result, 8 * System.SizeOf(UInt64)); TConverters.be64_copy(PUInt64(FState), 5 * System.SizeOf(UInt64), - PByte(result), 0, System.Length(result)); + PByte(Result), 0, System.Length(Result)); end; class constructor TGrindahl512.Grindahl512; var LLowIndex1, LLowIndex2: Int32; begin - System.SetLength(FSTable0, System.Length(SMasterTable)); + System.SetLength(FSTable0, System.Length(MasterTable)); - LLowIndex1 := System.Low(SMasterTable); + LLowIndex1 := System.Low(MasterTable); LLowIndex2 := System.Low(FSTable0); - System.Move(SMasterTable[LLowIndex1], FSTable0[LLowIndex2], - System.SizeOf(SMasterTable)); + System.Move(MasterTable[LLowIndex1], FSTable0[LLowIndex2], + System.SizeOf(MasterTable)); FSTable1 := CalcTable(1); FSTable2 := CalcTable(2); @@ -281,12 +281,12 @@ procedure TGrindahl512.Initialize; begin TArrayUtils.ZeroFill(FState); TArrayUtils.ZeroFill(FTemp); - Inherited Initialize(); + inherited Initialize(); end; procedure TGrindahl512.InjectMsg(AFullProcess: Boolean); var - LU: THashLibUInt64Array; + LSwapTemp: THashLibUInt64Array; begin FState[12] := FState[12] xor $01; @@ -371,9 +371,9 @@ procedure TGrindahl512.InjectMsg(AFullProcess: Boolean); [Byte(FState[6] shr 16)] xor FSTable6[Byte(FState[5] shr 8)] xor FSTable7 [Byte(FState[4])]; - LU := FTemp; + LSwapTemp := FTemp; FTemp := FState; - FState := LU; + FState := LSwapTemp; end; procedure TGrindahl512.TransformBlock(AData: PByte; ADataLength: Int32; @@ -381,7 +381,7 @@ procedure TGrindahl512.TransformBlock(AData: PByte; ADataLength: Int32; begin FState[0] := TConverters.ReadBytesAsUInt64LE(AData, AIndex); FState[0] := TConverters.be2me_64(FState[0]); - InjectMsg(false); + InjectMsg(False); end; end. diff --git a/HashLib/src/Crypto/HlpHAS160.pas b/HashLib/src/Crypto/HlpHAS160.pas index a102684b..cb57a423 100644 --- a/HashLib/src/Crypto/HlpHAS160.pas +++ b/HashLib/src/Crypto/HlpHAS160.pas @@ -58,13 +58,13 @@ function THAS160.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THAS160.Create; begin - Inherited Create(20, 64); + inherited Create(20, 64); System.SetLength(FHash, 5); end; @@ -99,9 +99,9 @@ procedure THAS160.Finish; function THAS160.GetResult: THashLibByteArray; begin - System.SetLength(result, 5 * System.SizeOf(UInt32)); - TConverters.le32_copy(PCardinal(FHash), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 5 * System.SizeOf(UInt32)); + TConverters.le32_copy(PCardinal(FHash), 0, PByte(Result), 0, + System.Length(Result)); end; procedure THAS160.Initialize; @@ -111,21 +111,21 @@ procedure THAS160.Initialize; FHash[2] := $98BADCFE; FHash[3] := $10325476; FHash[4] := $C3D2E1F0; - Inherited Initialize(); + inherited Initialize(); end; procedure THAS160.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - A, B, C, D, E, T: UInt32; - R: Int32; + LRegA, LRegB, LRegC, LRegD, LRegE, LTemp: UInt32; + LRoundIdx: Int32; LData: array [0 .. 19] of UInt32; begin - A := FHash[0]; - B := FHash[1]; - C := FHash[2]; - D := FHash[3]; - E := FHash[4]; + LRegA := FHash[0]; + LRegB := FHash[1]; + LRegC := FHash[2]; + LRegD := FHash[3]; + LRegE := FHash[4]; TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); @@ -134,17 +134,17 @@ procedure THAS160.TransformBlock(AData: PByte; ADataLength: Int32; LData[18] := LData[8] xor LData[9] xor LData[10] xor LData[11]; LData[19] := LData[12] xor LData[13] xor LData[14] xor LData[15]; - R := 0; - while R < 20 do + LRoundIdx := 0; + while LRoundIdx < 20 do begin - T := LData[SIndex[R]] + (A shl SRot[R] or A shr Stor[R]) + - ((B and C) or (not B and D)) + E; - E := D; - D := C; - C := B shl 10 or B shr 22; - B := A; - A := T; - System.Inc(R); + LTemp := LData[SIndex[LRoundIdx]] + (LRegA shl SRot[LRoundIdx] or LRegA shr Stor[LRoundIdx]) + + ((LRegB and LRegC) or (not LRegB and LRegD)) + LRegE; + LRegE := LRegD; + LRegD := LRegC; + LRegC := LRegB shl 10 or LRegB shr 22; + LRegB := LRegA; + LRegA := LTemp; + System.Inc(LRoundIdx); end; LData[16] := LData[3] xor LData[6] xor LData[9] xor LData[12]; @@ -152,17 +152,17 @@ procedure THAS160.TransformBlock(AData: PByte; ADataLength: Int32; LData[18] := LData[1] xor LData[4] xor LData[11] xor LData[14]; LData[19] := LData[0] xor LData[7] xor LData[10] xor LData[13]; - R := 20; - while R < 40 do + LRoundIdx := 20; + while LRoundIdx < 40 do begin - T := LData[SIndex[R]] + $5A827999 + - (A shl SRot[R - 20] or A shr Stor[R - 20]) + (B xor C xor D) + E; - E := D; - D := C; - C := B shl 17 or B shr 15; - B := A; - A := T; - System.Inc(R); + LTemp := LData[SIndex[LRoundIdx]] + $5A827999 + + (LRegA shl SRot[LRoundIdx - 20] or LRegA shr Stor[LRoundIdx - 20]) + (LRegB xor LRegC xor LRegD) + LRegE; + LRegE := LRegD; + LRegD := LRegC; + LRegC := LRegB shl 17 or LRegB shr 15; + LRegB := LRegA; + LRegA := LTemp; + System.Inc(LRoundIdx); end; LData[16] := LData[5] xor LData[7] xor LData[12] xor LData[14]; @@ -170,17 +170,17 @@ procedure THAS160.TransformBlock(AData: PByte; ADataLength: Int32; LData[18] := LData[4] xor LData[6] xor LData[13] xor LData[15]; LData[19] := LData[1] xor LData[3] xor LData[8] xor LData[10]; - R := 40; - while R < 60 do + LRoundIdx := 40; + while LRoundIdx < 60 do begin - T := LData[SIndex[R]] + $6ED9EBA1 + - (A shl SRot[R - 40] or A shr Stor[R - 40]) + (C xor (B or not D)) + E; - E := D; - D := C; - C := B shl 25 or B shr 7; - B := A; - A := T; - System.Inc(R); + LTemp := LData[SIndex[LRoundIdx]] + $6ED9EBA1 + + (LRegA shl SRot[LRoundIdx - 40] or LRegA shr Stor[LRoundIdx - 40]) + (LRegC xor (LRegB or not LRegD)) + LRegE; + LRegE := LRegD; + LRegD := LRegC; + LRegC := LRegB shl 25 or LRegB shr 7; + LRegB := LRegA; + LRegA := LTemp; + System.Inc(LRoundIdx); end; LData[16] := LData[2] xor LData[7] xor LData[8] xor LData[13]; @@ -188,24 +188,24 @@ procedure THAS160.TransformBlock(AData: PByte; ADataLength: Int32; LData[18] := LData[0] xor LData[5] xor LData[10] xor LData[15]; LData[19] := LData[1] xor LData[6] xor LData[11] xor LData[12]; - R := 60; - while R < 80 do + LRoundIdx := 60; + while LRoundIdx < 80 do begin - T := LData[SIndex[R]] + $8F1BBCDC + - (A shl SRot[R - 60] or A shr Stor[R - 60]) + (B xor C xor D) + E; - E := D; - D := C; - C := (B shl 30) or (B shr 2); - B := A; - A := T; - System.Inc(R); + LTemp := LData[SIndex[LRoundIdx]] + $8F1BBCDC + + (LRegA shl SRot[LRoundIdx - 60] or LRegA shr Stor[LRoundIdx - 60]) + (LRegB xor LRegC xor LRegD) + LRegE; + LRegE := LRegD; + LRegD := LRegC; + LRegC := (LRegB shl 30) or (LRegB shr 2); + LRegB := LRegA; + LRegA := LTemp; + System.Inc(LRoundIdx); end; - FHash[0] := FHash[0] + A; - FHash[1] := FHash[1] + B; - FHash[2] := FHash[2] + C; - FHash[3] := FHash[3] + D; - FHash[4] := FHash[4] + E; + FHash[0] := FHash[0] + LRegA; + FHash[1] := FHash[1] + LRegB; + FHash[2] := FHash[2] + LRegC; + FHash[3] := FHash[3] + LRegD; + FHash[4] := FHash[4] + LRegE; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpHaval.pas b/HashLib/src/Crypto/HlpHaval.pas index 30dc2387..3f484f6a 100644 --- a/HashLib/src/Crypto/HlpHaval.pas +++ b/HashLib/src/Crypto/HlpHaval.pas @@ -280,9 +280,9 @@ procedure THaval.Finish; function THaval.GetResult: THashLibByteArray; begin TailorDigestBits(); - System.SetLength(result, (HashSize shr 2) * System.SizeOf(UInt32)); - TConverters.le32_copy(PCardinal(FHash), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, (HashSize shr 2) * System.SizeOf(UInt32)); + TConverters.le32_copy(PCardinal(FHash), 0, PByte(Result), 0, + System.Length(Result)); end; procedure THaval.Initialize; @@ -301,61 +301,61 @@ procedure THaval.Initialize; procedure THaval.TailorDigestBits; var - LT: UInt32; + LTailorWord: UInt32; begin case HashSize of 16: begin - LT := (FHash[7] and $000000FF) or (FHash[6] and $FF000000) or + LTailorWord := (FHash[7] and $000000FF) or (FHash[6] and $FF000000) or (FHash[5] and $00FF0000) or (FHash[4] and $0000FF00); - FHash[0] := FHash[0] + TBits.RotateRight32(LT, 8); - LT := (FHash[7] and $0000FF00) or (FHash[6] and $000000FF) or + FHash[0] := FHash[0] + TBits.RotateRight32(LTailorWord, 8); + LTailorWord := (FHash[7] and $0000FF00) or (FHash[6] and $000000FF) or (FHash[5] and $FF000000) or (FHash[4] and $00FF0000); - FHash[1] := FHash[1] + TBits.RotateRight32(LT, 16); - LT := (FHash[7] and $00FF0000) or (FHash[6] and $0000FF00) or + FHash[1] := FHash[1] + TBits.RotateRight32(LTailorWord, 16); + LTailorWord := (FHash[7] and $00FF0000) or (FHash[6] and $0000FF00) or (FHash[5] and $000000FF) or (FHash[4] and $FF000000); - FHash[2] := FHash[2] + TBits.RotateRight32(LT, 24); - LT := (FHash[7] and $FF000000) or (FHash[6] and $00FF0000) or + FHash[2] := FHash[2] + TBits.RotateRight32(LTailorWord, 24); + LTailorWord := (FHash[7] and $FF000000) or (FHash[6] and $00FF0000) or (FHash[5] and $0000FF00) or (FHash[4] and $000000FF); - FHash[3] := FHash[3] + LT; + FHash[3] := FHash[3] + LTailorWord; end; 20: begin - LT := UInt32(FHash[7] and $3F) or UInt32(FHash[6] and ($7F shl 25)) or + LTailorWord := UInt32(FHash[7] and $3F) or UInt32(FHash[6] and ($7F shl 25)) or UInt32(FHash[5] and ($3F shl 19)); - FHash[0] := FHash[0] + TBits.RotateRight32(LT, 19); - LT := UInt32(FHash[7] and ($3F shl 6)) or UInt32(FHash[6] and $3F) or + FHash[0] := FHash[0] + TBits.RotateRight32(LTailorWord, 19); + LTailorWord := UInt32(FHash[7] and ($3F shl 6)) or UInt32(FHash[6] and $3F) or UInt32(FHash[5] and ($7F shl 25)); - FHash[1] := FHash[1] + TBits.RotateRight32(LT, 25); - LT := (FHash[7] and ($7F shl 12)) or (FHash[6] and ($3F shl 6)) or + FHash[1] := FHash[1] + TBits.RotateRight32(LTailorWord, 25); + LTailorWord := (FHash[7] and ($7F shl 12)) or (FHash[6] and ($3F shl 6)) or (FHash[5] and $3F); - FHash[2] := FHash[2] + LT; - LT := (FHash[7] and ($3F shl 19)) or (FHash[6] and ($7F shl 12)) or + FHash[2] := FHash[2] + LTailorWord; + LTailorWord := (FHash[7] and ($3F shl 19)) or (FHash[6] and ($7F shl 12)) or (FHash[5] and ($3F shl 6)); - FHash[3] := FHash[3] + (LT shr 6); - LT := (FHash[7] and (UInt32($7F) shl 25)) or + FHash[3] := FHash[3] + (LTailorWord shr 6); + LTailorWord := (FHash[7] and (UInt32($7F) shl 25)) or UInt32(FHash[6] and ($3F shl 19)) or UInt32(FHash[5] and ($7F shl 12)); - FHash[4] := FHash[4] + (LT shr 12); + FHash[4] := FHash[4] + (LTailorWord shr 12); end; 24: begin - LT := UInt32(FHash[7] and $1F) or UInt32(FHash[6] and ($3F shl 26)); - FHash[0] := FHash[0] + TBits.RotateRight32(LT, 26); - LT := (FHash[7] and ($1F shl 5)) or (FHash[6] and $1F); - FHash[1] := FHash[1] + LT; - LT := (FHash[7] and ($3F shl 10)) or (FHash[6] and ($1F shl 5)); - FHash[2] := FHash[2] + (LT shr 5); - LT := (FHash[7] and ($1F shl 16)) or (FHash[6] and ($3F shl 10)); - FHash[3] := FHash[3] + (LT shr 10); - LT := (FHash[7] and ($1F shl 21)) or (FHash[6] and ($1F shl 16)); - FHash[4] := FHash[4] + (LT shr 16); - LT := UInt32(FHash[7] and ($3F shl 26)) or + LTailorWord := UInt32(FHash[7] and $1F) or UInt32(FHash[6] and ($3F shl 26)); + FHash[0] := FHash[0] + TBits.RotateRight32(LTailorWord, 26); + LTailorWord := (FHash[7] and ($1F shl 5)) or (FHash[6] and $1F); + FHash[1] := FHash[1] + LTailorWord; + LTailorWord := (FHash[7] and ($3F shl 10)) or (FHash[6] and ($1F shl 5)); + FHash[2] := FHash[2] + (LTailorWord shr 5); + LTailorWord := (FHash[7] and ($1F shl 16)) or (FHash[6] and ($3F shl 10)); + FHash[3] := FHash[3] + (LTailorWord shr 10); + LTailorWord := (FHash[7] and ($1F shl 21)) or (FHash[6] and ($1F shl 16)); + FHash[4] := FHash[4] + (LTailorWord shr 16); + LTailorWord := UInt32(FHash[7] and ($3F shl 26)) or UInt32(FHash[6] and ($1F shl 21)); - FHash[5] := FHash[5] + (LT shr 21); + FHash[5] := FHash[5] + (LTailorWord shr 21); end; 28: @@ -382,412 +382,412 @@ constructor THaval3.Create(AHashSize: THashSize); procedure THaval3.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, e, f, g, h, t: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegE, LRegF, LRegG, LRegH, LNfOut: UInt32; LTemp: array [0 .. 31] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LTemp[0]), 0, ADataLength); - a := FHash[0]; - b := FHash[1]; - c := FHash[2]; - d := FHash[3]; - e := FHash[4]; - f := FHash[5]; - g := FHash[6]; - h := FHash[7]; + LRegA := FHash[0]; + LRegB := FHash[1]; + LRegC := FHash[2]; + LRegD := FHash[3]; + LRegE := FHash[4]; + LRegF := FHash[5]; + LRegG := FHash[6]; + LRegH := FHash[7]; - t := c and (e xor d) xor g and a xor f and b xor e; - h := LTemp[0] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegC and (LRegE xor LRegD) xor LRegG and LRegA xor LRegF and LRegB xor LRegE; + LRegH := LTemp[0] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := b and (d xor c) xor f and h xor e and a xor d; - g := LTemp[1] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegB and (LRegD xor LRegC) xor LRegF and LRegH xor LRegE and LRegA xor LRegD; + LRegG := LTemp[1] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (c xor b) xor e and g xor d and h xor c; - f := LTemp[2] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegC xor LRegB) xor LRegE and LRegG xor LRegD and LRegH xor LRegC; + LRegF := LTemp[2] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (b xor a) xor d and f xor c and g xor b; - e := LTemp[3] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegB xor LRegA) xor LRegD and LRegF xor LRegC and LRegG xor LRegB; + LRegE := LTemp[3] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (a xor h) xor c and e xor b and f xor a; - d := LTemp[4] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegA xor LRegH) xor LRegC and LRegE xor LRegB and LRegF xor LRegA; + LRegD := LTemp[4] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (h xor g) xor b and d xor a and e xor h; - c := LTemp[5] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegH xor LRegG) xor LRegB and LRegD xor LRegA and LRegE xor LRegH; + LRegC := LTemp[5] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (g xor f) xor a and c xor h and d xor g; - b := LTemp[6] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegG xor LRegF) xor LRegA and LRegC xor LRegH and LRegD xor LRegG; + LRegB := LTemp[6] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (f xor e) xor h and b xor g and c xor f; - a := LTemp[7] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegF xor LRegE) xor LRegH and LRegB xor LRegG and LRegC xor LRegF; + LRegA := LTemp[7] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := c and (e xor d) xor g and a xor f and b xor e; - h := LTemp[8] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegC and (LRegE xor LRegD) xor LRegG and LRegA xor LRegF and LRegB xor LRegE; + LRegH := LTemp[8] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := b and (d xor c) xor f and h xor e and a xor d; - g := LTemp[9] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegB and (LRegD xor LRegC) xor LRegF and LRegH xor LRegE and LRegA xor LRegD; + LRegG := LTemp[9] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (c xor b) xor e and g xor d and h xor c; - f := LTemp[10] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegC xor LRegB) xor LRegE and LRegG xor LRegD and LRegH xor LRegC; + LRegF := LTemp[10] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (b xor a) xor d and f xor c and g xor b; - e := LTemp[11] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegB xor LRegA) xor LRegD and LRegF xor LRegC and LRegG xor LRegB; + LRegE := LTemp[11] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (a xor h) xor c and e xor b and f xor a; - d := LTemp[12] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegA xor LRegH) xor LRegC and LRegE xor LRegB and LRegF xor LRegA; + LRegD := LTemp[12] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (h xor g) xor b and d xor a and e xor h; - c := LTemp[13] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegH xor LRegG) xor LRegB and LRegD xor LRegA and LRegE xor LRegH; + LRegC := LTemp[13] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (g xor f) xor a and c xor h and d xor g; - b := LTemp[14] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegG xor LRegF) xor LRegA and LRegC xor LRegH and LRegD xor LRegG; + LRegB := LTemp[14] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (f xor e) xor h and b xor g and c xor f; - a := LTemp[15] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegF xor LRegE) xor LRegH and LRegB xor LRegG and LRegC xor LRegF; + LRegA := LTemp[15] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := c and (e xor d) xor g and a xor f and b xor e; - h := LTemp[16] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegC and (LRegE xor LRegD) xor LRegG and LRegA xor LRegF and LRegB xor LRegE; + LRegH := LTemp[16] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := b and (d xor c) xor f and h xor e and a xor d; - g := LTemp[17] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegB and (LRegD xor LRegC) xor LRegF and LRegH xor LRegE and LRegA xor LRegD; + LRegG := LTemp[17] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (c xor b) xor e and g xor d and h xor c; - f := LTemp[18] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegC xor LRegB) xor LRegE and LRegG xor LRegD and LRegH xor LRegC; + LRegF := LTemp[18] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (b xor a) xor d and f xor c and g xor b; - e := LTemp[19] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegB xor LRegA) xor LRegD and LRegF xor LRegC and LRegG xor LRegB; + LRegE := LTemp[19] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (a xor h) xor c and e xor b and f xor a; - d := LTemp[20] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegA xor LRegH) xor LRegC and LRegE xor LRegB and LRegF xor LRegA; + LRegD := LTemp[20] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (h xor g) xor b and d xor a and e xor h; - c := LTemp[21] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegH xor LRegG) xor LRegB and LRegD xor LRegA and LRegE xor LRegH; + LRegC := LTemp[21] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (g xor f) xor a and c xor h and d xor g; - b := LTemp[22] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegG xor LRegF) xor LRegA and LRegC xor LRegH and LRegD xor LRegG; + LRegB := LTemp[22] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (f xor e) xor h and b xor g and c xor f; - a := LTemp[23] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegF xor LRegE) xor LRegH and LRegB xor LRegG and LRegC xor LRegF; + LRegA := LTemp[23] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := c and (e xor d) xor g and a xor f and b xor e; - h := LTemp[24] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegC and (LRegE xor LRegD) xor LRegG and LRegA xor LRegF and LRegB xor LRegE; + LRegH := LTemp[24] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := b and (d xor c) xor f and h xor e and a xor d; - g := LTemp[25] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegB and (LRegD xor LRegC) xor LRegF and LRegH xor LRegE and LRegA xor LRegD; + LRegG := LTemp[25] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (c xor b) xor e and g xor d and h xor c; - f := LTemp[26] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegC xor LRegB) xor LRegE and LRegG xor LRegD and LRegH xor LRegC; + LRegF := LTemp[26] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (b xor a) xor d and f xor c and g xor b; - e := LTemp[27] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegB xor LRegA) xor LRegD and LRegF xor LRegC and LRegG xor LRegB; + LRegE := LTemp[27] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (a xor h) xor c and e xor b and f xor a; - d := LTemp[28] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegA xor LRegH) xor LRegC and LRegE xor LRegB and LRegF xor LRegA; + LRegD := LTemp[28] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (h xor g) xor b and d xor a and e xor h; - c := LTemp[29] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegH xor LRegG) xor LRegB and LRegD xor LRegA and LRegE xor LRegH; + LRegC := LTemp[29] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (g xor f) xor a and c xor h and d xor g; - b := LTemp[30] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegG xor LRegF) xor LRegA and LRegC xor LRegH and LRegD xor LRegG; + LRegB := LTemp[30] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (f xor e) xor h and b xor g and c xor f; - a := LTemp[31] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegF xor LRegE) xor LRegH and LRegB xor LRegG and LRegC xor LRegF; + LRegA := LTemp[31] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := f and (d and not a xor b and c xor e xor g) xor b and (d xor c) - xor a and c xor g; - h := LTemp[5] + $452821E6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); + LNfOut := LRegF and (LRegD and not LRegA xor LRegB and LRegC xor LRegE xor LRegG) xor LRegB and (LRegD xor LRegC) + xor LRegA and LRegC xor LRegG; + LRegH := LTemp[5] + $452821E6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); - t := e and (c and not h xor a and b xor d xor f) xor a and (c xor b) - xor h and b xor f; - g := LTemp[14] + $38D01377 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); + LNfOut := LRegE and (LRegC and not LRegH xor LRegA and LRegB xor LRegD xor LRegF) xor LRegA and (LRegC xor LRegB) + xor LRegH and LRegB xor LRegF; + LRegG := LTemp[14] + $38D01377 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); - t := d and (b and not g xor h and a xor c xor e) xor h and (b xor a) - xor g and a xor e; - f := LTemp[26] + $BE5466CF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); + LNfOut := LRegD and (LRegB and not LRegG xor LRegH and LRegA xor LRegC xor LRegE) xor LRegH and (LRegB xor LRegA) + xor LRegG and LRegA xor LRegE; + LRegF := LTemp[26] + $BE5466CF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); - t := c and (a and not f xor g and h xor b xor d) xor g and (a xor h) - xor f and h xor d; - e := LTemp[18] + $34E90C6C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); + LNfOut := LRegC and (LRegA and not LRegF xor LRegG and LRegH xor LRegB xor LRegD) xor LRegG and (LRegA xor LRegH) + xor LRegF and LRegH xor LRegD; + LRegE := LTemp[18] + $34E90C6C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); - t := b and (h and not e xor f and g xor a xor c) xor f and (h xor g) - xor e and g xor c; - d := LTemp[11] + $C0AC29B7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); + LNfOut := LRegB and (LRegH and not LRegE xor LRegF and LRegG xor LRegA xor LRegC) xor LRegF and (LRegH xor LRegG) + xor LRegE and LRegG xor LRegC; + LRegD := LTemp[11] + $C0AC29B7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); - t := a and (g and not d xor e and f xor h xor b) xor e and (g xor f) - xor d and f xor b; - c := LTemp[28] + $C97C50DD + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); + LNfOut := LRegA and (LRegG and not LRegD xor LRegE and LRegF xor LRegH xor LRegB) xor LRegE and (LRegG xor LRegF) + xor LRegD and LRegF xor LRegB; + LRegC := LTemp[28] + $C97C50DD + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); - t := h and (f and not c xor d and e xor g xor a) xor d and (f xor e) - xor c and e xor a; - b := LTemp[7] + $3F84D5B5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := g and (e and not b xor c and d xor f xor h) xor c and (e xor d) - xor b and d xor h; - a := LTemp[16] + $B5470917 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := f and (d and not a xor b and c xor e xor g) xor b and (d xor c) - xor a and c xor g; - h := LTemp[0] + $9216D5D9 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := e and (c and not h xor a and b xor d xor f) xor a and (c xor b) - xor h and b xor f; - g := LTemp[23] + $8979FB1B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := d and (b and not g xor h and a xor c xor e) xor h and (b xor a) - xor g and a xor e; - f := LTemp[20] + $D1310BA6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := c and (a and not f xor g and h xor b xor d) xor g and (a xor h) - xor f and h xor d; - e := LTemp[22] + $98DFB5AC + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := b and (h and not e xor f and g xor a xor c) xor f and (h xor g) - xor e and g xor c; - d := LTemp[1] + $2FFD72DB + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := a and (g and not d xor e and f xor h xor b) xor e and (g xor f) - xor d and f xor b; - c := LTemp[10] + $D01ADFB7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := h and (f and not c xor d and e xor g xor a) xor d and (f xor e) - xor c and e xor a; - b := LTemp[4] + $B8E1AFED + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := g and (e and not b xor c and d xor f xor h) xor c and (e xor d) - xor b and d xor h; - a := LTemp[8] + $6A267E96 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := f and (d and not a xor b and c xor e xor g) xor b and (d xor c) - xor a and c xor g; - h := LTemp[30] + $BA7C9045 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := e and (c and not h xor a and b xor d xor f) xor a and (c xor b) - xor h and b xor f; - g := LTemp[3] + $F12C7F99 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := d and (b and not g xor h and a xor c xor e) xor h and (b xor a) - xor g and a xor e; - f := LTemp[21] + $24A19947 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := c and (a and not f xor g and h xor b xor d) xor g and (a xor h) - xor f and h xor d; - e := LTemp[9] + $B3916CF7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := b and (h and not e xor f and g xor a xor c) xor f and (h xor g) - xor e and g xor c; - d := LTemp[17] + $0801F2E2 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := a and (g and not d xor e and f xor h xor b) xor e and (g xor f) - xor d and f xor b; - c := LTemp[24] + $858EFC16 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := h and (f and not c xor d and e xor g xor a) xor d and (f xor e) - xor c and e xor a; - b := LTemp[29] + $636920D8 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := g and (e and not b xor c and d xor f xor h) xor c and (e xor d) - xor b and d xor h; - a := LTemp[6] + $71574E69 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := f and (d and not a xor b and c xor e xor g) xor b and (d xor c) - xor a and c xor g; - h := LTemp[19] + $A458FEA3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := e and (c and not h xor a and b xor d xor f) xor a and (c xor b) - xor h and b xor f; - g := LTemp[12] + $F4933D7E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := d and (b and not g xor h and a xor c xor e) xor h and (b xor a) - xor g and a xor e; - f := LTemp[15] + $0D95748F + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := c and (a and not f xor g and h xor b xor d) xor g and (a xor h) - xor f and h xor d; - e := LTemp[13] + $728EB658 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := b and (h and not e xor f and g xor a xor c) xor f and (h xor g) - xor e and g xor c; - d := LTemp[2] + $718BCD58 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := a and (g and not d xor e and f xor h xor b) xor e and (g xor f) - xor d and f xor b; - c := LTemp[25] + $82154AEE + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := h and (f and not c xor d and e xor g xor a) xor d and (f xor e) - xor c and e xor a; - b := LTemp[31] + $7B54A41D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := g and (e and not b xor c and d xor f xor h) xor c and (e xor d) - xor b and d xor h; - a := LTemp[27] + $C25A59B5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and e xor g xor a) xor f and c xor e and b xor a; - h := LTemp[19] + $9C30D539 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (e and d xor f xor h) xor e and b xor d and a xor h; - g := LTemp[9] + $2AF26013 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (d and c xor e xor g) xor d and a xor c and h xor g; - f := LTemp[4] + $C5D1B023 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (c and b xor d xor f) xor c and h xor b and g xor f; - e := LTemp[20] + $286085F0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (b and a xor c xor e) xor b and g xor a and f xor e; - d := LTemp[28] + $CA417918 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (a and h xor b xor d) xor a and f xor h and e xor d; - c := LTemp[17] + $B8DB38EF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (h and g xor a xor c) xor h and e xor g and d xor c; - b := LTemp[8] + $8E79DCB0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (g and f xor h xor b) xor g and d xor f and c xor b; - a := LTemp[22] + $603A180E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and e xor g xor a) xor f and c xor e and b xor a; - h := LTemp[29] + $6C9E0E8B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (e and d xor f xor h) xor e and b xor d and a xor h; - g := LTemp[14] + $B01E8A3E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (d and c xor e xor g) xor d and a xor c and h xor g; - f := LTemp[25] + $D71577C1 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (c and b xor d xor f) xor c and h xor b and g xor f; - e := LTemp[12] + $BD314B27 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (b and a xor c xor e) xor b and g xor a and f xor e; - d := LTemp[24] + $78AF2FDA + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (a and h xor b xor d) xor a and f xor h and e xor d; - c := LTemp[30] + $55605C60 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (h and g xor a xor c) xor h and e xor g and d xor c; - b := LTemp[16] + $E65525F3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (g and f xor h xor b) xor g and d xor f and c xor b; - a := LTemp[26] + $AA55AB94 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and e xor g xor a) xor f and c xor e and b xor a; - h := LTemp[31] + $57489862 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (e and d xor f xor h) xor e and b xor d and a xor h; - g := LTemp[15] + $63E81440 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (d and c xor e xor g) xor d and a xor c and h xor g; - f := LTemp[7] + $55CA396A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (c and b xor d xor f) xor c and h xor b and g xor f; - e := LTemp[3] + $2AAB10B6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (b and a xor c xor e) xor b and g xor a and f xor e; - d := LTemp[1] + $B4CC5C34 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (a and h xor b xor d) xor a and f xor h and e xor d; - c := LTemp[0] + $1141E8CE + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (h and g xor a xor c) xor h and e xor g and d xor c; - b := LTemp[18] + $A15486AF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (g and f xor h xor b) xor g and d xor f and c xor b; - a := LTemp[27] + $7C72E993 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and e xor g xor a) xor f and c xor e and b xor a; - h := LTemp[13] + $B3EE1411 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); + LNfOut := LRegH and (LRegF and not LRegC xor LRegD and LRegE xor LRegG xor LRegA) xor LRegD and (LRegF xor LRegE) + xor LRegC and LRegE xor LRegA; + LRegB := LTemp[7] + $3F84D5B5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegG and (LRegE and not LRegB xor LRegC and LRegD xor LRegF xor LRegH) xor LRegC and (LRegE xor LRegD) + xor LRegB and LRegD xor LRegH; + LRegA := LTemp[16] + $B5470917 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegF and (LRegD and not LRegA xor LRegB and LRegC xor LRegE xor LRegG) xor LRegB and (LRegD xor LRegC) + xor LRegA and LRegC xor LRegG; + LRegH := LTemp[0] + $9216D5D9 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegE and (LRegC and not LRegH xor LRegA and LRegB xor LRegD xor LRegF) xor LRegA and (LRegC xor LRegB) + xor LRegH and LRegB xor LRegF; + LRegG := LTemp[23] + $8979FB1B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegD and (LRegB and not LRegG xor LRegH and LRegA xor LRegC xor LRegE) xor LRegH and (LRegB xor LRegA) + xor LRegG and LRegA xor LRegE; + LRegF := LTemp[20] + $D1310BA6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegC and (LRegA and not LRegF xor LRegG and LRegH xor LRegB xor LRegD) xor LRegG and (LRegA xor LRegH) + xor LRegF and LRegH xor LRegD; + LRegE := LTemp[22] + $98DFB5AC + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegB and (LRegH and not LRegE xor LRegF and LRegG xor LRegA xor LRegC) xor LRegF and (LRegH xor LRegG) + xor LRegE and LRegG xor LRegC; + LRegD := LTemp[1] + $2FFD72DB + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegA and (LRegG and not LRegD xor LRegE and LRegF xor LRegH xor LRegB) xor LRegE and (LRegG xor LRegF) + xor LRegD and LRegF xor LRegB; + LRegC := LTemp[10] + $D01ADFB7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegH and (LRegF and not LRegC xor LRegD and LRegE xor LRegG xor LRegA) xor LRegD and (LRegF xor LRegE) + xor LRegC and LRegE xor LRegA; + LRegB := LTemp[4] + $B8E1AFED + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegG and (LRegE and not LRegB xor LRegC and LRegD xor LRegF xor LRegH) xor LRegC and (LRegE xor LRegD) + xor LRegB and LRegD xor LRegH; + LRegA := LTemp[8] + $6A267E96 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegF and (LRegD and not LRegA xor LRegB and LRegC xor LRegE xor LRegG) xor LRegB and (LRegD xor LRegC) + xor LRegA and LRegC xor LRegG; + LRegH := LTemp[30] + $BA7C9045 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegE and (LRegC and not LRegH xor LRegA and LRegB xor LRegD xor LRegF) xor LRegA and (LRegC xor LRegB) + xor LRegH and LRegB xor LRegF; + LRegG := LTemp[3] + $F12C7F99 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegD and (LRegB and not LRegG xor LRegH and LRegA xor LRegC xor LRegE) xor LRegH and (LRegB xor LRegA) + xor LRegG and LRegA xor LRegE; + LRegF := LTemp[21] + $24A19947 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegC and (LRegA and not LRegF xor LRegG and LRegH xor LRegB xor LRegD) xor LRegG and (LRegA xor LRegH) + xor LRegF and LRegH xor LRegD; + LRegE := LTemp[9] + $B3916CF7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegB and (LRegH and not LRegE xor LRegF and LRegG xor LRegA xor LRegC) xor LRegF and (LRegH xor LRegG) + xor LRegE and LRegG xor LRegC; + LRegD := LTemp[17] + $0801F2E2 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegA and (LRegG and not LRegD xor LRegE and LRegF xor LRegH xor LRegB) xor LRegE and (LRegG xor LRegF) + xor LRegD and LRegF xor LRegB; + LRegC := LTemp[24] + $858EFC16 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegH and (LRegF and not LRegC xor LRegD and LRegE xor LRegG xor LRegA) xor LRegD and (LRegF xor LRegE) + xor LRegC and LRegE xor LRegA; + LRegB := LTemp[29] + $636920D8 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegG and (LRegE and not LRegB xor LRegC and LRegD xor LRegF xor LRegH) xor LRegC and (LRegE xor LRegD) + xor LRegB and LRegD xor LRegH; + LRegA := LTemp[6] + $71574E69 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegF and (LRegD and not LRegA xor LRegB and LRegC xor LRegE xor LRegG) xor LRegB and (LRegD xor LRegC) + xor LRegA and LRegC xor LRegG; + LRegH := LTemp[19] + $A458FEA3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegE and (LRegC and not LRegH xor LRegA and LRegB xor LRegD xor LRegF) xor LRegA and (LRegC xor LRegB) + xor LRegH and LRegB xor LRegF; + LRegG := LTemp[12] + $F4933D7E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegD and (LRegB and not LRegG xor LRegH and LRegA xor LRegC xor LRegE) xor LRegH and (LRegB xor LRegA) + xor LRegG and LRegA xor LRegE; + LRegF := LTemp[15] + $0D95748F + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegC and (LRegA and not LRegF xor LRegG and LRegH xor LRegB xor LRegD) xor LRegG and (LRegA xor LRegH) + xor LRegF and LRegH xor LRegD; + LRegE := LTemp[13] + $728EB658 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegB and (LRegH and not LRegE xor LRegF and LRegG xor LRegA xor LRegC) xor LRegF and (LRegH xor LRegG) + xor LRegE and LRegG xor LRegC; + LRegD := LTemp[2] + $718BCD58 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegA and (LRegG and not LRegD xor LRegE and LRegF xor LRegH xor LRegB) xor LRegE and (LRegG xor LRegF) + xor LRegD and LRegF xor LRegB; + LRegC := LTemp[25] + $82154AEE + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegH and (LRegF and not LRegC xor LRegD and LRegE xor LRegG xor LRegA) xor LRegD and (LRegF xor LRegE) + xor LRegC and LRegE xor LRegA; + LRegB := LTemp[31] + $7B54A41D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegG and (LRegE and not LRegB xor LRegC and LRegD xor LRegF xor LRegH) xor LRegC and (LRegE xor LRegD) + xor LRegB and LRegD xor LRegH; + LRegA := LTemp[27] + $C25A59B5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and LRegE xor LRegG xor LRegA) xor LRegF and LRegC xor LRegE and LRegB xor LRegA; + LRegH := LTemp[19] + $9C30D539 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegE and LRegD xor LRegF xor LRegH) xor LRegE and LRegB xor LRegD and LRegA xor LRegH; + LRegG := LTemp[9] + $2AF26013 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegD and LRegC xor LRegE xor LRegG) xor LRegD and LRegA xor LRegC and LRegH xor LRegG; + LRegF := LTemp[4] + $C5D1B023 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegC and LRegB xor LRegD xor LRegF) xor LRegC and LRegH xor LRegB and LRegG xor LRegF; + LRegE := LTemp[20] + $286085F0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegB and LRegA xor LRegC xor LRegE) xor LRegB and LRegG xor LRegA and LRegF xor LRegE; + LRegD := LTemp[28] + $CA417918 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegA and LRegH xor LRegB xor LRegD) xor LRegA and LRegF xor LRegH and LRegE xor LRegD; + LRegC := LTemp[17] + $B8DB38EF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegH and LRegG xor LRegA xor LRegC) xor LRegH and LRegE xor LRegG and LRegD xor LRegC; + LRegB := LTemp[8] + $8E79DCB0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegG and LRegF xor LRegH xor LRegB) xor LRegG and LRegD xor LRegF and LRegC xor LRegB; + LRegA := LTemp[22] + $603A180E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and LRegE xor LRegG xor LRegA) xor LRegF and LRegC xor LRegE and LRegB xor LRegA; + LRegH := LTemp[29] + $6C9E0E8B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegE and LRegD xor LRegF xor LRegH) xor LRegE and LRegB xor LRegD and LRegA xor LRegH; + LRegG := LTemp[14] + $B01E8A3E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegD and LRegC xor LRegE xor LRegG) xor LRegD and LRegA xor LRegC and LRegH xor LRegG; + LRegF := LTemp[25] + $D71577C1 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegC and LRegB xor LRegD xor LRegF) xor LRegC and LRegH xor LRegB and LRegG xor LRegF; + LRegE := LTemp[12] + $BD314B27 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegB and LRegA xor LRegC xor LRegE) xor LRegB and LRegG xor LRegA and LRegF xor LRegE; + LRegD := LTemp[24] + $78AF2FDA + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegA and LRegH xor LRegB xor LRegD) xor LRegA and LRegF xor LRegH and LRegE xor LRegD; + LRegC := LTemp[30] + $55605C60 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegH and LRegG xor LRegA xor LRegC) xor LRegH and LRegE xor LRegG and LRegD xor LRegC; + LRegB := LTemp[16] + $E65525F3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegG and LRegF xor LRegH xor LRegB) xor LRegG and LRegD xor LRegF and LRegC xor LRegB; + LRegA := LTemp[26] + $AA55AB94 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and LRegE xor LRegG xor LRegA) xor LRegF and LRegC xor LRegE and LRegB xor LRegA; + LRegH := LTemp[31] + $57489862 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegE and LRegD xor LRegF xor LRegH) xor LRegE and LRegB xor LRegD and LRegA xor LRegH; + LRegG := LTemp[15] + $63E81440 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegD and LRegC xor LRegE xor LRegG) xor LRegD and LRegA xor LRegC and LRegH xor LRegG; + LRegF := LTemp[7] + $55CA396A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegC and LRegB xor LRegD xor LRegF) xor LRegC and LRegH xor LRegB and LRegG xor LRegF; + LRegE := LTemp[3] + $2AAB10B6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegB and LRegA xor LRegC xor LRegE) xor LRegB and LRegG xor LRegA and LRegF xor LRegE; + LRegD := LTemp[1] + $B4CC5C34 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegA and LRegH xor LRegB xor LRegD) xor LRegA and LRegF xor LRegH and LRegE xor LRegD; + LRegC := LTemp[0] + $1141E8CE + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegH and LRegG xor LRegA xor LRegC) xor LRegH and LRegE xor LRegG and LRegD xor LRegC; + LRegB := LTemp[18] + $A15486AF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegG and LRegF xor LRegH xor LRegB) xor LRegG and LRegD xor LRegF and LRegC xor LRegB; + LRegA := LTemp[27] + $7C72E993 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and LRegE xor LRegG xor LRegA) xor LRegF and LRegC xor LRegE and LRegB xor LRegA; + LRegH := LTemp[13] + $B3EE1411 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); - t := c and (e and d xor f xor h) xor e and b xor d and a xor h; - g := LTemp[6] + $636FBC2A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); + LNfOut := LRegC and (LRegE and LRegD xor LRegF xor LRegH) xor LRegE and LRegB xor LRegD and LRegA xor LRegH; + LRegG := LTemp[6] + $636FBC2A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); - t := b and (d and c xor e xor g) xor d and a xor c and h xor g; - f := LTemp[21] + $2BA9C55D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); + LNfOut := LRegB and (LRegD and LRegC xor LRegE xor LRegG) xor LRegD and LRegA xor LRegC and LRegH xor LRegG; + LRegF := LTemp[21] + $2BA9C55D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); - t := a and (c and b xor d xor f) xor c and h xor b and g xor f; - e := LTemp[10] + $741831F6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); + LNfOut := LRegA and (LRegC and LRegB xor LRegD xor LRegF) xor LRegC and LRegH xor LRegB and LRegG xor LRegF; + LRegE := LTemp[10] + $741831F6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); - t := h and (b and a xor c xor e) xor b and g xor a and f xor e; - d := LTemp[23] + $CE5C3E16 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); + LNfOut := LRegH and (LRegB and LRegA xor LRegC xor LRegE) xor LRegB and LRegG xor LRegA and LRegF xor LRegE; + LRegD := LTemp[23] + $CE5C3E16 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); - t := g and (a and h xor b xor d) xor a and f xor h and e xor d; - c := LTemp[11] + $9B87931E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); + LNfOut := LRegG and (LRegA and LRegH xor LRegB xor LRegD) xor LRegA and LRegF xor LRegH and LRegE xor LRegD; + LRegC := LTemp[11] + $9B87931E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); - t := f and (h and g xor a xor c) xor h and e xor g and d xor c; - b := LTemp[5] + $AFD6BA33 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); + LNfOut := LRegF and (LRegH and LRegG xor LRegA xor LRegC) xor LRegH and LRegE xor LRegG and LRegD xor LRegC; + LRegB := LTemp[5] + $AFD6BA33 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); - t := e and (g and f xor h xor b) xor g and d xor f and c xor b; - a := LTemp[2] + $6C24CF5C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); + LNfOut := LRegE and (LRegG and LRegF xor LRegH xor LRegB) xor LRegG and LRegD xor LRegF and LRegC xor LRegB; + LRegA := LTemp[2] + $6C24CF5C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); - FHash[0] := FHash[0] + a; - FHash[1] := FHash[1] + b; - FHash[2] := FHash[2] + c; - FHash[3] := FHash[3] + d; - FHash[4] := FHash[4] + e; - FHash[5] := FHash[5] + f; - FHash[6] := FHash[6] + g; - FHash[7] := FHash[7] + h; + FHash[0] := FHash[0] + LRegA; + FHash[1] := FHash[1] + LRegB; + FHash[2] := FHash[2] + LRegC; + FHash[3] := FHash[3] + LRegD; + FHash[4] := FHash[4] + LRegE; + FHash[5] := FHash[5] + LRegF; + FHash[6] := FHash[6] + LRegG; + FHash[7] := FHash[7] + LRegH; System.FillChar(LTemp, System.SizeOf(LTemp), UInt32(0)); end; @@ -802,572 +802,572 @@ constructor THaval4.Create(AHashSize: THashSize); procedure THaval4.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, e, f, g, h, t: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegE, LRegF, LRegG, LRegH, LNfOut: UInt32; LTemp: array [0 .. 31] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LTemp[0]), 0, ADataLength); - a := FHash[0]; - b := FHash[1]; - c := FHash[2]; - d := FHash[3]; - e := FHash[4]; - f := FHash[5]; - g := FHash[6]; - h := FHash[7]; + LRegA := FHash[0]; + LRegB := FHash[1]; + LRegC := FHash[2]; + LRegD := FHash[3]; + LRegE := FHash[4]; + LRegF := FHash[5]; + LRegG := FHash[6]; + LRegH := FHash[7]; - t := d and (a xor b) xor f and g xor e and c xor a; - h := LTemp[0] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegD and (LRegA xor LRegB) xor LRegF and LRegG xor LRegE and LRegC xor LRegA; + LRegH := LTemp[0] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := c and (h xor a) xor e and f xor d and b xor h; - g := LTemp[1] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegC and (LRegH xor LRegA) xor LRegE and LRegF xor LRegD and LRegB xor LRegH; + LRegG := LTemp[1] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := b and (g xor h) xor d and e xor c and a xor g; - f := LTemp[2] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegB and (LRegG xor LRegH) xor LRegD and LRegE xor LRegC and LRegA xor LRegG; + LRegF := LTemp[2] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := a and (f xor g) xor c and d xor b and h xor f; - e := LTemp[3] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegA and (LRegF xor LRegG) xor LRegC and LRegD xor LRegB and LRegH xor LRegF; + LRegE := LTemp[3] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := h and (e xor f) xor b and c xor a and g xor e; - d := LTemp[4] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegH and (LRegE xor LRegF) xor LRegB and LRegC xor LRegA and LRegG xor LRegE; + LRegD := LTemp[4] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := g and (d xor e) xor a and b xor h and f xor d; - c := LTemp[5] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegG and (LRegD xor LRegE) xor LRegA and LRegB xor LRegH and LRegF xor LRegD; + LRegC := LTemp[5] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := f and (c xor d) xor h and a xor g and e xor c; - b := LTemp[6] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegF and (LRegC xor LRegD) xor LRegH and LRegA xor LRegG and LRegE xor LRegC; + LRegB := LTemp[6] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := e and (b xor c) xor g and h xor f and d xor b; - a := LTemp[7] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegE and (LRegB xor LRegC) xor LRegG and LRegH xor LRegF and LRegD xor LRegB; + LRegA := LTemp[7] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := d and (a xor b) xor f and g xor e and c xor a; - h := LTemp[8] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegD and (LRegA xor LRegB) xor LRegF and LRegG xor LRegE and LRegC xor LRegA; + LRegH := LTemp[8] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := c and (h xor a) xor e and f xor d and b xor h; - g := LTemp[9] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegC and (LRegH xor LRegA) xor LRegE and LRegF xor LRegD and LRegB xor LRegH; + LRegG := LTemp[9] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := b and (g xor h) xor d and e xor c and a xor g; - f := LTemp[10] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegB and (LRegG xor LRegH) xor LRegD and LRegE xor LRegC and LRegA xor LRegG; + LRegF := LTemp[10] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := a and (f xor g) xor c and d xor b and h xor f; - e := LTemp[11] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegA and (LRegF xor LRegG) xor LRegC and LRegD xor LRegB and LRegH xor LRegF; + LRegE := LTemp[11] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := h and (e xor f) xor b and c xor a and g xor e; - d := LTemp[12] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegH and (LRegE xor LRegF) xor LRegB and LRegC xor LRegA and LRegG xor LRegE; + LRegD := LTemp[12] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := g and (d xor e) xor a and b xor h and f xor d; - c := LTemp[13] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegG and (LRegD xor LRegE) xor LRegA and LRegB xor LRegH and LRegF xor LRegD; + LRegC := LTemp[13] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := f and (c xor d) xor h and a xor g and e xor c; - b := LTemp[14] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegF and (LRegC xor LRegD) xor LRegH and LRegA xor LRegG and LRegE xor LRegC; + LRegB := LTemp[14] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := e and (b xor c) xor g and h xor f and d xor b; - a := LTemp[15] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegE and (LRegB xor LRegC) xor LRegG and LRegH xor LRegF and LRegD xor LRegB; + LRegA := LTemp[15] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := d and (a xor b) xor f and g xor e and c xor a; - h := LTemp[16] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegD and (LRegA xor LRegB) xor LRegF and LRegG xor LRegE and LRegC xor LRegA; + LRegH := LTemp[16] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := c and (h xor a) xor e and f xor d and b xor h; - g := LTemp[17] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegC and (LRegH xor LRegA) xor LRegE and LRegF xor LRegD and LRegB xor LRegH; + LRegG := LTemp[17] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := b and (g xor h) xor d and e xor c and a xor g; - f := LTemp[18] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegB and (LRegG xor LRegH) xor LRegD and LRegE xor LRegC and LRegA xor LRegG; + LRegF := LTemp[18] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := a and (f xor g) xor c and d xor b and h xor f; - e := LTemp[19] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegA and (LRegF xor LRegG) xor LRegC and LRegD xor LRegB and LRegH xor LRegF; + LRegE := LTemp[19] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := h and (e xor f) xor b and c xor a and g xor e; - d := LTemp[20] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegH and (LRegE xor LRegF) xor LRegB and LRegC xor LRegA and LRegG xor LRegE; + LRegD := LTemp[20] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := g and (d xor e) xor a and b xor h and f xor d; - c := LTemp[21] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegG and (LRegD xor LRegE) xor LRegA and LRegB xor LRegH and LRegF xor LRegD; + LRegC := LTemp[21] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := f and (c xor d) xor h and a xor g and e xor c; - b := LTemp[22] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegF and (LRegC xor LRegD) xor LRegH and LRegA xor LRegG and LRegE xor LRegC; + LRegB := LTemp[22] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := e and (b xor c) xor g and h xor f and d xor b; - a := LTemp[23] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegE and (LRegB xor LRegC) xor LRegG and LRegH xor LRegF and LRegD xor LRegB; + LRegA := LTemp[23] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := d and (a xor b) xor f and g xor e and c xor a; - h := LTemp[24] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegD and (LRegA xor LRegB) xor LRegF and LRegG xor LRegE and LRegC xor LRegA; + LRegH := LTemp[24] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := c and (h xor a) xor e and f xor d and b xor h; - g := LTemp[25] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegC and (LRegH xor LRegA) xor LRegE and LRegF xor LRegD and LRegB xor LRegH; + LRegG := LTemp[25] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := b and (g xor h) xor d and e xor c and a xor g; - f := LTemp[26] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegB and (LRegG xor LRegH) xor LRegD and LRegE xor LRegC and LRegA xor LRegG; + LRegF := LTemp[26] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := a and (f xor g) xor c and d xor b and h xor f; - e := LTemp[27] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegA and (LRegF xor LRegG) xor LRegC and LRegD xor LRegB and LRegH xor LRegF; + LRegE := LTemp[27] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := h and (e xor f) xor b and c xor a and g xor e; - d := LTemp[28] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegH and (LRegE xor LRegF) xor LRegB and LRegC xor LRegA and LRegG xor LRegE; + LRegD := LTemp[28] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := g and (d xor e) xor a and b xor h and f xor d; - c := LTemp[29] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegG and (LRegD xor LRegE) xor LRegA and LRegB xor LRegH and LRegF xor LRegD; + LRegC := LTemp[29] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := f and (c xor d) xor h and a xor g and e xor c; - b := LTemp[30] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegF and (LRegC xor LRegD) xor LRegH and LRegA xor LRegG and LRegE xor LRegC; + LRegB := LTemp[30] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := e and (b xor c) xor g and h xor f and d xor b; - a := LTemp[31] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegE and (LRegB xor LRegC) xor LRegG and LRegH xor LRegF and LRegD xor LRegB; + LRegA := LTemp[31] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := b and (g and not a xor c and f xor d xor e) xor c and (g xor f) - xor a and f xor e; - h := LTemp[5] + $452821E6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); + LNfOut := LRegB and (LRegG and not LRegA xor LRegC and LRegF xor LRegD xor LRegE) xor LRegC and (LRegG xor LRegF) + xor LRegA and LRegF xor LRegE; + LRegH := LTemp[5] + $452821E6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); - t := a and (f and not h xor b and e xor c xor d) xor b and (f xor e) - xor h and e xor d; - g := LTemp[14] + $38D01377 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); + LNfOut := LRegA and (LRegF and not LRegH xor LRegB and LRegE xor LRegC xor LRegD) xor LRegB and (LRegF xor LRegE) + xor LRegH and LRegE xor LRegD; + LRegG := LTemp[14] + $38D01377 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); - t := h and (e and not g xor a and d xor b xor c) xor a and (e xor d) - xor g and d xor c; - f := LTemp[26] + $BE5466CF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); + LNfOut := LRegH and (LRegE and not LRegG xor LRegA and LRegD xor LRegB xor LRegC) xor LRegA and (LRegE xor LRegD) + xor LRegG and LRegD xor LRegC; + LRegF := LTemp[26] + $BE5466CF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); - t := g and (d and not f xor h and c xor a xor b) xor h and (d xor c) - xor f and c xor b; - e := LTemp[18] + $34E90C6C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); + LNfOut := LRegG and (LRegD and not LRegF xor LRegH and LRegC xor LRegA xor LRegB) xor LRegH and (LRegD xor LRegC) + xor LRegF and LRegC xor LRegB; + LRegE := LTemp[18] + $34E90C6C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); - t := f and (c and not e xor g and b xor h xor a) xor g and (c xor b) - xor e and b xor a; - d := LTemp[11] + $C0AC29B7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); + LNfOut := LRegF and (LRegC and not LRegE xor LRegG and LRegB xor LRegH xor LRegA) xor LRegG and (LRegC xor LRegB) + xor LRegE and LRegB xor LRegA; + LRegD := LTemp[11] + $C0AC29B7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); - t := e and (b and not d xor f and a xor g xor h) xor f and (b xor a) - xor d and a xor h; - c := LTemp[28] + $C97C50DD + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); + LNfOut := LRegE and (LRegB and not LRegD xor LRegF and LRegA xor LRegG xor LRegH) xor LRegF and (LRegB xor LRegA) + xor LRegD and LRegA xor LRegH; + LRegC := LTemp[28] + $C97C50DD + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); - t := d and (a and not c xor e and h xor f xor g) xor e and (a xor h) - xor c and h xor g; - b := LTemp[7] + $3F84D5B5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := c and (h and not b xor d and g xor e xor f) xor d and (h xor g) - xor b and g xor f; - a := LTemp[16] + $B5470917 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := b and (g and not a xor c and f xor d xor e) xor c and (g xor f) - xor a and f xor e; - h := LTemp[0] + $9216D5D9 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := a and (f and not h xor b and e xor c xor d) xor b and (f xor e) - xor h and e xor d; - g := LTemp[23] + $8979FB1B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := h and (e and not g xor a and d xor b xor c) xor a and (e xor d) - xor g and d xor c; - f := LTemp[20] + $D1310BA6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := g and (d and not f xor h and c xor a xor b) xor h and (d xor c) - xor f and c xor b; - e := LTemp[22] + $98DFB5AC + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := f and (c and not e xor g and b xor h xor a) xor g and (c xor b) - xor e and b xor a; - d := LTemp[1] + $2FFD72DB + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := e and (b and not d xor f and a xor g xor h) xor f and (b xor a) - xor d and a xor h; - c := LTemp[10] + $D01ADFB7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := d and (a and not c xor e and h xor f xor g) xor e and (a xor h) - xor c and h xor g; - b := LTemp[4] + $B8E1AFED + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := c and (h and not b xor d and g xor e xor f) xor d and (h xor g) - xor b and g xor f; - a := LTemp[8] + $6A267E96 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := b and (g and not a xor c and f xor d xor e) xor c and (g xor f) - xor a and f xor e; - h := LTemp[30] + $BA7C9045 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := a and (f and not h xor b and e xor c xor d) xor b and (f xor e) - xor h and e xor d; - g := LTemp[3] + $F12C7F99 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := h and (e and not g xor a and d xor b xor c) xor a and (e xor d) - xor g and d xor c; - f := LTemp[21] + $24A19947 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := g and (d and not f xor h and c xor a xor b) xor h and (d xor c) - xor f and c xor b; - e := LTemp[9] + $B3916CF7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := f and (c and not e xor g and b xor h xor a) xor g and (c xor b) - xor e and b xor a; - d := LTemp[17] + $0801F2E2 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := e and (b and not d xor f and a xor g xor h) xor f and (b xor a) - xor d and a xor h; - c := LTemp[24] + $858EFC16 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := d and (a and not c xor e and h xor f xor g) xor e and (a xor h) - xor c and h xor g; - b := LTemp[29] + $636920D8 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := c and (h and not b xor d and g xor e xor f) xor d and (h xor g) - xor b and g xor f; - a := LTemp[6] + $71574E69 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := b and (g and not a xor c and f xor d xor e) xor c and (g xor f) - xor a and f xor e; - h := LTemp[19] + $A458FEA3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := a and (f and not h xor b and e xor c xor d) xor b and (f xor e) - xor h and e xor d; - g := LTemp[12] + $F4933D7E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := h and (e and not g xor a and d xor b xor c) xor a and (e xor d) - xor g and d xor c; - f := LTemp[15] + $0D95748F + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := g and (d and not f xor h and c xor a xor b) xor h and (d xor c) - xor f and c xor b; - e := LTemp[13] + $728EB658 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := f and (c and not e xor g and b xor h xor a) xor g and (c xor b) - xor e and b xor a; - d := LTemp[2] + $718BCD58 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := e and (b and not d xor f and a xor g xor h) xor f and (b xor a) - xor d and a xor h; - c := LTemp[25] + $82154AEE + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := d and (a and not c xor e and h xor f xor g) xor e and (a xor h) - xor c and h xor g; - b := LTemp[31] + $7B54A41D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := c and (h and not b xor d and g xor e xor f) xor d and (h xor g) - xor b and g xor f; - a := LTemp[27] + $C25A59B5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := g and (c and a xor b xor f) xor c and d xor a and e xor f; - h := LTemp[19] + $9C30D539 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := f and (b and h xor a xor e) xor b and c xor h and d xor e; - g := LTemp[9] + $2AF26013 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := e and (a and g xor h xor d) xor a and b xor g and c xor d; - f := LTemp[4] + $C5D1B023 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := d and (h and f xor g xor c) xor h and a xor f and b xor c; - e := LTemp[20] + $286085F0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := c and (g and e xor f xor b) xor g and h xor e and a xor b; - d := LTemp[28] + $CA417918 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := b and (f and d xor e xor a) xor f and g xor d and h xor a; - c := LTemp[17] + $B8DB38EF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := a and (e and c xor d xor h) xor e and f xor c and g xor h; - b := LTemp[8] + $8E79DCB0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := h and (d and b xor c xor g) xor d and e xor b and f xor g; - a := LTemp[22] + $603A180E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := g and (c and a xor b xor f) xor c and d xor a and e xor f; - h := LTemp[29] + $6C9E0E8B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := f and (b and h xor a xor e) xor b and c xor h and d xor e; - g := LTemp[14] + $B01E8A3E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := e and (a and g xor h xor d) xor a and b xor g and c xor d; - f := LTemp[25] + $D71577C1 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := d and (h and f xor g xor c) xor h and a xor f and b xor c; - e := LTemp[12] + $BD314B27 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := c and (g and e xor f xor b) xor g and h xor e and a xor b; - d := LTemp[24] + $78AF2FDA + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := b and (f and d xor e xor a) xor f and g xor d and h xor a; - c := LTemp[30] + $55605C60 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := a and (e and c xor d xor h) xor e and f xor c and g xor h; - b := LTemp[16] + $E65525F3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := h and (d and b xor c xor g) xor d and e xor b and f xor g; - a := LTemp[26] + $AA55AB94 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := g and (c and a xor b xor f) xor c and d xor a and e xor f; - h := LTemp[31] + $57489862 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := f and (b and h xor a xor e) xor b and c xor h and d xor e; - g := LTemp[15] + $63E81440 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := e and (a and g xor h xor d) xor a and b xor g and c xor d; - f := LTemp[7] + $55CA396A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := d and (h and f xor g xor c) xor h and a xor f and b xor c; - e := LTemp[3] + $2AAB10B6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := c and (g and e xor f xor b) xor g and h xor e and a xor b; - d := LTemp[1] + $B4CC5C34 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := b and (f and d xor e xor a) xor f and g xor d and h xor a; - c := LTemp[0] + $1141E8CE + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := a and (e and c xor d xor h) xor e and f xor c and g xor h; - b := LTemp[18] + $A15486AF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := h and (d and b xor c xor g) xor d and e xor b and f xor g; - a := LTemp[27] + $7C72E993 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := g and (c and a xor b xor f) xor c and d xor a and e xor f; - h := LTemp[13] + $B3EE1411 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := f and (b and h xor a xor e) xor b and c xor h and d xor e; - g := LTemp[6] + $636FBC2A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := e and (a and g xor h xor d) xor a and b xor g and c xor d; - f := LTemp[21] + $2BA9C55D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := d and (h and f xor g xor c) xor h and a xor f and b xor c; - e := LTemp[10] + $741831F6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := c and (g and e xor f xor b) xor g and h xor e and a xor b; - d := LTemp[23] + $CE5C3E16 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := b and (f and d xor e xor a) xor f and g xor d and h xor a; - c := LTemp[11] + $9B87931E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := a and (e and c xor d xor h) xor e and f xor c and g xor h; - b := LTemp[5] + $AFD6BA33 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := h and (d and b xor c xor g) xor d and e xor b and f xor g; - a := LTemp[2] + $6C24CF5C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := a and (e and not c xor f and not g xor b xor g xor d) xor f and - (b and c xor e xor g) xor c and g xor d; - h := LTemp[24] + $7A325381 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := h and (d and not b xor e and not f xor a xor f xor c) xor e and - (a and b xor d xor f) xor b and f xor c; - g := LTemp[4] + $28958677 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := g and (c and not a xor d and not e xor h xor e xor b) xor d and - (h and a xor c xor e) xor a and e xor b; - f := LTemp[0] + $3B8F4898 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := f and (b and not h xor c and not d xor g xor d xor a) xor c and - (g and h xor b xor d) xor h and d xor a; - e := LTemp[14] + $6B4BB9AF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := e and (a and not g xor b and not c xor f xor c xor h) xor b and - (f and g xor a xor c) xor g and c xor h; - d := LTemp[2] + $C4BFE81B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := d and (h and not f xor a and not b xor e xor b xor g) xor a and - (e and f xor h xor b) xor f and b xor g; - c := LTemp[7] + $66282193 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := c and (g and not e xor h and not a xor d xor a xor f) xor h and - (d and e xor g xor a) xor e and a xor f; - b := LTemp[28] + $61D809CC + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := b and (f and not d xor g and not h xor c xor h xor e) xor g and - (c and d xor f xor h) xor d and h xor e; - a := LTemp[23] + $FB21A991 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := a and (e and not c xor f and not g xor b xor g xor d) xor f and - (b and c xor e xor g) xor c and g xor d; - h := LTemp[26] + $487CAC60 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := h and (d and not b xor e and not f xor a xor f xor c) xor e and - (a and b xor d xor f) xor b and f xor c; - g := LTemp[6] + $5DEC8032 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := g and (c and not a xor d and not e xor h xor e xor b) xor d and - (h and a xor c xor e) xor a and e xor b; - f := LTemp[30] + $EF845D5D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := f and (b and not h xor c and not d xor g xor d xor a) xor c and - (g and h xor b xor d) xor h and d xor a; - e := LTemp[20] + $E98575B1 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := e and (a and not g xor b and not c xor f xor c xor h) xor b and - (f and g xor a xor c) xor g and c xor h; - d := LTemp[18] + $DC262302 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := d and (h and not f xor a and not b xor e xor b xor g) xor a and - (e and f xor h xor b) xor f and b xor g; - c := LTemp[25] + $EB651B88 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := c and (g and not e xor h and not a xor d xor a xor f) xor h and - (d and e xor g xor a) xor e and a xor f; - b := LTemp[19] + $23893E81 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := b and (f and not d xor g and not h xor c xor h xor e) xor g and - (c and d xor f xor h) xor d and h xor e; - a := LTemp[3] + $D396ACC5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := a and (e and not c xor f and not g xor b xor g xor d) xor f and - (b and c xor e xor g) xor c and g xor d; - h := LTemp[22] + $0F6D6FF3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := h and (d and not b xor e and not f xor a xor f xor c) xor e and - (a and b xor d xor f) xor b and f xor c; - g := LTemp[11] + $83F44239 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := g and (c and not a xor d and not e xor h xor e xor b) xor d and - (h and a xor c xor e) xor a and e xor b; - f := LTemp[31] + $2E0B4482 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := f and (b and not h xor c and not d xor g xor d xor a) xor c and - (g and h xor b xor d) xor h and d xor a; - e := LTemp[21] + $A4842004 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := e and (a and not g xor b and not c xor f xor c xor h) xor b and - (f and g xor a xor c) xor g and c xor h; - d := LTemp[8] + $69C8F04A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := d and (h and not f xor a and not b xor e xor b xor g) xor a and - (e and f xor h xor b) xor f and b xor g; - c := LTemp[27] + $9E1F9B5E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := c and (g and not e xor h and not a xor d xor a xor f) xor h and - (d and e xor g xor a) xor e and a xor f; - b := LTemp[12] + $21C66842 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := b and (f and not d xor g and not h xor c xor h xor e) xor g and - (c and d xor f xor h) xor d and h xor e; - a := LTemp[9] + $F6E96C9A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := a and (e and not c xor f and not g xor b xor g xor d) xor f and - (b and c xor e xor g) xor c and g xor d; - h := LTemp[1] + $670C9C61 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := h and (d and not b xor e and not f xor a xor f xor c) xor e and - (a and b xor d xor f) xor b and f xor c; - g := LTemp[29] + $ABD388F0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := g and (c and not a xor d and not e xor h xor e xor b) xor d and - (h and a xor c xor e) xor a and e xor b; - f := LTemp[5] + $6A51A0D2 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := f and (b and not h xor c and not d xor g xor d xor a) xor c and - (g and h xor b xor d) xor h and d xor a; - e := LTemp[15] + $D8542F68 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := e and (a and not g xor b and not c xor f xor c xor h) xor b and - (f and g xor a xor c) xor g and c xor h; - d := LTemp[17] + $960FA728 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := d and (h and not f xor a and not b xor e xor b xor g) xor a and - (e and f xor h xor b) xor f and b xor g; - c := LTemp[10] + $AB5133A3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := c and (g and not e xor h and not a xor d xor a xor f) xor h and - (d and e xor g xor a) xor e and a xor f; - b := LTemp[16] + $6EEF0B6C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := b and (f and not d xor g and not h xor c xor h xor e) xor g and - (c and d xor f xor h) xor d and h xor e; - a := LTemp[13] + $137A3BE4 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - FHash[0] := FHash[0] + a; - FHash[1] := FHash[1] + b; - FHash[2] := FHash[2] + c; - FHash[3] := FHash[3] + d; - FHash[4] := FHash[4] + e; - FHash[5] := FHash[5] + f; - FHash[6] := FHash[6] + g; - FHash[7] := FHash[7] + h; + LNfOut := LRegD and (LRegA and not LRegC xor LRegE and LRegH xor LRegF xor LRegG) xor LRegE and (LRegA xor LRegH) + xor LRegC and LRegH xor LRegG; + LRegB := LTemp[7] + $3F84D5B5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegC and (LRegH and not LRegB xor LRegD and LRegG xor LRegE xor LRegF) xor LRegD and (LRegH xor LRegG) + xor LRegB and LRegG xor LRegF; + LRegA := LTemp[16] + $B5470917 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegB and (LRegG and not LRegA xor LRegC and LRegF xor LRegD xor LRegE) xor LRegC and (LRegG xor LRegF) + xor LRegA and LRegF xor LRegE; + LRegH := LTemp[0] + $9216D5D9 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegA and (LRegF and not LRegH xor LRegB and LRegE xor LRegC xor LRegD) xor LRegB and (LRegF xor LRegE) + xor LRegH and LRegE xor LRegD; + LRegG := LTemp[23] + $8979FB1B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegH and (LRegE and not LRegG xor LRegA and LRegD xor LRegB xor LRegC) xor LRegA and (LRegE xor LRegD) + xor LRegG and LRegD xor LRegC; + LRegF := LTemp[20] + $D1310BA6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegG and (LRegD and not LRegF xor LRegH and LRegC xor LRegA xor LRegB) xor LRegH and (LRegD xor LRegC) + xor LRegF and LRegC xor LRegB; + LRegE := LTemp[22] + $98DFB5AC + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegF and (LRegC and not LRegE xor LRegG and LRegB xor LRegH xor LRegA) xor LRegG and (LRegC xor LRegB) + xor LRegE and LRegB xor LRegA; + LRegD := LTemp[1] + $2FFD72DB + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegE and (LRegB and not LRegD xor LRegF and LRegA xor LRegG xor LRegH) xor LRegF and (LRegB xor LRegA) + xor LRegD and LRegA xor LRegH; + LRegC := LTemp[10] + $D01ADFB7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegD and (LRegA and not LRegC xor LRegE and LRegH xor LRegF xor LRegG) xor LRegE and (LRegA xor LRegH) + xor LRegC and LRegH xor LRegG; + LRegB := LTemp[4] + $B8E1AFED + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegC and (LRegH and not LRegB xor LRegD and LRegG xor LRegE xor LRegF) xor LRegD and (LRegH xor LRegG) + xor LRegB and LRegG xor LRegF; + LRegA := LTemp[8] + $6A267E96 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegB and (LRegG and not LRegA xor LRegC and LRegF xor LRegD xor LRegE) xor LRegC and (LRegG xor LRegF) + xor LRegA and LRegF xor LRegE; + LRegH := LTemp[30] + $BA7C9045 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegA and (LRegF and not LRegH xor LRegB and LRegE xor LRegC xor LRegD) xor LRegB and (LRegF xor LRegE) + xor LRegH and LRegE xor LRegD; + LRegG := LTemp[3] + $F12C7F99 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegH and (LRegE and not LRegG xor LRegA and LRegD xor LRegB xor LRegC) xor LRegA and (LRegE xor LRegD) + xor LRegG and LRegD xor LRegC; + LRegF := LTemp[21] + $24A19947 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegG and (LRegD and not LRegF xor LRegH and LRegC xor LRegA xor LRegB) xor LRegH and (LRegD xor LRegC) + xor LRegF and LRegC xor LRegB; + LRegE := LTemp[9] + $B3916CF7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegF and (LRegC and not LRegE xor LRegG and LRegB xor LRegH xor LRegA) xor LRegG and (LRegC xor LRegB) + xor LRegE and LRegB xor LRegA; + LRegD := LTemp[17] + $0801F2E2 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegE and (LRegB and not LRegD xor LRegF and LRegA xor LRegG xor LRegH) xor LRegF and (LRegB xor LRegA) + xor LRegD and LRegA xor LRegH; + LRegC := LTemp[24] + $858EFC16 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegD and (LRegA and not LRegC xor LRegE and LRegH xor LRegF xor LRegG) xor LRegE and (LRegA xor LRegH) + xor LRegC and LRegH xor LRegG; + LRegB := LTemp[29] + $636920D8 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegC and (LRegH and not LRegB xor LRegD and LRegG xor LRegE xor LRegF) xor LRegD and (LRegH xor LRegG) + xor LRegB and LRegG xor LRegF; + LRegA := LTemp[6] + $71574E69 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegB and (LRegG and not LRegA xor LRegC and LRegF xor LRegD xor LRegE) xor LRegC and (LRegG xor LRegF) + xor LRegA and LRegF xor LRegE; + LRegH := LTemp[19] + $A458FEA3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegA and (LRegF and not LRegH xor LRegB and LRegE xor LRegC xor LRegD) xor LRegB and (LRegF xor LRegE) + xor LRegH and LRegE xor LRegD; + LRegG := LTemp[12] + $F4933D7E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegH and (LRegE and not LRegG xor LRegA and LRegD xor LRegB xor LRegC) xor LRegA and (LRegE xor LRegD) + xor LRegG and LRegD xor LRegC; + LRegF := LTemp[15] + $0D95748F + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegG and (LRegD and not LRegF xor LRegH and LRegC xor LRegA xor LRegB) xor LRegH and (LRegD xor LRegC) + xor LRegF and LRegC xor LRegB; + LRegE := LTemp[13] + $728EB658 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegF and (LRegC and not LRegE xor LRegG and LRegB xor LRegH xor LRegA) xor LRegG and (LRegC xor LRegB) + xor LRegE and LRegB xor LRegA; + LRegD := LTemp[2] + $718BCD58 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegE and (LRegB and not LRegD xor LRegF and LRegA xor LRegG xor LRegH) xor LRegF and (LRegB xor LRegA) + xor LRegD and LRegA xor LRegH; + LRegC := LTemp[25] + $82154AEE + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegD and (LRegA and not LRegC xor LRegE and LRegH xor LRegF xor LRegG) xor LRegE and (LRegA xor LRegH) + xor LRegC and LRegH xor LRegG; + LRegB := LTemp[31] + $7B54A41D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegC and (LRegH and not LRegB xor LRegD and LRegG xor LRegE xor LRegF) xor LRegD and (LRegH xor LRegG) + xor LRegB and LRegG xor LRegF; + LRegA := LTemp[27] + $C25A59B5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegG and (LRegC and LRegA xor LRegB xor LRegF) xor LRegC and LRegD xor LRegA and LRegE xor LRegF; + LRegH := LTemp[19] + $9C30D539 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegF and (LRegB and LRegH xor LRegA xor LRegE) xor LRegB and LRegC xor LRegH and LRegD xor LRegE; + LRegG := LTemp[9] + $2AF26013 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegE and (LRegA and LRegG xor LRegH xor LRegD) xor LRegA and LRegB xor LRegG and LRegC xor LRegD; + LRegF := LTemp[4] + $C5D1B023 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegD and (LRegH and LRegF xor LRegG xor LRegC) xor LRegH and LRegA xor LRegF and LRegB xor LRegC; + LRegE := LTemp[20] + $286085F0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegC and (LRegG and LRegE xor LRegF xor LRegB) xor LRegG and LRegH xor LRegE and LRegA xor LRegB; + LRegD := LTemp[28] + $CA417918 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegB and (LRegF and LRegD xor LRegE xor LRegA) xor LRegF and LRegG xor LRegD and LRegH xor LRegA; + LRegC := LTemp[17] + $B8DB38EF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegA and (LRegE and LRegC xor LRegD xor LRegH) xor LRegE and LRegF xor LRegC and LRegG xor LRegH; + LRegB := LTemp[8] + $8E79DCB0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegH and (LRegD and LRegB xor LRegC xor LRegG) xor LRegD and LRegE xor LRegB and LRegF xor LRegG; + LRegA := LTemp[22] + $603A180E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegG and (LRegC and LRegA xor LRegB xor LRegF) xor LRegC and LRegD xor LRegA and LRegE xor LRegF; + LRegH := LTemp[29] + $6C9E0E8B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegF and (LRegB and LRegH xor LRegA xor LRegE) xor LRegB and LRegC xor LRegH and LRegD xor LRegE; + LRegG := LTemp[14] + $B01E8A3E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegE and (LRegA and LRegG xor LRegH xor LRegD) xor LRegA and LRegB xor LRegG and LRegC xor LRegD; + LRegF := LTemp[25] + $D71577C1 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegD and (LRegH and LRegF xor LRegG xor LRegC) xor LRegH and LRegA xor LRegF and LRegB xor LRegC; + LRegE := LTemp[12] + $BD314B27 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegC and (LRegG and LRegE xor LRegF xor LRegB) xor LRegG and LRegH xor LRegE and LRegA xor LRegB; + LRegD := LTemp[24] + $78AF2FDA + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegB and (LRegF and LRegD xor LRegE xor LRegA) xor LRegF and LRegG xor LRegD and LRegH xor LRegA; + LRegC := LTemp[30] + $55605C60 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegA and (LRegE and LRegC xor LRegD xor LRegH) xor LRegE and LRegF xor LRegC and LRegG xor LRegH; + LRegB := LTemp[16] + $E65525F3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegH and (LRegD and LRegB xor LRegC xor LRegG) xor LRegD and LRegE xor LRegB and LRegF xor LRegG; + LRegA := LTemp[26] + $AA55AB94 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegG and (LRegC and LRegA xor LRegB xor LRegF) xor LRegC and LRegD xor LRegA and LRegE xor LRegF; + LRegH := LTemp[31] + $57489862 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegF and (LRegB and LRegH xor LRegA xor LRegE) xor LRegB and LRegC xor LRegH and LRegD xor LRegE; + LRegG := LTemp[15] + $63E81440 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegE and (LRegA and LRegG xor LRegH xor LRegD) xor LRegA and LRegB xor LRegG and LRegC xor LRegD; + LRegF := LTemp[7] + $55CA396A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegD and (LRegH and LRegF xor LRegG xor LRegC) xor LRegH and LRegA xor LRegF and LRegB xor LRegC; + LRegE := LTemp[3] + $2AAB10B6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegC and (LRegG and LRegE xor LRegF xor LRegB) xor LRegG and LRegH xor LRegE and LRegA xor LRegB; + LRegD := LTemp[1] + $B4CC5C34 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegB and (LRegF and LRegD xor LRegE xor LRegA) xor LRegF and LRegG xor LRegD and LRegH xor LRegA; + LRegC := LTemp[0] + $1141E8CE + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegA and (LRegE and LRegC xor LRegD xor LRegH) xor LRegE and LRegF xor LRegC and LRegG xor LRegH; + LRegB := LTemp[18] + $A15486AF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegH and (LRegD and LRegB xor LRegC xor LRegG) xor LRegD and LRegE xor LRegB and LRegF xor LRegG; + LRegA := LTemp[27] + $7C72E993 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegG and (LRegC and LRegA xor LRegB xor LRegF) xor LRegC and LRegD xor LRegA and LRegE xor LRegF; + LRegH := LTemp[13] + $B3EE1411 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegF and (LRegB and LRegH xor LRegA xor LRegE) xor LRegB and LRegC xor LRegH and LRegD xor LRegE; + LRegG := LTemp[6] + $636FBC2A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegE and (LRegA and LRegG xor LRegH xor LRegD) xor LRegA and LRegB xor LRegG and LRegC xor LRegD; + LRegF := LTemp[21] + $2BA9C55D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegD and (LRegH and LRegF xor LRegG xor LRegC) xor LRegH and LRegA xor LRegF and LRegB xor LRegC; + LRegE := LTemp[10] + $741831F6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegC and (LRegG and LRegE xor LRegF xor LRegB) xor LRegG and LRegH xor LRegE and LRegA xor LRegB; + LRegD := LTemp[23] + $CE5C3E16 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegB and (LRegF and LRegD xor LRegE xor LRegA) xor LRegF and LRegG xor LRegD and LRegH xor LRegA; + LRegC := LTemp[11] + $9B87931E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegA and (LRegE and LRegC xor LRegD xor LRegH) xor LRegE and LRegF xor LRegC and LRegG xor LRegH; + LRegB := LTemp[5] + $AFD6BA33 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegH and (LRegD and LRegB xor LRegC xor LRegG) xor LRegD and LRegE xor LRegB and LRegF xor LRegG; + LRegA := LTemp[2] + $6C24CF5C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegA and (LRegE and not LRegC xor LRegF and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegF and + (LRegB and LRegC xor LRegE xor LRegG) xor LRegC and LRegG xor LRegD; + LRegH := LTemp[24] + $7A325381 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegH and (LRegD and not LRegB xor LRegE and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegE and + (LRegA and LRegB xor LRegD xor LRegF) xor LRegB and LRegF xor LRegC; + LRegG := LTemp[4] + $28958677 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegG and (LRegC and not LRegA xor LRegD and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegD and + (LRegH and LRegA xor LRegC xor LRegE) xor LRegA and LRegE xor LRegB; + LRegF := LTemp[0] + $3B8F4898 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegF and (LRegB and not LRegH xor LRegC and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegC and + (LRegG and LRegH xor LRegB xor LRegD) xor LRegH and LRegD xor LRegA; + LRegE := LTemp[14] + $6B4BB9AF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegE and (LRegA and not LRegG xor LRegB and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegB and + (LRegF and LRegG xor LRegA xor LRegC) xor LRegG and LRegC xor LRegH; + LRegD := LTemp[2] + $C4BFE81B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegD and (LRegH and not LRegF xor LRegA and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegA and + (LRegE and LRegF xor LRegH xor LRegB) xor LRegF and LRegB xor LRegG; + LRegC := LTemp[7] + $66282193 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegC and (LRegG and not LRegE xor LRegH and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegH and + (LRegD and LRegE xor LRegG xor LRegA) xor LRegE and LRegA xor LRegF; + LRegB := LTemp[28] + $61D809CC + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegB and (LRegF and not LRegD xor LRegG and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegG and + (LRegC and LRegD xor LRegF xor LRegH) xor LRegD and LRegH xor LRegE; + LRegA := LTemp[23] + $FB21A991 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegA and (LRegE and not LRegC xor LRegF and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegF and + (LRegB and LRegC xor LRegE xor LRegG) xor LRegC and LRegG xor LRegD; + LRegH := LTemp[26] + $487CAC60 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegH and (LRegD and not LRegB xor LRegE and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegE and + (LRegA and LRegB xor LRegD xor LRegF) xor LRegB and LRegF xor LRegC; + LRegG := LTemp[6] + $5DEC8032 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegG and (LRegC and not LRegA xor LRegD and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegD and + (LRegH and LRegA xor LRegC xor LRegE) xor LRegA and LRegE xor LRegB; + LRegF := LTemp[30] + $EF845D5D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegF and (LRegB and not LRegH xor LRegC and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegC and + (LRegG and LRegH xor LRegB xor LRegD) xor LRegH and LRegD xor LRegA; + LRegE := LTemp[20] + $E98575B1 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegE and (LRegA and not LRegG xor LRegB and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegB and + (LRegF and LRegG xor LRegA xor LRegC) xor LRegG and LRegC xor LRegH; + LRegD := LTemp[18] + $DC262302 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegD and (LRegH and not LRegF xor LRegA and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegA and + (LRegE and LRegF xor LRegH xor LRegB) xor LRegF and LRegB xor LRegG; + LRegC := LTemp[25] + $EB651B88 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegC and (LRegG and not LRegE xor LRegH and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegH and + (LRegD and LRegE xor LRegG xor LRegA) xor LRegE and LRegA xor LRegF; + LRegB := LTemp[19] + $23893E81 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegB and (LRegF and not LRegD xor LRegG and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegG and + (LRegC and LRegD xor LRegF xor LRegH) xor LRegD and LRegH xor LRegE; + LRegA := LTemp[3] + $D396ACC5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegA and (LRegE and not LRegC xor LRegF and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegF and + (LRegB and LRegC xor LRegE xor LRegG) xor LRegC and LRegG xor LRegD; + LRegH := LTemp[22] + $0F6D6FF3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegH and (LRegD and not LRegB xor LRegE and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegE and + (LRegA and LRegB xor LRegD xor LRegF) xor LRegB and LRegF xor LRegC; + LRegG := LTemp[11] + $83F44239 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegG and (LRegC and not LRegA xor LRegD and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegD and + (LRegH and LRegA xor LRegC xor LRegE) xor LRegA and LRegE xor LRegB; + LRegF := LTemp[31] + $2E0B4482 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegF and (LRegB and not LRegH xor LRegC and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegC and + (LRegG and LRegH xor LRegB xor LRegD) xor LRegH and LRegD xor LRegA; + LRegE := LTemp[21] + $A4842004 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegE and (LRegA and not LRegG xor LRegB and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegB and + (LRegF and LRegG xor LRegA xor LRegC) xor LRegG and LRegC xor LRegH; + LRegD := LTemp[8] + $69C8F04A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegD and (LRegH and not LRegF xor LRegA and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegA and + (LRegE and LRegF xor LRegH xor LRegB) xor LRegF and LRegB xor LRegG; + LRegC := LTemp[27] + $9E1F9B5E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegC and (LRegG and not LRegE xor LRegH and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegH and + (LRegD and LRegE xor LRegG xor LRegA) xor LRegE and LRegA xor LRegF; + LRegB := LTemp[12] + $21C66842 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegB and (LRegF and not LRegD xor LRegG and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegG and + (LRegC and LRegD xor LRegF xor LRegH) xor LRegD and LRegH xor LRegE; + LRegA := LTemp[9] + $F6E96C9A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegA and (LRegE and not LRegC xor LRegF and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegF and + (LRegB and LRegC xor LRegE xor LRegG) xor LRegC and LRegG xor LRegD; + LRegH := LTemp[1] + $670C9C61 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegH and (LRegD and not LRegB xor LRegE and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegE and + (LRegA and LRegB xor LRegD xor LRegF) xor LRegB and LRegF xor LRegC; + LRegG := LTemp[29] + $ABD388F0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegG and (LRegC and not LRegA xor LRegD and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegD and + (LRegH and LRegA xor LRegC xor LRegE) xor LRegA and LRegE xor LRegB; + LRegF := LTemp[5] + $6A51A0D2 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegF and (LRegB and not LRegH xor LRegC and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegC and + (LRegG and LRegH xor LRegB xor LRegD) xor LRegH and LRegD xor LRegA; + LRegE := LTemp[15] + $D8542F68 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegE and (LRegA and not LRegG xor LRegB and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegB and + (LRegF and LRegG xor LRegA xor LRegC) xor LRegG and LRegC xor LRegH; + LRegD := LTemp[17] + $960FA728 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegD and (LRegH and not LRegF xor LRegA and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegA and + (LRegE and LRegF xor LRegH xor LRegB) xor LRegF and LRegB xor LRegG; + LRegC := LTemp[10] + $AB5133A3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegC and (LRegG and not LRegE xor LRegH and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegH and + (LRegD and LRegE xor LRegG xor LRegA) xor LRegE and LRegA xor LRegF; + LRegB := LTemp[16] + $6EEF0B6C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegB and (LRegF and not LRegD xor LRegG and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegG and + (LRegC and LRegD xor LRegF xor LRegH) xor LRegD and LRegH xor LRegE; + LRegA := LTemp[13] + $137A3BE4 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + FHash[0] := FHash[0] + LRegA; + FHash[1] := FHash[1] + LRegB; + FHash[2] := FHash[2] + LRegC; + FHash[3] := FHash[3] + LRegD; + FHash[4] := FHash[4] + LRegE; + FHash[5] := FHash[5] + LRegF; + FHash[6] := FHash[6] + LRegG; + FHash[7] := FHash[7] + LRegH; System.FillChar(LTemp, System.SizeOf(LTemp), UInt32(0)); end; @@ -1382,699 +1382,699 @@ constructor THaval5.Create(AHashSize: THashSize); procedure THaval5.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, e, f, g, h, t: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegE, LRegF, LRegG, LRegH, LNfOut: UInt32; LTemp: array [0 .. 31] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LTemp[0]), 0, ADataLength); - a := FHash[0]; - b := FHash[1]; - c := FHash[2]; - d := FHash[3]; - e := FHash[4]; - f := FHash[5]; - g := FHash[6]; - h := FHash[7]; + LRegA := FHash[0]; + LRegB := FHash[1]; + LRegC := FHash[2]; + LRegD := FHash[3]; + LRegE := FHash[4]; + LRegF := FHash[5]; + LRegG := FHash[6]; + LRegH := FHash[7]; - t := c and (g xor b) xor f and e xor a and d xor g; - h := LTemp[0] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); - t := b and (f xor a) xor e and d xor h and c xor f; - g := LTemp[1] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegC and (LRegG xor LRegB) xor LRegF and LRegE xor LRegA and LRegD xor LRegG; + LRegH := LTemp[0] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); + LNfOut := LRegB and (LRegF xor LRegA) xor LRegE and LRegD xor LRegH and LRegC xor LRegF; + LRegG := LTemp[1] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (e xor h) xor d and c xor g and b xor e; - f := LTemp[2] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegE xor LRegH) xor LRegD and LRegC xor LRegG and LRegB xor LRegE; + LRegF := LTemp[2] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (d xor g) xor c and b xor f and a xor d; - e := LTemp[3] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegD xor LRegG) xor LRegC and LRegB xor LRegF and LRegA xor LRegD; + LRegE := LTemp[3] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (c xor f) xor b and a xor e and h xor c; - d := LTemp[4] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegC xor LRegF) xor LRegB and LRegA xor LRegE and LRegH xor LRegC; + LRegD := LTemp[4] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (b xor e) xor a and h xor d and g xor b; - c := LTemp[5] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegB xor LRegE) xor LRegA and LRegH xor LRegD and LRegG xor LRegB; + LRegC := LTemp[5] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (a xor d) xor h and g xor c and f xor a; - b := LTemp[6] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegA xor LRegD) xor LRegH and LRegG xor LRegC and LRegF xor LRegA; + LRegB := LTemp[6] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (h xor c) xor g and f xor b and e xor h; - a := LTemp[7] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegH xor LRegC) xor LRegG and LRegF xor LRegB and LRegE xor LRegH; + LRegA := LTemp[7] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := c and (g xor b) xor f and e xor a and d xor g; - h := LTemp[8] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegC and (LRegG xor LRegB) xor LRegF and LRegE xor LRegA and LRegD xor LRegG; + LRegH := LTemp[8] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := b and (f xor a) xor e and d xor h and c xor f; - g := LTemp[9] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegB and (LRegF xor LRegA) xor LRegE and LRegD xor LRegH and LRegC xor LRegF; + LRegG := LTemp[9] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (e xor h) xor d and c xor g and b xor e; - f := LTemp[10] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegE xor LRegH) xor LRegD and LRegC xor LRegG and LRegB xor LRegE; + LRegF := LTemp[10] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (d xor g) xor c and b xor f and a xor d; - e := LTemp[11] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegD xor LRegG) xor LRegC and LRegB xor LRegF and LRegA xor LRegD; + LRegE := LTemp[11] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (c xor f) xor b and a xor e and h xor c; - d := LTemp[12] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegC xor LRegF) xor LRegB and LRegA xor LRegE and LRegH xor LRegC; + LRegD := LTemp[12] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (b xor e) xor a and h xor d and g xor b; - c := LTemp[13] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegB xor LRegE) xor LRegA and LRegH xor LRegD and LRegG xor LRegB; + LRegC := LTemp[13] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (a xor d) xor h and g xor c and f xor a; - b := LTemp[14] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegA xor LRegD) xor LRegH and LRegG xor LRegC and LRegF xor LRegA; + LRegB := LTemp[14] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (h xor c) xor g and f xor b and e xor h; - a := LTemp[15] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegH xor LRegC) xor LRegG and LRegF xor LRegB and LRegE xor LRegH; + LRegA := LTemp[15] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := c and (g xor b) xor f and e xor a and d xor g; - h := LTemp[16] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegC and (LRegG xor LRegB) xor LRegF and LRegE xor LRegA and LRegD xor LRegG; + LRegH := LTemp[16] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := b and (f xor a) xor e and d xor h and c xor f; - g := LTemp[17] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegB and (LRegF xor LRegA) xor LRegE and LRegD xor LRegH and LRegC xor LRegF; + LRegG := LTemp[17] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (e xor h) xor d and c xor g and b xor e; - f := LTemp[18] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegE xor LRegH) xor LRegD and LRegC xor LRegG and LRegB xor LRegE; + LRegF := LTemp[18] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (d xor g) xor c and b xor f and a xor d; - e := LTemp[19] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegD xor LRegG) xor LRegC and LRegB xor LRegF and LRegA xor LRegD; + LRegE := LTemp[19] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (c xor f) xor b and a xor e and h xor c; - d := LTemp[20] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegC xor LRegF) xor LRegB and LRegA xor LRegE and LRegH xor LRegC; + LRegD := LTemp[20] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (b xor e) xor a and h xor d and g xor b; - c := LTemp[21] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegB xor LRegE) xor LRegA and LRegH xor LRegD and LRegG xor LRegB; + LRegC := LTemp[21] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (a xor d) xor h and g xor c and f xor a; - b := LTemp[22] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegA xor LRegD) xor LRegH and LRegG xor LRegC and LRegF xor LRegA; + LRegB := LTemp[22] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (h xor c) xor g and f xor b and e xor h; - a := LTemp[23] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegH xor LRegC) xor LRegG and LRegF xor LRegB and LRegE xor LRegH; + LRegA := LTemp[23] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := c and (g xor b) xor f and e xor a and d xor g; - h := LTemp[24] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(h, 11); + LNfOut := LRegC and (LRegG xor LRegB) xor LRegF and LRegE xor LRegA and LRegD xor LRegG; + LRegH := LTemp[24] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegH, 11); - t := b and (f xor a) xor e and d xor h and c xor f; - g := LTemp[25] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(g, 11); + LNfOut := LRegB and (LRegF xor LRegA) xor LRegE and LRegD xor LRegH and LRegC xor LRegF; + LRegG := LTemp[25] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegG, 11); - t := a and (e xor h) xor d and c xor g and b xor e; - f := LTemp[26] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(f, 11); + LNfOut := LRegA and (LRegE xor LRegH) xor LRegD and LRegC xor LRegG and LRegB xor LRegE; + LRegF := LTemp[26] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegF, 11); - t := h and (d xor g) xor c and b xor f and a xor d; - e := LTemp[27] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(e, 11); + LNfOut := LRegH and (LRegD xor LRegG) xor LRegC and LRegB xor LRegF and LRegA xor LRegD; + LRegE := LTemp[27] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegE, 11); - t := g and (c xor f) xor b and a xor e and h xor c; - d := LTemp[28] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(d, 11); + LNfOut := LRegG and (LRegC xor LRegF) xor LRegB and LRegA xor LRegE and LRegH xor LRegC; + LRegD := LTemp[28] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegD, 11); - t := f and (b xor e) xor a and h xor d and g xor b; - c := LTemp[29] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(c, 11); + LNfOut := LRegF and (LRegB xor LRegE) xor LRegA and LRegH xor LRegD and LRegG xor LRegB; + LRegC := LTemp[29] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegC, 11); - t := e and (a xor d) xor h and g xor c and f xor a; - b := LTemp[30] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(b, 11); + LNfOut := LRegE and (LRegA xor LRegD) xor LRegH and LRegG xor LRegC and LRegF xor LRegA; + LRegB := LTemp[30] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegB, 11); - t := d and (h xor c) xor g and f xor b and e xor h; - a := LTemp[31] + TBits.RotateRight32(t, 7) + TBits.RotateRight32(a, 11); + LNfOut := LRegD and (LRegH xor LRegC) xor LRegG and LRegF xor LRegB and LRegE xor LRegH; + LRegA := LTemp[31] + TBits.RotateRight32(LNfOut, 7) + TBits.RotateRight32(LRegA, 11); - t := d and (e and not a xor b and c xor g xor f) xor b and (e xor c) - xor a and c xor f; - h := LTemp[5] + $452821E6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); + LNfOut := LRegD and (LRegE and not LRegA xor LRegB and LRegC xor LRegG xor LRegF) xor LRegB and (LRegE xor LRegC) + xor LRegA and LRegC xor LRegF; + LRegH := LTemp[5] + $452821E6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); - t := c and (d and not h xor a and b xor f xor e) xor a and (d xor b) - xor h and b xor e; - g := LTemp[14] + $38D01377 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); + LNfOut := LRegC and (LRegD and not LRegH xor LRegA and LRegB xor LRegF xor LRegE) xor LRegA and (LRegD xor LRegB) + xor LRegH and LRegB xor LRegE; + LRegG := LTemp[14] + $38D01377 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); - t := b and (c and not g xor h and a xor e xor d) xor h and (c xor a) - xor g and a xor d; - f := LTemp[26] + $BE5466CF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); + LNfOut := LRegB and (LRegC and not LRegG xor LRegH and LRegA xor LRegE xor LRegD) xor LRegH and (LRegC xor LRegA) + xor LRegG and LRegA xor LRegD; + LRegF := LTemp[26] + $BE5466CF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); - t := a and (b and not f xor g and h xor d xor c) xor g and (b xor h) - xor f and h xor c; - e := LTemp[18] + $34E90C6C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); + LNfOut := LRegA and (LRegB and not LRegF xor LRegG and LRegH xor LRegD xor LRegC) xor LRegG and (LRegB xor LRegH) + xor LRegF and LRegH xor LRegC; + LRegE := LTemp[18] + $34E90C6C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); - t := h and (a and not e xor f and g xor c xor b) xor f and (a xor g) - xor e and g xor b; - d := LTemp[11] + $C0AC29B7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); + LNfOut := LRegH and (LRegA and not LRegE xor LRegF and LRegG xor LRegC xor LRegB) xor LRegF and (LRegA xor LRegG) + xor LRegE and LRegG xor LRegB; + LRegD := LTemp[11] + $C0AC29B7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); - t := g and (h and not d xor e and f xor b xor a) xor e and (h xor f) - xor d and f xor a; - c := LTemp[28] + $C97C50DD + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); + LNfOut := LRegG and (LRegH and not LRegD xor LRegE and LRegF xor LRegB xor LRegA) xor LRegE and (LRegH xor LRegF) + xor LRegD and LRegF xor LRegA; + LRegC := LTemp[28] + $C97C50DD + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); - t := f and (g and not c xor d and e xor a xor h) xor d and (g xor e) - xor c and e xor h; - b := LTemp[7] + $3F84D5B5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (f and not b xor c and d xor h xor g) xor c and (f xor d) - xor b and d xor g; - a := LTemp[16] + $B5470917 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (e and not a xor b and c xor g xor f) xor b and (e xor c) - xor a and c xor f; - h := LTemp[0] + $9216D5D9 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (d and not h xor a and b xor f xor e) xor a and (d xor b) - xor h and b xor e; - g := LTemp[23] + $8979FB1B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (c and not g xor h and a xor e xor d) xor h and (c xor a) - xor g and a xor d; - f := LTemp[20] + $D1310BA6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (b and not f xor g and h xor d xor c) xor g and (b xor h) - xor f and h xor c; - e := LTemp[22] + $98DFB5AC + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (a and not e xor f and g xor c xor b) xor f and (a xor g) - xor e and g xor b; - d := LTemp[1] + $2FFD72DB + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (h and not d xor e and f xor b xor a) xor e and (h xor f) - xor d and f xor a; - c := LTemp[10] + $D01ADFB7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (g and not c xor d and e xor a xor h) xor d and (g xor e) - xor c and e xor h; - b := LTemp[4] + $B8E1AFED + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (f and not b xor c and d xor h xor g) xor c and (f xor d) - xor b and d xor g; - a := LTemp[8] + $6A267E96 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (e and not a xor b and c xor g xor f) xor b and (e xor c) - xor a and c xor f; - h := LTemp[30] + $BA7C9045 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (d and not h xor a and b xor f xor e) xor a and (d xor b) - xor h and b xor e; - g := LTemp[3] + $F12C7F99 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (c and not g xor h and a xor e xor d) xor h and (c xor a) - xor g and a xor d; - f := LTemp[21] + $24A19947 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (b and not f xor g and h xor d xor c) xor g and (b xor h) - xor f and h xor c; - e := LTemp[9] + $B3916CF7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (a and not e xor f and g xor c xor b) xor f and (a xor g) - xor e and g xor b; - d := LTemp[17] + $0801F2E2 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (h and not d xor e and f xor b xor a) xor e and (h xor f) - xor d and f xor a; - c := LTemp[24] + $858EFC16 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (g and not c xor d and e xor a xor h) xor d and (g xor e) - xor c and e xor h; - b := LTemp[29] + $636920D8 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (f and not b xor c and d xor h xor g) xor c and (f xor d) - xor b and d xor g; - a := LTemp[6] + $71574E69 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (e and not a xor b and c xor g xor f) xor b and (e xor c) - xor a and c xor f; - h := LTemp[19] + $A458FEA3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (d and not h xor a and b xor f xor e) xor a and (d xor b) - xor h and b xor e; - g := LTemp[12] + $F4933D7E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (c and not g xor h and a xor e xor d) xor h and (c xor a) - xor g and a xor d; - f := LTemp[15] + $0D95748F + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (b and not f xor g and h xor d xor c) xor g and (b xor h) - xor f and h xor c; - e := LTemp[13] + $728EB658 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (a and not e xor f and g xor c xor b) xor f and (a xor g) - xor e and g xor b; - d := LTemp[2] + $718BCD58 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (h and not d xor e and f xor b xor a) xor e and (h xor f) - xor d and f xor a; - c := LTemp[25] + $82154AEE + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (g and not c xor d and e xor a xor h) xor d and (g xor e) - xor c and e xor h; - b := LTemp[31] + $7B54A41D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (f and not b xor c and d xor h xor g) xor c and (f xor d) - xor b and d xor g; - a := LTemp[27] + $C25A59B5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := e and (b and d xor c xor f) xor b and a xor d and g xor f; - h := LTemp[19] + $9C30D539 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := d and (a and c xor b xor e) xor a and h xor c and f xor e; - g := LTemp[9] + $2AF26013 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := c and (h and b xor a xor d) xor h and g xor b and e xor d; - f := LTemp[4] + $C5D1B023 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := b and (g and a xor h xor c) xor g and f xor a and d xor c; - e := LTemp[20] + $286085F0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := a and (f and h xor g xor b) xor f and e xor h and c xor b; - d := LTemp[28] + $CA417918 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := h and (e and g xor f xor a) xor e and d xor g and b xor a; - c := LTemp[17] + $B8DB38EF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := g and (d and f xor e xor h) xor d and c xor f and a xor h; - b := LTemp[8] + $8E79DCB0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := f and (c and e xor d xor g) xor c and b xor e and h xor g; - a := LTemp[22] + $603A180E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := e and (b and d xor c xor f) xor b and a xor d and g xor f; - h := LTemp[29] + $6C9E0E8B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := d and (a and c xor b xor e) xor a and h xor c and f xor e; - g := LTemp[14] + $B01E8A3E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := c and (h and b xor a xor d) xor h and g xor b and e xor d; - f := LTemp[25] + $D71577C1 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := b and (g and a xor h xor c) xor g and f xor a and d xor c; - e := LTemp[12] + $BD314B27 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := a and (f and h xor g xor b) xor f and e xor h and c xor b; - d := LTemp[24] + $78AF2FDA + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := h and (e and g xor f xor a) xor e and d xor g and b xor a; - c := LTemp[30] + $55605C60 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := g and (d and f xor e xor h) xor d and c xor f and a xor h; - b := LTemp[16] + $E65525F3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := f and (c and e xor d xor g) xor c and b xor e and h xor g; - a := LTemp[26] + $AA55AB94 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := e and (b and d xor c xor f) xor b and a xor d and g xor f; - h := LTemp[31] + $57489862 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := d and (a and c xor b xor e) xor a and h xor c and f xor e; - g := LTemp[15] + $63E81440 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := c and (h and b xor a xor d) xor h and g xor b and e xor d; - f := LTemp[7] + $55CA396A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := b and (g and a xor h xor c) xor g and f xor a and d xor c; - e := LTemp[3] + $2AAB10B6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := a and (f and h xor g xor b) xor f and e xor h and c xor b; - d := LTemp[1] + $B4CC5C34 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := h and (e and g xor f xor a) xor e and d xor g and b xor a; - c := LTemp[0] + $1141E8CE + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := g and (d and f xor e xor h) xor d and c xor f and a xor h; - b := LTemp[18] + $A15486AF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := f and (c and e xor d xor g) xor c and b xor e and h xor g; - a := LTemp[27] + $7C72E993 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := e and (b and d xor c xor f) xor b and a xor d and g xor f; - h := LTemp[13] + $B3EE1411 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := d and (a and c xor b xor e) xor a and h xor c and f xor e; - g := LTemp[6] + $636FBC2A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := c and (h and b xor a xor d) xor h and g xor b and e xor d; - f := LTemp[21] + $2BA9C55D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := b and (g and a xor h xor c) xor g and f xor a and d xor c; - e := LTemp[10] + $741831F6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := a and (f and h xor g xor b) xor f and e xor h and c xor b; - d := LTemp[23] + $CE5C3E16 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := h and (e and g xor f xor a) xor e and d xor g and b xor a; - c := LTemp[11] + $9B87931E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := g and (d and f xor e xor h) xor d and c xor f and a xor h; - b := LTemp[5] + $AFD6BA33 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := f and (c and e xor d xor g) xor c and b xor e and h xor g; - a := LTemp[2] + $6C24CF5C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and not a xor c and not b xor e xor b xor g) xor c and - (e and a xor f xor b) xor a and b xor g; - h := LTemp[24] + $7A325381 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (e and not h xor b and not a xor d xor a xor f) xor b and - (d and h xor e xor a) xor h and a xor f; - g := LTemp[4] + $28958677 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (d and not g xor a and not h xor c xor h xor e) xor a and - (c and g xor d xor h) xor g and h xor e; - f := LTemp[0] + $3B8F4898 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (c and not f xor h and not g xor b xor g xor d) xor h and - (b and f xor c xor g) xor f and g xor d; - e := LTemp[14] + $6B4BB9AF + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (b and not e xor g and not f xor a xor f xor c) xor g and - (a and e xor b xor f) xor e and f xor c; - d := LTemp[2] + $C4BFE81B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (a and not d xor f and not e xor h xor e xor b) xor f and - (h and d xor a xor e) xor d and e xor b; - c := LTemp[7] + $66282193 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (h and not c xor e and not d xor g xor d xor a) xor e and - (g and c xor h xor d) xor c and d xor a; - b := LTemp[28] + $61D809CC + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (g and not b xor d and not c xor f xor c xor h) xor d and - (f and b xor g xor c) xor b and c xor h; - a := LTemp[23] + $FB21A991 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and not a xor c and not b xor e xor b xor g) xor c and - (e and a xor f xor b) xor a and b xor g; - h := LTemp[26] + $487CAC60 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (e and not h xor b and not a xor d xor a xor f) xor b and - (d and h xor e xor a) xor h and a xor f; - g := LTemp[6] + $5DEC8032 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (d and not g xor a and not h xor c xor h xor e) xor a and - (c and g xor d xor h) xor g and h xor e; - f := LTemp[30] + $EF845D5D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (c and not f xor h and not g xor b xor g xor d) xor h and - (b and f xor c xor g) xor f and g xor d; - e := LTemp[20] + $E98575B1 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (b and not e xor g and not f xor a xor f xor c) xor g and - (a and e xor b xor f) xor e and f xor c; - d := LTemp[18] + $DC262302 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (a and not d xor f and not e xor h xor e xor b) xor f and - (h and d xor a xor e) xor d and e xor b; - c := LTemp[25] + $EB651B88 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (h and not c xor e and not d xor g xor d xor a) xor e and - (g and c xor h xor d) xor c and d xor a; - b := LTemp[19] + $23893E81 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (g and not b xor d and not c xor f xor c xor h) xor d and - (f and b xor g xor c) xor b and c xor h; - a := LTemp[3] + $D396ACC5 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and not a xor c and not b xor e xor b xor g) xor c and - (e and a xor f xor b) xor a and b xor g; - h := LTemp[22] + $0F6D6FF3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (e and not h xor b and not a xor d xor a xor f) xor b and - (d and h xor e xor a) xor h and a xor f; - g := LTemp[11] + $83F44239 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (d and not g xor a and not h xor c xor h xor e) xor a and - (c and g xor d xor h) xor g and h xor e; - f := LTemp[31] + $2E0B4482 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (c and not f xor h and not g xor b xor g xor d) xor h and - (b and f xor c xor g) xor f and g xor d; - e := LTemp[21] + $A4842004 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (b and not e xor g and not f xor a xor f xor c) xor g and - (a and e xor b xor f) xor e and f xor c; - d := LTemp[8] + $69C8F04A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (a and not d xor f and not e xor h xor e xor b) xor f and - (h and d xor a xor e) xor d and e xor b; - c := LTemp[27] + $9E1F9B5E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (h and not c xor e and not d xor g xor d xor a) xor e and - (g and c xor h xor d) xor c and d xor a; - b := LTemp[12] + $21C66842 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (g and not b xor d and not c xor f xor c xor h) xor d and - (f and b xor g xor c) xor b and c xor h; - a := LTemp[9] + $F6E96C9A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := d and (f and not a xor c and not b xor e xor b xor g) xor c and - (e and a xor f xor b) xor a and b xor g; - h := LTemp[1] + $670C9C61 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := c and (e and not h xor b and not a xor d xor a xor f) xor b and - (d and h xor e xor a) xor h and a xor f; - g := LTemp[29] + $ABD388F0 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := b and (d and not g xor a and not h xor c xor h xor e) xor a and - (c and g xor d xor h) xor g and h xor e; - f := LTemp[5] + $6A51A0D2 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := a and (c and not f xor h and not g xor b xor g xor d) xor h and - (b and f xor c xor g) xor f and g xor d; - e := LTemp[15] + $D8542F68 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := h and (b and not e xor g and not f xor a xor f xor c) xor g and - (a and e xor b xor f) xor e and f xor c; - d := LTemp[17] + $960FA728 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := g and (a and not d xor f and not e xor h xor e xor b) xor f and - (h and d xor a xor e) xor d and e xor b; - c := LTemp[10] + $AB5133A3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := f and (h and not c xor e and not d xor g xor d xor a) xor e and - (g and c xor h xor d) xor c and d xor a; - b := LTemp[16] + $6EEF0B6C + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := e and (g and not b xor d and not c xor f xor c xor h) xor d and - (f and b xor g xor c) xor b and c xor h; - a := LTemp[13] + $137A3BE4 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := b and (d and e and g xor not f) xor d and a xor e and f xor g and c; - h := LTemp[27] + $BA3BF050 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := a and (c and d and f xor not e) xor c and h xor d and e xor f and b; - g := LTemp[3] + $7EFB2A98 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := h and (b and c and e xor not d) xor b and g xor c and d xor e and a; - f := LTemp[21] + $A1F1651D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := g and (a and b and d xor not c) xor a and f xor b and c xor d and h; - e := LTemp[26] + $39AF0176 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := f and (h and a and c xor not b) xor h and e xor a and b xor c and g; - d := LTemp[17] + $66CA593E + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := e and (g and h and b xor not a) xor g and d xor h and a xor b and f; - c := LTemp[11] + $82430E88 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := d and (f and g and a xor not h) xor f and c xor g and h xor a and e; - b := LTemp[20] + $8CEE8619 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := c and (e and f and h xor not g) xor e and b xor f and g xor h and d; - a := LTemp[29] + $456F9FB4 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := b and (d and e and g xor not f) xor d and a xor e and f xor g and c; - h := LTemp[19] + $7D84A5C3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := a and (c and d and f xor not e) xor c and h xor d and e xor f and b; - g := LTemp[0] + $3B8B5EBE + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := h and (b and c and e xor not d) xor b and g xor c and d xor e and a; - f := LTemp[12] + $E06F75D8 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := g and (a and b and d xor not c) xor a and f xor b and c xor d and h; - e := LTemp[7] + $85C12073 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := f and (h and a and c xor not b) xor h and e xor a and b xor c and g; - d := LTemp[13] + $401A449F + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := e and (g and h and b xor not a) xor g and d xor h and a xor b and f; - c := LTemp[8] + $56C16AA6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := d and (f and g and a xor not h) xor f and c xor g and h xor a and e; - b := LTemp[31] + $4ED3AA62 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := c and (e and f and h xor not g) xor e and b xor f and g xor h and d; - a := LTemp[10] + $363F7706 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := b and (d and e and g xor not f) xor d and a xor e and f xor g and c; - h := LTemp[5] + $1BFEDF72 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); - - t := a and (c and d and f xor not e) xor c and h xor d and e xor f and b; - g := LTemp[9] + $429B023D + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); - - t := h and (b and c and e xor not d) xor b and g xor c and d xor e and a; - f := LTemp[14] + $37D0D724 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); - - t := g and (a and b and d xor not c) xor a and f xor b and c xor d and h; - e := LTemp[30] + $D00A1248 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); - - t := f and (h and a and c xor not b) xor h and e xor a and b xor c and g; - d := LTemp[18] + $DB0FEAD3 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); - - t := e and (g and h and b xor not a) xor g and d xor h and a xor b and f; - c := LTemp[6] + $49F1C09B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); - - t := d and (f and g and a xor not h) xor f and c xor g and h xor a and e; - b := LTemp[28] + $075372C9 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); - - t := c and (e and f and h xor not g) xor e and b xor f and g xor h and d; - a := LTemp[24] + $80991B7B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); - - t := b and (d and e and g xor not f) xor d and a xor e and f xor g and c; - h := LTemp[2] + $25D479D8 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(h, 11); + LNfOut := LRegF and (LRegG and not LRegC xor LRegD and LRegE xor LRegA xor LRegH) xor LRegD and (LRegG xor LRegE) + xor LRegC and LRegE xor LRegH; + LRegB := LTemp[7] + $3F84D5B5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegF and not LRegB xor LRegC and LRegD xor LRegH xor LRegG) xor LRegC and (LRegF xor LRegD) + xor LRegB and LRegD xor LRegG; + LRegA := LTemp[16] + $B5470917 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegE and not LRegA xor LRegB and LRegC xor LRegG xor LRegF) xor LRegB and (LRegE xor LRegC) + xor LRegA and LRegC xor LRegF; + LRegH := LTemp[0] + $9216D5D9 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegD and not LRegH xor LRegA and LRegB xor LRegF xor LRegE) xor LRegA and (LRegD xor LRegB) + xor LRegH and LRegB xor LRegE; + LRegG := LTemp[23] + $8979FB1B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegC and not LRegG xor LRegH and LRegA xor LRegE xor LRegD) xor LRegH and (LRegC xor LRegA) + xor LRegG and LRegA xor LRegD; + LRegF := LTemp[20] + $D1310BA6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegB and not LRegF xor LRegG and LRegH xor LRegD xor LRegC) xor LRegG and (LRegB xor LRegH) + xor LRegF and LRegH xor LRegC; + LRegE := LTemp[22] + $98DFB5AC + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegA and not LRegE xor LRegF and LRegG xor LRegC xor LRegB) xor LRegF and (LRegA xor LRegG) + xor LRegE and LRegG xor LRegB; + LRegD := LTemp[1] + $2FFD72DB + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegH and not LRegD xor LRegE and LRegF xor LRegB xor LRegA) xor LRegE and (LRegH xor LRegF) + xor LRegD and LRegF xor LRegA; + LRegC := LTemp[10] + $D01ADFB7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegG and not LRegC xor LRegD and LRegE xor LRegA xor LRegH) xor LRegD and (LRegG xor LRegE) + xor LRegC and LRegE xor LRegH; + LRegB := LTemp[4] + $B8E1AFED + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegF and not LRegB xor LRegC and LRegD xor LRegH xor LRegG) xor LRegC and (LRegF xor LRegD) + xor LRegB and LRegD xor LRegG; + LRegA := LTemp[8] + $6A267E96 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegE and not LRegA xor LRegB and LRegC xor LRegG xor LRegF) xor LRegB and (LRegE xor LRegC) + xor LRegA and LRegC xor LRegF; + LRegH := LTemp[30] + $BA7C9045 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegD and not LRegH xor LRegA and LRegB xor LRegF xor LRegE) xor LRegA and (LRegD xor LRegB) + xor LRegH and LRegB xor LRegE; + LRegG := LTemp[3] + $F12C7F99 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegC and not LRegG xor LRegH and LRegA xor LRegE xor LRegD) xor LRegH and (LRegC xor LRegA) + xor LRegG and LRegA xor LRegD; + LRegF := LTemp[21] + $24A19947 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegB and not LRegF xor LRegG and LRegH xor LRegD xor LRegC) xor LRegG and (LRegB xor LRegH) + xor LRegF and LRegH xor LRegC; + LRegE := LTemp[9] + $B3916CF7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegA and not LRegE xor LRegF and LRegG xor LRegC xor LRegB) xor LRegF and (LRegA xor LRegG) + xor LRegE and LRegG xor LRegB; + LRegD := LTemp[17] + $0801F2E2 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegH and not LRegD xor LRegE and LRegF xor LRegB xor LRegA) xor LRegE and (LRegH xor LRegF) + xor LRegD and LRegF xor LRegA; + LRegC := LTemp[24] + $858EFC16 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegG and not LRegC xor LRegD and LRegE xor LRegA xor LRegH) xor LRegD and (LRegG xor LRegE) + xor LRegC and LRegE xor LRegH; + LRegB := LTemp[29] + $636920D8 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegF and not LRegB xor LRegC and LRegD xor LRegH xor LRegG) xor LRegC and (LRegF xor LRegD) + xor LRegB and LRegD xor LRegG; + LRegA := LTemp[6] + $71574E69 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegE and not LRegA xor LRegB and LRegC xor LRegG xor LRegF) xor LRegB and (LRegE xor LRegC) + xor LRegA and LRegC xor LRegF; + LRegH := LTemp[19] + $A458FEA3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegD and not LRegH xor LRegA and LRegB xor LRegF xor LRegE) xor LRegA and (LRegD xor LRegB) + xor LRegH and LRegB xor LRegE; + LRegG := LTemp[12] + $F4933D7E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegC and not LRegG xor LRegH and LRegA xor LRegE xor LRegD) xor LRegH and (LRegC xor LRegA) + xor LRegG and LRegA xor LRegD; + LRegF := LTemp[15] + $0D95748F + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegB and not LRegF xor LRegG and LRegH xor LRegD xor LRegC) xor LRegG and (LRegB xor LRegH) + xor LRegF and LRegH xor LRegC; + LRegE := LTemp[13] + $728EB658 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegA and not LRegE xor LRegF and LRegG xor LRegC xor LRegB) xor LRegF and (LRegA xor LRegG) + xor LRegE and LRegG xor LRegB; + LRegD := LTemp[2] + $718BCD58 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegH and not LRegD xor LRegE and LRegF xor LRegB xor LRegA) xor LRegE and (LRegH xor LRegF) + xor LRegD and LRegF xor LRegA; + LRegC := LTemp[25] + $82154AEE + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegG and not LRegC xor LRegD and LRegE xor LRegA xor LRegH) xor LRegD and (LRegG xor LRegE) + xor LRegC and LRegE xor LRegH; + LRegB := LTemp[31] + $7B54A41D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegF and not LRegB xor LRegC and LRegD xor LRegH xor LRegG) xor LRegC and (LRegF xor LRegD) + xor LRegB and LRegD xor LRegG; + LRegA := LTemp[27] + $C25A59B5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegE and (LRegB and LRegD xor LRegC xor LRegF) xor LRegB and LRegA xor LRegD and LRegG xor LRegF; + LRegH := LTemp[19] + $9C30D539 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegD and (LRegA and LRegC xor LRegB xor LRegE) xor LRegA and LRegH xor LRegC and LRegF xor LRegE; + LRegG := LTemp[9] + $2AF26013 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegC and (LRegH and LRegB xor LRegA xor LRegD) xor LRegH and LRegG xor LRegB and LRegE xor LRegD; + LRegF := LTemp[4] + $C5D1B023 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegB and (LRegG and LRegA xor LRegH xor LRegC) xor LRegG and LRegF xor LRegA and LRegD xor LRegC; + LRegE := LTemp[20] + $286085F0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegA and (LRegF and LRegH xor LRegG xor LRegB) xor LRegF and LRegE xor LRegH and LRegC xor LRegB; + LRegD := LTemp[28] + $CA417918 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegH and (LRegE and LRegG xor LRegF xor LRegA) xor LRegE and LRegD xor LRegG and LRegB xor LRegA; + LRegC := LTemp[17] + $B8DB38EF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegG and (LRegD and LRegF xor LRegE xor LRegH) xor LRegD and LRegC xor LRegF and LRegA xor LRegH; + LRegB := LTemp[8] + $8E79DCB0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegF and (LRegC and LRegE xor LRegD xor LRegG) xor LRegC and LRegB xor LRegE and LRegH xor LRegG; + LRegA := LTemp[22] + $603A180E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegE and (LRegB and LRegD xor LRegC xor LRegF) xor LRegB and LRegA xor LRegD and LRegG xor LRegF; + LRegH := LTemp[29] + $6C9E0E8B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegD and (LRegA and LRegC xor LRegB xor LRegE) xor LRegA and LRegH xor LRegC and LRegF xor LRegE; + LRegG := LTemp[14] + $B01E8A3E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegC and (LRegH and LRegB xor LRegA xor LRegD) xor LRegH and LRegG xor LRegB and LRegE xor LRegD; + LRegF := LTemp[25] + $D71577C1 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegB and (LRegG and LRegA xor LRegH xor LRegC) xor LRegG and LRegF xor LRegA and LRegD xor LRegC; + LRegE := LTemp[12] + $BD314B27 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegA and (LRegF and LRegH xor LRegG xor LRegB) xor LRegF and LRegE xor LRegH and LRegC xor LRegB; + LRegD := LTemp[24] + $78AF2FDA + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegH and (LRegE and LRegG xor LRegF xor LRegA) xor LRegE and LRegD xor LRegG and LRegB xor LRegA; + LRegC := LTemp[30] + $55605C60 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegG and (LRegD and LRegF xor LRegE xor LRegH) xor LRegD and LRegC xor LRegF and LRegA xor LRegH; + LRegB := LTemp[16] + $E65525F3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegF and (LRegC and LRegE xor LRegD xor LRegG) xor LRegC and LRegB xor LRegE and LRegH xor LRegG; + LRegA := LTemp[26] + $AA55AB94 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegE and (LRegB and LRegD xor LRegC xor LRegF) xor LRegB and LRegA xor LRegD and LRegG xor LRegF; + LRegH := LTemp[31] + $57489862 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegD and (LRegA and LRegC xor LRegB xor LRegE) xor LRegA and LRegH xor LRegC and LRegF xor LRegE; + LRegG := LTemp[15] + $63E81440 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegC and (LRegH and LRegB xor LRegA xor LRegD) xor LRegH and LRegG xor LRegB and LRegE xor LRegD; + LRegF := LTemp[7] + $55CA396A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegB and (LRegG and LRegA xor LRegH xor LRegC) xor LRegG and LRegF xor LRegA and LRegD xor LRegC; + LRegE := LTemp[3] + $2AAB10B6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegA and (LRegF and LRegH xor LRegG xor LRegB) xor LRegF and LRegE xor LRegH and LRegC xor LRegB; + LRegD := LTemp[1] + $B4CC5C34 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegH and (LRegE and LRegG xor LRegF xor LRegA) xor LRegE and LRegD xor LRegG and LRegB xor LRegA; + LRegC := LTemp[0] + $1141E8CE + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegG and (LRegD and LRegF xor LRegE xor LRegH) xor LRegD and LRegC xor LRegF and LRegA xor LRegH; + LRegB := LTemp[18] + $A15486AF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegF and (LRegC and LRegE xor LRegD xor LRegG) xor LRegC and LRegB xor LRegE and LRegH xor LRegG; + LRegA := LTemp[27] + $7C72E993 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegE and (LRegB and LRegD xor LRegC xor LRegF) xor LRegB and LRegA xor LRegD and LRegG xor LRegF; + LRegH := LTemp[13] + $B3EE1411 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegD and (LRegA and LRegC xor LRegB xor LRegE) xor LRegA and LRegH xor LRegC and LRegF xor LRegE; + LRegG := LTemp[6] + $636FBC2A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegC and (LRegH and LRegB xor LRegA xor LRegD) xor LRegH and LRegG xor LRegB and LRegE xor LRegD; + LRegF := LTemp[21] + $2BA9C55D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegB and (LRegG and LRegA xor LRegH xor LRegC) xor LRegG and LRegF xor LRegA and LRegD xor LRegC; + LRegE := LTemp[10] + $741831F6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegA and (LRegF and LRegH xor LRegG xor LRegB) xor LRegF and LRegE xor LRegH and LRegC xor LRegB; + LRegD := LTemp[23] + $CE5C3E16 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegH and (LRegE and LRegG xor LRegF xor LRegA) xor LRegE and LRegD xor LRegG and LRegB xor LRegA; + LRegC := LTemp[11] + $9B87931E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegG and (LRegD and LRegF xor LRegE xor LRegH) xor LRegD and LRegC xor LRegF and LRegA xor LRegH; + LRegB := LTemp[5] + $AFD6BA33 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegF and (LRegC and LRegE xor LRegD xor LRegG) xor LRegC and LRegB xor LRegE and LRegH xor LRegG; + LRegA := LTemp[2] + $6C24CF5C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and not LRegA xor LRegC and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegC and + (LRegE and LRegA xor LRegF xor LRegB) xor LRegA and LRegB xor LRegG; + LRegH := LTemp[24] + $7A325381 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegE and not LRegH xor LRegB and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegB and + (LRegD and LRegH xor LRegE xor LRegA) xor LRegH and LRegA xor LRegF; + LRegG := LTemp[4] + $28958677 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegD and not LRegG xor LRegA and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegA and + (LRegC and LRegG xor LRegD xor LRegH) xor LRegG and LRegH xor LRegE; + LRegF := LTemp[0] + $3B8F4898 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegC and not LRegF xor LRegH and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegH and + (LRegB and LRegF xor LRegC xor LRegG) xor LRegF and LRegG xor LRegD; + LRegE := LTemp[14] + $6B4BB9AF + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegB and not LRegE xor LRegG and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegG and + (LRegA and LRegE xor LRegB xor LRegF) xor LRegE and LRegF xor LRegC; + LRegD := LTemp[2] + $C4BFE81B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegA and not LRegD xor LRegF and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegF and + (LRegH and LRegD xor LRegA xor LRegE) xor LRegD and LRegE xor LRegB; + LRegC := LTemp[7] + $66282193 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegH and not LRegC xor LRegE and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegE and + (LRegG and LRegC xor LRegH xor LRegD) xor LRegC and LRegD xor LRegA; + LRegB := LTemp[28] + $61D809CC + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegG and not LRegB xor LRegD and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegD and + (LRegF and LRegB xor LRegG xor LRegC) xor LRegB and LRegC xor LRegH; + LRegA := LTemp[23] + $FB21A991 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and not LRegA xor LRegC and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegC and + (LRegE and LRegA xor LRegF xor LRegB) xor LRegA and LRegB xor LRegG; + LRegH := LTemp[26] + $487CAC60 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegE and not LRegH xor LRegB and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegB and + (LRegD and LRegH xor LRegE xor LRegA) xor LRegH and LRegA xor LRegF; + LRegG := LTemp[6] + $5DEC8032 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegD and not LRegG xor LRegA and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegA and + (LRegC and LRegG xor LRegD xor LRegH) xor LRegG and LRegH xor LRegE; + LRegF := LTemp[30] + $EF845D5D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegC and not LRegF xor LRegH and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegH and + (LRegB and LRegF xor LRegC xor LRegG) xor LRegF and LRegG xor LRegD; + LRegE := LTemp[20] + $E98575B1 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegB and not LRegE xor LRegG and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegG and + (LRegA and LRegE xor LRegB xor LRegF) xor LRegE and LRegF xor LRegC; + LRegD := LTemp[18] + $DC262302 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegA and not LRegD xor LRegF and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegF and + (LRegH and LRegD xor LRegA xor LRegE) xor LRegD and LRegE xor LRegB; + LRegC := LTemp[25] + $EB651B88 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegH and not LRegC xor LRegE and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegE and + (LRegG and LRegC xor LRegH xor LRegD) xor LRegC and LRegD xor LRegA; + LRegB := LTemp[19] + $23893E81 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegG and not LRegB xor LRegD and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegD and + (LRegF and LRegB xor LRegG xor LRegC) xor LRegB and LRegC xor LRegH; + LRegA := LTemp[3] + $D396ACC5 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and not LRegA xor LRegC and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegC and + (LRegE and LRegA xor LRegF xor LRegB) xor LRegA and LRegB xor LRegG; + LRegH := LTemp[22] + $0F6D6FF3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegE and not LRegH xor LRegB and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegB and + (LRegD and LRegH xor LRegE xor LRegA) xor LRegH and LRegA xor LRegF; + LRegG := LTemp[11] + $83F44239 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegD and not LRegG xor LRegA and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegA and + (LRegC and LRegG xor LRegD xor LRegH) xor LRegG and LRegH xor LRegE; + LRegF := LTemp[31] + $2E0B4482 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegC and not LRegF xor LRegH and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegH and + (LRegB and LRegF xor LRegC xor LRegG) xor LRegF and LRegG xor LRegD; + LRegE := LTemp[21] + $A4842004 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegB and not LRegE xor LRegG and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegG and + (LRegA and LRegE xor LRegB xor LRegF) xor LRegE and LRegF xor LRegC; + LRegD := LTemp[8] + $69C8F04A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegA and not LRegD xor LRegF and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegF and + (LRegH and LRegD xor LRegA xor LRegE) xor LRegD and LRegE xor LRegB; + LRegC := LTemp[27] + $9E1F9B5E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegH and not LRegC xor LRegE and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegE and + (LRegG and LRegC xor LRegH xor LRegD) xor LRegC and LRegD xor LRegA; + LRegB := LTemp[12] + $21C66842 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegG and not LRegB xor LRegD and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegD and + (LRegF and LRegB xor LRegG xor LRegC) xor LRegB and LRegC xor LRegH; + LRegA := LTemp[9] + $F6E96C9A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegD and (LRegF and not LRegA xor LRegC and not LRegB xor LRegE xor LRegB xor LRegG) xor LRegC and + (LRegE and LRegA xor LRegF xor LRegB) xor LRegA and LRegB xor LRegG; + LRegH := LTemp[1] + $670C9C61 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegC and (LRegE and not LRegH xor LRegB and not LRegA xor LRegD xor LRegA xor LRegF) xor LRegB and + (LRegD and LRegH xor LRegE xor LRegA) xor LRegH and LRegA xor LRegF; + LRegG := LTemp[29] + $ABD388F0 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegB and (LRegD and not LRegG xor LRegA and not LRegH xor LRegC xor LRegH xor LRegE) xor LRegA and + (LRegC and LRegG xor LRegD xor LRegH) xor LRegG and LRegH xor LRegE; + LRegF := LTemp[5] + $6A51A0D2 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegA and (LRegC and not LRegF xor LRegH and not LRegG xor LRegB xor LRegG xor LRegD) xor LRegH and + (LRegB and LRegF xor LRegC xor LRegG) xor LRegF and LRegG xor LRegD; + LRegE := LTemp[15] + $D8542F68 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegH and (LRegB and not LRegE xor LRegG and not LRegF xor LRegA xor LRegF xor LRegC) xor LRegG and + (LRegA and LRegE xor LRegB xor LRegF) xor LRegE and LRegF xor LRegC; + LRegD := LTemp[17] + $960FA728 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegG and (LRegA and not LRegD xor LRegF and not LRegE xor LRegH xor LRegE xor LRegB) xor LRegF and + (LRegH and LRegD xor LRegA xor LRegE) xor LRegD and LRegE xor LRegB; + LRegC := LTemp[10] + $AB5133A3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegF and (LRegH and not LRegC xor LRegE and not LRegD xor LRegG xor LRegD xor LRegA) xor LRegE and + (LRegG and LRegC xor LRegH xor LRegD) xor LRegC and LRegD xor LRegA; + LRegB := LTemp[16] + $6EEF0B6C + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegE and (LRegG and not LRegB xor LRegD and not LRegC xor LRegF xor LRegC xor LRegH) xor LRegD and + (LRegF and LRegB xor LRegG xor LRegC) xor LRegB and LRegC xor LRegH; + LRegA := LTemp[13] + $137A3BE4 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegB and (LRegD and LRegE and LRegG xor not LRegF) xor LRegD and LRegA xor LRegE and LRegF xor LRegG and LRegC; + LRegH := LTemp[27] + $BA3BF050 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegA and (LRegC and LRegD and LRegF xor not LRegE) xor LRegC and LRegH xor LRegD and LRegE xor LRegF and LRegB; + LRegG := LTemp[3] + $7EFB2A98 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegH and (LRegB and LRegC and LRegE xor not LRegD) xor LRegB and LRegG xor LRegC and LRegD xor LRegE and LRegA; + LRegF := LTemp[21] + $A1F1651D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegG and (LRegA and LRegB and LRegD xor not LRegC) xor LRegA and LRegF xor LRegB and LRegC xor LRegD and LRegH; + LRegE := LTemp[26] + $39AF0176 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegF and (LRegH and LRegA and LRegC xor not LRegB) xor LRegH and LRegE xor LRegA and LRegB xor LRegC and LRegG; + LRegD := LTemp[17] + $66CA593E + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegE and (LRegG and LRegH and LRegB xor not LRegA) xor LRegG and LRegD xor LRegH and LRegA xor LRegB and LRegF; + LRegC := LTemp[11] + $82430E88 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegD and (LRegF and LRegG and LRegA xor not LRegH) xor LRegF and LRegC xor LRegG and LRegH xor LRegA and LRegE; + LRegB := LTemp[20] + $8CEE8619 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegC and (LRegE and LRegF and LRegH xor not LRegG) xor LRegE and LRegB xor LRegF and LRegG xor LRegH and LRegD; + LRegA := LTemp[29] + $456F9FB4 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegB and (LRegD and LRegE and LRegG xor not LRegF) xor LRegD and LRegA xor LRegE and LRegF xor LRegG and LRegC; + LRegH := LTemp[19] + $7D84A5C3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegA and (LRegC and LRegD and LRegF xor not LRegE) xor LRegC and LRegH xor LRegD and LRegE xor LRegF and LRegB; + LRegG := LTemp[0] + $3B8B5EBE + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegH and (LRegB and LRegC and LRegE xor not LRegD) xor LRegB and LRegG xor LRegC and LRegD xor LRegE and LRegA; + LRegF := LTemp[12] + $E06F75D8 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegG and (LRegA and LRegB and LRegD xor not LRegC) xor LRegA and LRegF xor LRegB and LRegC xor LRegD and LRegH; + LRegE := LTemp[7] + $85C12073 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegF and (LRegH and LRegA and LRegC xor not LRegB) xor LRegH and LRegE xor LRegA and LRegB xor LRegC and LRegG; + LRegD := LTemp[13] + $401A449F + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegE and (LRegG and LRegH and LRegB xor not LRegA) xor LRegG and LRegD xor LRegH and LRegA xor LRegB and LRegF; + LRegC := LTemp[8] + $56C16AA6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegD and (LRegF and LRegG and LRegA xor not LRegH) xor LRegF and LRegC xor LRegG and LRegH xor LRegA and LRegE; + LRegB := LTemp[31] + $4ED3AA62 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegC and (LRegE and LRegF and LRegH xor not LRegG) xor LRegE and LRegB xor LRegF and LRegG xor LRegH and LRegD; + LRegA := LTemp[10] + $363F7706 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegB and (LRegD and LRegE and LRegG xor not LRegF) xor LRegD and LRegA xor LRegE and LRegF xor LRegG and LRegC; + LRegH := LTemp[5] + $1BFEDF72 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); + + LNfOut := LRegA and (LRegC and LRegD and LRegF xor not LRegE) xor LRegC and LRegH xor LRegD and LRegE xor LRegF and LRegB; + LRegG := LTemp[9] + $429B023D + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); + + LNfOut := LRegH and (LRegB and LRegC and LRegE xor not LRegD) xor LRegB and LRegG xor LRegC and LRegD xor LRegE and LRegA; + LRegF := LTemp[14] + $37D0D724 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); + + LNfOut := LRegG and (LRegA and LRegB and LRegD xor not LRegC) xor LRegA and LRegF xor LRegB and LRegC xor LRegD and LRegH; + LRegE := LTemp[30] + $D00A1248 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); + + LNfOut := LRegF and (LRegH and LRegA and LRegC xor not LRegB) xor LRegH and LRegE xor LRegA and LRegB xor LRegC and LRegG; + LRegD := LTemp[18] + $DB0FEAD3 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); + + LNfOut := LRegE and (LRegG and LRegH and LRegB xor not LRegA) xor LRegG and LRegD xor LRegH and LRegA xor LRegB and LRegF; + LRegC := LTemp[6] + $49F1C09B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); + + LNfOut := LRegD and (LRegF and LRegG and LRegA xor not LRegH) xor LRegF and LRegC xor LRegG and LRegH xor LRegA and LRegE; + LRegB := LTemp[28] + $075372C9 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); + + LNfOut := LRegC and (LRegE and LRegF and LRegH xor not LRegG) xor LRegE and LRegB xor LRegF and LRegG xor LRegH and LRegD; + LRegA := LTemp[24] + $80991B7B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); + + LNfOut := LRegB and (LRegD and LRegE and LRegG xor not LRegF) xor LRegD and LRegA xor LRegE and LRegF xor LRegG and LRegC; + LRegH := LTemp[2] + $25D479D8 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegH, 11); - t := a and (c and d and f xor not e) xor c and h xor d and e xor f and b; - g := LTemp[23] + $F6E8DEF7 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(g, 11); + LNfOut := LRegA and (LRegC and LRegD and LRegF xor not LRegE) xor LRegC and LRegH xor LRegD and LRegE xor LRegF and LRegB; + LRegG := LTemp[23] + $F6E8DEF7 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegG, 11); - t := h and (b and c and e xor not d) xor b and g xor c and d xor e and a; - f := LTemp[16] + $E3FE501A + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(f, 11); + LNfOut := LRegH and (LRegB and LRegC and LRegE xor not LRegD) xor LRegB and LRegG xor LRegC and LRegD xor LRegE and LRegA; + LRegF := LTemp[16] + $E3FE501A + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegF, 11); - t := g and (a and b and d xor not c) xor a and f xor b and c xor d and h; - e := LTemp[22] + $B6794C3B + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(e, 11); + LNfOut := LRegG and (LRegA and LRegB and LRegD xor not LRegC) xor LRegA and LRegF xor LRegB and LRegC xor LRegD and LRegH; + LRegE := LTemp[22] + $B6794C3B + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegE, 11); - t := f and (h and a and c xor not b) xor h and e xor a and b xor c and g; - d := LTemp[4] + $976CE0BD + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(d, 11); + LNfOut := LRegF and (LRegH and LRegA and LRegC xor not LRegB) xor LRegH and LRegE xor LRegA and LRegB xor LRegC and LRegG; + LRegD := LTemp[4] + $976CE0BD + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegD, 11); - t := e and (g and h and b xor not a) xor g and d xor h and a xor b and f; - c := LTemp[1] + $04C006BA + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(c, 11); + LNfOut := LRegE and (LRegG and LRegH and LRegB xor not LRegA) xor LRegG and LRegD xor LRegH and LRegA xor LRegB and LRegF; + LRegC := LTemp[1] + $04C006BA + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegC, 11); - t := d and (f and g and a xor not h) xor f and c xor g and h xor a and e; - b := LTemp[25] + $C1A94FB6 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(b, 11); + LNfOut := LRegD and (LRegF and LRegG and LRegA xor not LRegH) xor LRegF and LRegC xor LRegG and LRegH xor LRegA and LRegE; + LRegB := LTemp[25] + $C1A94FB6 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegB, 11); - t := c and (e and f and h xor not g) xor e and b xor f and g xor h and d; - a := LTemp[15] + $409F60C4 + TBits.RotateRight32(t, 7) + - TBits.RotateRight32(a, 11); + LNfOut := LRegC and (LRegE and LRegF and LRegH xor not LRegG) xor LRegE and LRegB xor LRegF and LRegG xor LRegH and LRegD; + LRegA := LTemp[15] + $409F60C4 + TBits.RotateRight32(LNfOut, 7) + + TBits.RotateRight32(LRegA, 11); - FHash[0] := FHash[0] + a; - FHash[1] := FHash[1] + b; - FHash[2] := FHash[2] + c; - FHash[3] := FHash[3] + d; - FHash[4] := FHash[4] + e; - FHash[5] := FHash[5] + f; - FHash[6] := FHash[6] + g; - FHash[7] := FHash[7] + h; + FHash[0] := FHash[0] + LRegA; + FHash[1] := FHash[1] + LRegB; + FHash[2] := FHash[2] + LRegC; + FHash[3] := FHash[3] + LRegD; + FHash[4] := FHash[4] + LRegE; + FHash[5] := FHash[5] + LRegF; + FHash[6] := FHash[6] + LRegG; + FHash[7] := FHash[7] + LRegH; System.FillChar(LTemp, System.SizeOf(LTemp), UInt32(0)); end; @@ -2089,8 +2089,8 @@ function THaval_3_128.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_3_128.Create; @@ -2108,8 +2108,8 @@ function THaval_4_128.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_4_128.Create; @@ -2127,8 +2127,8 @@ function THaval_5_128.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_5_128.Create; @@ -2146,8 +2146,8 @@ function THaval_3_160.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_3_160.Create; @@ -2165,8 +2165,8 @@ function THaval_4_160.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_4_160.Create; @@ -2184,8 +2184,8 @@ function THaval_5_160.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_5_160.Create; @@ -2203,8 +2203,8 @@ function THaval_3_192.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_3_192.Create; @@ -2222,8 +2222,8 @@ function THaval_4_192.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_4_192.Create; @@ -2241,8 +2241,8 @@ function THaval_5_192.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_5_192.Create; @@ -2260,8 +2260,8 @@ function THaval_3_224.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_3_224.Create; @@ -2279,8 +2279,8 @@ function THaval_4_224.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_4_224.Create; @@ -2298,8 +2298,8 @@ function THaval_5_224.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_5_224.Create; @@ -2317,8 +2317,8 @@ function THaval_3_256.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_3_256.Create; @@ -2336,8 +2336,8 @@ function THaval_4_256.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_4_256.Create; @@ -2355,8 +2355,8 @@ function THaval_5_256.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor THaval_5_256.Create; diff --git a/HashLib/src/Crypto/HlpMD2.pas b/HashLib/src/Crypto/HlpMD2.pas index bee14ace..19da22a8 100644 --- a/HashLib/src/Crypto/HlpMD2.pas +++ b/HashLib/src/Crypto/HlpMD2.pas @@ -21,7 +21,7 @@ TMD2 = class sealed(TBlockHash, ICryptoNotBuildIn, ITransformBlock) {$REGION 'Consts'} const - SPi: array [0 .. 255] of Byte = (41, 46, 67, 201, 162, 216, 124, 1, 61, 54, + Pi: array [0 .. 255] of Byte = (41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, @@ -84,13 +84,13 @@ function TMD2.Clone(): IHash; LHashInstance.FChecksum := System.Copy(FChecksum); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TMD2.Create; begin - Inherited Create(16, 16); + inherited Create(16, 16); System.SetLength(FState, 16); System.SetLength(FChecksum, 16); end; @@ -116,20 +116,20 @@ procedure TMD2.Finish; function TMD2.GetResult: THashLibByteArray; begin - result := System.Copy(FState); + Result := System.Copy(FState); end; procedure TMD2.Initialize; begin TArrayUtils.ZeroFill(FState); TArrayUtils.ZeroFill(FChecksum); - Inherited Initialize(); + inherited Initialize(); end; procedure TMD2.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var LIdx, LJdx: Int32; - LT: UInt32; + LChainByte: UInt32; LTemp: array [0 .. 47] of Byte; begin System.Move(FState[0], LTemp[0], ADataLength); @@ -141,28 +141,28 @@ procedure TMD2.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); LTemp[LIdx + 32] := Byte(FState[LIdx] xor AData[LIdx + AIndex]); end; - LT := 0; + LChainByte := 0; for LIdx := 0 to 17 do begin for LJdx := 0 to 47 do begin - LTemp[LJdx] := Byte(LTemp[LJdx] xor SPi[LT]); - LT := LTemp[LJdx]; + LTemp[LJdx] := Byte(LTemp[LJdx] xor Pi[LChainByte]); + LChainByte := LTemp[LJdx]; end; - LT := Byte(LT + UInt32(LIdx)); + LChainByte := Byte(LChainByte + UInt32(LIdx)); end; System.Move(LTemp[0], FState[0], 16); - LT := FChecksum[15]; + LChainByte := FChecksum[15]; for LIdx := 0 to 15 do begin - FChecksum[LIdx] := FChecksum[LIdx] xor (SPi[AData[LIdx + AIndex] xor LT]); - LT := FChecksum[LIdx]; + FChecksum[LIdx] := FChecksum[LIdx] xor (Pi[AData[LIdx + AIndex] xor LChainByte]); + LChainByte := FChecksum[LIdx]; end; System.FillChar(LTemp, System.SizeOf(LTemp), Byte(0)); diff --git a/HashLib/src/Crypto/HlpMD4.pas b/HashLib/src/Crypto/HlpMD4.pas index d0a67425..35316248 100644 --- a/HashLib/src/Crypto/HlpMD4.pas +++ b/HashLib/src/Crypto/HlpMD4.pas @@ -36,130 +36,130 @@ function TMD4.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TMD4.Create; begin - Inherited Create(4, 16); + inherited Create(4, 16); end; procedure TMD4.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d: UInt32; + LRegA, LRegB, LRegC, LRegD: UInt32; LData: array [0 .. 15] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - - a := a + (LData[0] + ((b and c) or ((not b) and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[1] + ((a and b) or ((not a) and c))); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[2] + ((d and a) or ((not d) and b))); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[3] + ((c and d) or ((not c) and a))); - b := TBits.RotateLeft32(b, 19); - a := a + (LData[4] + ((b and c) or ((not b) and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[5] + ((a and b) or ((not a) and c))); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[6] + ((d and a) or ((not d) and b))); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[7] + ((c and d) or ((not c) and a))); - b := TBits.RotateLeft32(b, 19); - a := a + (LData[8] + ((b and c) or ((not b) and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[9] + ((a and b) or ((not a) and c))); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[10] + ((d and a) or ((not d) and b))); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[11] + ((c and d) or ((not c) and a))); - b := TBits.RotateLeft32(b, 19); - a := a + (LData[12] + ((b and c) or ((not b) and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[13] + ((a and b) or ((not a) and c))); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[14] + ((d and a) or ((not d) and b))); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[15] + ((c and d) or ((not c) and a))); - b := TBits.RotateLeft32(b, 19); - - a := a + (LData[0] + C2 + ((b and (c or d)) or (c and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[4] + C2 + ((a and (b or c)) or (b and c))); - d := TBits.RotateLeft32(d, 5); - c := c + (LData[8] + C2 + ((d and (a or b)) or (a and b))); - c := TBits.RotateLeft32(c, 9); - b := b + (LData[12] + C2 + ((c and (d or a)) or (d and a))); - b := TBits.RotateLeft32(b, 13); - a := a + (LData[1] + C2 + ((b and (c or d)) or (c and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[5] + C2 + ((a and (b or c)) or (b and c))); - d := TBits.RotateLeft32(d, 5); - c := c + (LData[9] + C2 + ((d and (a or b)) or (a and b))); - c := TBits.RotateLeft32(c, 9); - b := b + (LData[13] + C2 + ((c and (d or a)) or (d and a))); - b := TBits.RotateLeft32(b, 13); - a := a + (LData[2] + C2 + ((b and (c or d)) or (c and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[6] + C2 + ((a and (b or c)) or (b and c))); - d := TBits.RotateLeft32(d, 5); - c := c + (LData[10] + C2 + ((d and (a or b)) or (a and b))); - c := TBits.RotateLeft32(c, 9); - b := b + (LData[14] + C2 + ((c and (d or a)) or (d and a))); - b := TBits.RotateLeft32(b, 13); - a := a + (LData[3] + C2 + ((b and (c or d)) or (c and d))); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[7] + C2 + ((a and (b or c)) or (b and c))); - d := TBits.RotateLeft32(d, 5); - c := c + (LData[11] + C2 + ((d and (a or b)) or (a and b))); - c := TBits.RotateLeft32(c, 9); - b := b + (LData[15] + C2 + ((c and (d or a)) or (d and a))); - b := TBits.RotateLeft32(b, 13); - - a := a + (LData[0] + C4 + (b xor c xor d)); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[8] + C4 + (a xor b xor c)); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[4] + C4 + (d xor a xor b)); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[12] + C4 + (c xor d xor a)); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[2] + C4 + (b xor c xor d)); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[10] + C4 + (a xor b xor c)); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[6] + C4 + (d xor a xor b)); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[14] + C4 + (c xor d xor a)); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[1] + C4 + (b xor c xor d)); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[9] + C4 + (a xor b xor c)); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[5] + C4 + (d xor a xor b)); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[13] + C4 + (c xor d xor a)); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[3] + C4 + (b xor c xor d)); - a := TBits.RotateLeft32(a, 3); - d := d + (LData[11] + C4 + (a xor b xor c)); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[7] + C4 + (d xor a xor b)); - c := TBits.RotateLeft32(c, 11); - b := b + (LData[15] + C4 + (c xor d xor a)); - b := TBits.RotateLeft32(b, 15); - - FState[0] := FState[0] + a; - FState[1] := FState[1] + b; - FState[2] := FState[2] + c; - FState[3] := FState[3] + d; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + + LRegA := LRegA + (LData[0] + ((LRegB and LRegC) or ((not LRegB) and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[1] + ((LRegA and LRegB) or ((not LRegA) and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[2] + ((LRegD and LRegA) or ((not LRegD) and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[3] + ((LRegC and LRegD) or ((not LRegC) and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 19); + LRegA := LRegA + (LData[4] + ((LRegB and LRegC) or ((not LRegB) and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[5] + ((LRegA and LRegB) or ((not LRegA) and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[6] + ((LRegD and LRegA) or ((not LRegD) and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[7] + ((LRegC and LRegD) or ((not LRegC) and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 19); + LRegA := LRegA + (LData[8] + ((LRegB and LRegC) or ((not LRegB) and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[9] + ((LRegA and LRegB) or ((not LRegA) and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[10] + ((LRegD and LRegA) or ((not LRegD) and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[11] + ((LRegC and LRegD) or ((not LRegC) and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 19); + LRegA := LRegA + (LData[12] + ((LRegB and LRegC) or ((not LRegB) and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[13] + ((LRegA and LRegB) or ((not LRegA) and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[14] + ((LRegD and LRegA) or ((not LRegD) and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[15] + ((LRegC and LRegD) or ((not LRegC) and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 19); + + LRegA := LRegA + (LData[0] + C2 + ((LRegB and (LRegC or LRegD)) or (LRegC and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[4] + C2 + ((LRegA and (LRegB or LRegC)) or (LRegB and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 5); + LRegC := LRegC + (LData[8] + C2 + ((LRegD and (LRegA or LRegB)) or (LRegA and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 9); + LRegB := LRegB + (LData[12] + C2 + ((LRegC and (LRegD or LRegA)) or (LRegD and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 13); + LRegA := LRegA + (LData[1] + C2 + ((LRegB and (LRegC or LRegD)) or (LRegC and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[5] + C2 + ((LRegA and (LRegB or LRegC)) or (LRegB and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 5); + LRegC := LRegC + (LData[9] + C2 + ((LRegD and (LRegA or LRegB)) or (LRegA and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 9); + LRegB := LRegB + (LData[13] + C2 + ((LRegC and (LRegD or LRegA)) or (LRegD and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 13); + LRegA := LRegA + (LData[2] + C2 + ((LRegB and (LRegC or LRegD)) or (LRegC and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[6] + C2 + ((LRegA and (LRegB or LRegC)) or (LRegB and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 5); + LRegC := LRegC + (LData[10] + C2 + ((LRegD and (LRegA or LRegB)) or (LRegA and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 9); + LRegB := LRegB + (LData[14] + C2 + ((LRegC and (LRegD or LRegA)) or (LRegD and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 13); + LRegA := LRegA + (LData[3] + C2 + ((LRegB and (LRegC or LRegD)) or (LRegC and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[7] + C2 + ((LRegA and (LRegB or LRegC)) or (LRegB and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 5); + LRegC := LRegC + (LData[11] + C2 + ((LRegD and (LRegA or LRegB)) or (LRegA and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 9); + LRegB := LRegB + (LData[15] + C2 + ((LRegC and (LRegD or LRegA)) or (LRegD and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 13); + + LRegA := LRegA + (LData[0] + C4 + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[8] + C4 + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[4] + C4 + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[12] + C4 + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[2] + C4 + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[10] + C4 + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[6] + C4 + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[14] + C4 + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[1] + C4 + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[9] + C4 + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[5] + C4 + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[13] + C4 + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[3] + C4 + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 3); + LRegD := LRegD + (LData[11] + C4 + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[7] + C4 + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB + (LData[15] + C4 + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 15); + + FState[0] := FState[0] + LRegA; + FState[1] := FState[1] + LRegB; + FState[2] := FState[2] + LRegC; + FState[3] := FState[3] + LRegD; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpMD5.pas b/HashLib/src/Crypto/HlpMD5.pas index 10bae3d2..ab063736 100644 --- a/HashLib/src/Crypto/HlpMD5.pas +++ b/HashLib/src/Crypto/HlpMD5.pas @@ -36,163 +36,163 @@ function TMD5.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TMD5.Create; begin - Inherited Create(4, 16); + inherited Create(4, 16); end; procedure TMD5.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - A, B, C, D: UInt32; + LRegA, LRegB, LRegC, LRegD: UInt32; LData: array [0 .. 15] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - A := FState[0]; - B := FState[1]; - C := FState[2]; - D := FState[3]; - - A := LData[0] + $D76AA478 + A + ((B and C) or (not B and D)); - A := TBits.RotateLeft32(A, 7) + B; - D := LData[1] + $E8C7B756 + D + ((A and B) or (not A and C)); - D := TBits.RotateLeft32(D, 12) + A; - C := LData[2] + $242070DB + C + ((D and A) or (not D and B)); - C := TBits.RotateLeft32(C, 17) + D; - B := LData[3] + $C1BDCEEE + B + ((C and D) or (not C and A)); - B := TBits.RotateLeft32(B, 22) + C; - A := LData[4] + $F57C0FAF + A + ((B and C) or (not B and D)); - A := TBits.RotateLeft32(A, 7) + B; - D := LData[5] + $4787C62A + D + ((A and B) or (not A and C)); - D := TBits.RotateLeft32(D, 12) + A; - C := LData[6] + $A8304613 + C + ((D and A) or (not D and B)); - C := TBits.RotateLeft32(C, 17) + D; - B := LData[7] + $FD469501 + B + ((C and D) or (not C and A)); - B := TBits.RotateLeft32(B, 22) + C; - A := LData[8] + $698098D8 + A + ((B and C) or (not B and D)); - A := TBits.RotateLeft32(A, 7) + B; - D := LData[9] + $8B44F7AF + D + ((A and B) or (not A and C)); - D := TBits.RotateLeft32(D, 12) + A; - C := LData[10] + $FFFF5BB1 + C + ((D and A) or (not D and B)); - C := TBits.RotateLeft32(C, 17) + D; - B := LData[11] + $895CD7BE + B + ((C and D) or (not C and A)); - B := TBits.RotateLeft32(B, 22) + C; - A := LData[12] + $6B901122 + A + ((B and C) or (not B and D)); - A := TBits.RotateLeft32(A, 7) + B; - D := LData[13] + $FD987193 + D + ((A and B) or (not A and C)); - D := TBits.RotateLeft32(D, 12) + A; - C := LData[14] + $A679438E + C + ((D and A) or (not D and B)); - C := TBits.RotateLeft32(C, 17) + D; - B := LData[15] + $49B40821 + B + ((C and D) or (not C and A)); - B := TBits.RotateLeft32(B, 22) + C; - - A := LData[1] + $F61E2562 + A + ((B and D) or (C and not D)); - A := TBits.RotateLeft32(A, 5) + B; - D := LData[6] + $C040B340 + D + ((A and C) or (B and not C)); - D := TBits.RotateLeft32(D, 9) + A; - C := LData[11] + $265E5A51 + C + ((D and B) or (A and not B)); - C := TBits.RotateLeft32(C, 14) + D; - B := LData[0] + $E9B6C7AA + B + ((C and A) or (D and not A)); - B := TBits.RotateLeft32(B, 20) + C; - A := LData[5] + $D62F105D + A + ((B and D) or (C and not D)); - A := TBits.RotateLeft32(A, 5) + B; - D := LData[10] + $2441453 + D + ((A and C) or (B and not C)); - D := TBits.RotateLeft32(D, 9) + A; - C := LData[15] + $D8A1E681 + C + ((D and B) or (A and not B)); - C := TBits.RotateLeft32(C, 14) + D; - B := LData[4] + $E7D3FBC8 + B + ((C and A) or (D and not A)); - B := TBits.RotateLeft32(B, 20) + C; - A := LData[9] + $21E1CDE6 + A + ((B and D) or (C and not D)); - A := TBits.RotateLeft32(A, 5) + B; - D := LData[14] + $C33707D6 + D + ((A and C) or (B and not C)); - D := TBits.RotateLeft32(D, 9) + A; - C := LData[3] + $F4D50D87 + C + ((D and B) or (A and not B)); - C := TBits.RotateLeft32(C, 14) + D; - B := LData[8] + $455A14ED + B + ((C and A) or (D and not A)); - B := TBits.RotateLeft32(B, 20) + C; - A := LData[13] + $A9E3E905 + A + ((B and D) or (C and not D)); - A := TBits.RotateLeft32(A, 5) + B; - D := LData[2] + $FCEFA3F8 + D + ((A and C) or (B and not C)); - D := TBits.RotateLeft32(D, 9) + A; - C := LData[7] + $676F02D9 + C + ((D and B) or (A and not B)); - C := TBits.RotateLeft32(C, 14) + D; - B := LData[12] + $8D2A4C8A + B + ((C and A) or (D and not A)); - B := TBits.RotateLeft32(B, 20) + C; - - A := LData[5] + $FFFA3942 + A + (B xor C xor D); - A := TBits.RotateLeft32(A, 4) + B; - D := LData[8] + $8771F681 + D + (A xor B xor C); - D := TBits.RotateLeft32(D, 11) + A; - C := LData[11] + $6D9D6122 + C + (D xor A xor B); - C := TBits.RotateLeft32(C, 16) + D; - B := LData[14] + $FDE5380C + B + (C xor D xor A); - B := TBits.RotateLeft32(B, 23) + C; - A := LData[1] + $A4BEEA44 + A + (B xor C xor D); - A := TBits.RotateLeft32(A, 4) + B; - D := LData[4] + $4BDECFA9 + D + (A xor B xor C); - D := TBits.RotateLeft32(D, 11) + A; - C := LData[7] + $F6BB4B60 + C + (D xor A xor B); - C := TBits.RotateLeft32(C, 16) + D; - B := LData[10] + $BEBFBC70 + B + (C xor D xor A); - B := TBits.RotateLeft32(B, 23) + C; - A := LData[13] + $289B7EC6 + A + (B xor C xor D); - A := TBits.RotateLeft32(A, 4) + B; - D := LData[0] + $EAA127FA + D + (A xor B xor C); - D := TBits.RotateLeft32(D, 11) + A; - C := LData[3] + $D4EF3085 + C + (D xor A xor B); - C := TBits.RotateLeft32(C, 16) + D; - B := LData[6] + $4881D05 + B + (C xor D xor A); - B := TBits.RotateLeft32(B, 23) + C; - A := LData[9] + $D9D4D039 + A + (B xor C xor D); - A := TBits.RotateLeft32(A, 4) + B; - D := LData[12] + $E6DB99E5 + D + (A xor B xor C); - D := TBits.RotateLeft32(D, 11) + A; - C := LData[15] + $1FA27CF8 + C + (D xor A xor B); - C := TBits.RotateLeft32(C, 16) + D; - B := LData[2] + $C4AC5665 + B + (C xor D xor A); - B := TBits.RotateLeft32(B, 23) + C; - - A := LData[0] + $F4292244 + A + (C xor (B or not D)); - A := TBits.RotateLeft32(A, 6) + B; - D := LData[7] + $432AFF97 + D + (B xor (A or not C)); - D := TBits.RotateLeft32(D, 10) + A; - C := LData[14] + $AB9423A7 + C + (A xor (D or not B)); - C := TBits.RotateLeft32(C, 15) + D; - B := LData[5] + $FC93A039 + B + (D xor (C or not A)); - B := TBits.RotateLeft32(B, 21) + C; - A := LData[12] + $655B59C3 + A + (C xor (B or not D)); - A := TBits.RotateLeft32(A, 6) + B; - D := LData[3] + $8F0CCC92 + D + (B xor (A or not C)); - D := TBits.RotateLeft32(D, 10) + A; - C := LData[10] + $FFEFF47D + C + (A xor (D or not B)); - C := TBits.RotateLeft32(C, 15) + D; - B := LData[1] + $85845DD1 + B + (D xor (C or not A)); - B := TBits.RotateLeft32(B, 21) + C; - A := LData[8] + $6FA87E4F + A + (C xor (B or not D)); - A := TBits.RotateLeft32(A, 6) + B; - D := LData[15] + $FE2CE6E0 + D + (B xor (A or not C)); - D := TBits.RotateLeft32(D, 10) + A; - C := LData[6] + $A3014314 + C + (A xor (D or not B)); - C := TBits.RotateLeft32(C, 15) + D; - B := LData[13] + $4E0811A1 + B + (D xor (C or not A)); - B := TBits.RotateLeft32(B, 21) + C; - A := LData[4] + $F7537E82 + A + (C xor (B or not D)); - A := TBits.RotateLeft32(A, 6) + B; - D := LData[11] + $BD3AF235 + D + (B xor (A or not C)); - D := TBits.RotateLeft32(D, 10) + A; - C := LData[2] + $2AD7D2BB + C + (A xor (D or not B)); - C := TBits.RotateLeft32(C, 15) + D; - B := LData[9] + $EB86D391 + B + (D xor (C or not A)); - B := TBits.RotateLeft32(B, 21) + C; - - FState[0] := FState[0] + A; - FState[1] := FState[1] + B; - FState[2] := FState[2] + C; - FState[3] := FState[3] + D; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + + LRegA := LData[0] + $D76AA478 + LRegA + ((LRegB and LRegC) or (not LRegB and LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 7) + LRegB; + LRegD := LData[1] + $E8C7B756 + LRegD + ((LRegA and LRegB) or (not LRegA and LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 12) + LRegA; + LRegC := LData[2] + $242070DB + LRegC + ((LRegD and LRegA) or (not LRegD and LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 17) + LRegD; + LRegB := LData[3] + $C1BDCEEE + LRegB + ((LRegC and LRegD) or (not LRegC and LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 22) + LRegC; + LRegA := LData[4] + $F57C0FAF + LRegA + ((LRegB and LRegC) or (not LRegB and LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 7) + LRegB; + LRegD := LData[5] + $4787C62A + LRegD + ((LRegA and LRegB) or (not LRegA and LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 12) + LRegA; + LRegC := LData[6] + $A8304613 + LRegC + ((LRegD and LRegA) or (not LRegD and LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 17) + LRegD; + LRegB := LData[7] + $FD469501 + LRegB + ((LRegC and LRegD) or (not LRegC and LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 22) + LRegC; + LRegA := LData[8] + $698098D8 + LRegA + ((LRegB and LRegC) or (not LRegB and LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 7) + LRegB; + LRegD := LData[9] + $8B44F7AF + LRegD + ((LRegA and LRegB) or (not LRegA and LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 12) + LRegA; + LRegC := LData[10] + $FFFF5BB1 + LRegC + ((LRegD and LRegA) or (not LRegD and LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 17) + LRegD; + LRegB := LData[11] + $895CD7BE + LRegB + ((LRegC and LRegD) or (not LRegC and LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 22) + LRegC; + LRegA := LData[12] + $6B901122 + LRegA + ((LRegB and LRegC) or (not LRegB and LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 7) + LRegB; + LRegD := LData[13] + $FD987193 + LRegD + ((LRegA and LRegB) or (not LRegA and LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 12) + LRegA; + LRegC := LData[14] + $A679438E + LRegC + ((LRegD and LRegA) or (not LRegD and LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 17) + LRegD; + LRegB := LData[15] + $49B40821 + LRegB + ((LRegC and LRegD) or (not LRegC and LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 22) + LRegC; + + LRegA := LData[1] + $F61E2562 + LRegA + ((LRegB and LRegD) or (LRegC and not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5) + LRegB; + LRegD := LData[6] + $C040B340 + LRegD + ((LRegA and LRegC) or (LRegB and not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegA; + LRegC := LData[11] + $265E5A51 + LRegC + ((LRegD and LRegB) or (LRegA and not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 14) + LRegD; + LRegB := LData[0] + $E9B6C7AA + LRegB + ((LRegC and LRegA) or (LRegD and not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 20) + LRegC; + LRegA := LData[5] + $D62F105D + LRegA + ((LRegB and LRegD) or (LRegC and not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5) + LRegB; + LRegD := LData[10] + $2441453 + LRegD + ((LRegA and LRegC) or (LRegB and not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegA; + LRegC := LData[15] + $D8A1E681 + LRegC + ((LRegD and LRegB) or (LRegA and not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 14) + LRegD; + LRegB := LData[4] + $E7D3FBC8 + LRegB + ((LRegC and LRegA) or (LRegD and not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 20) + LRegC; + LRegA := LData[9] + $21E1CDE6 + LRegA + ((LRegB and LRegD) or (LRegC and not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5) + LRegB; + LRegD := LData[14] + $C33707D6 + LRegD + ((LRegA and LRegC) or (LRegB and not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegA; + LRegC := LData[3] + $F4D50D87 + LRegC + ((LRegD and LRegB) or (LRegA and not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 14) + LRegD; + LRegB := LData[8] + $455A14ED + LRegB + ((LRegC and LRegA) or (LRegD and not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 20) + LRegC; + LRegA := LData[13] + $A9E3E905 + LRegA + ((LRegB and LRegD) or (LRegC and not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5) + LRegB; + LRegD := LData[2] + $FCEFA3F8 + LRegD + ((LRegA and LRegC) or (LRegB and not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegA; + LRegC := LData[7] + $676F02D9 + LRegC + ((LRegD and LRegB) or (LRegA and not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 14) + LRegD; + LRegB := LData[12] + $8D2A4C8A + LRegB + ((LRegC and LRegA) or (LRegD and not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 20) + LRegC; + + LRegA := LData[5] + $FFFA3942 + LRegA + (LRegB xor LRegC xor LRegD); + LRegA := TBits.RotateLeft32(LRegA, 4) + LRegB; + LRegD := LData[8] + $8771F681 + LRegD + (LRegA xor LRegB xor LRegC); + LRegD := TBits.RotateLeft32(LRegD, 11) + LRegA; + LRegC := LData[11] + $6D9D6122 + LRegC + (LRegD xor LRegA xor LRegB); + LRegC := TBits.RotateLeft32(LRegC, 16) + LRegD; + LRegB := LData[14] + $FDE5380C + LRegB + (LRegC xor LRegD xor LRegA); + LRegB := TBits.RotateLeft32(LRegB, 23) + LRegC; + LRegA := LData[1] + $A4BEEA44 + LRegA + (LRegB xor LRegC xor LRegD); + LRegA := TBits.RotateLeft32(LRegA, 4) + LRegB; + LRegD := LData[4] + $4BDECFA9 + LRegD + (LRegA xor LRegB xor LRegC); + LRegD := TBits.RotateLeft32(LRegD, 11) + LRegA; + LRegC := LData[7] + $F6BB4B60 + LRegC + (LRegD xor LRegA xor LRegB); + LRegC := TBits.RotateLeft32(LRegC, 16) + LRegD; + LRegB := LData[10] + $BEBFBC70 + LRegB + (LRegC xor LRegD xor LRegA); + LRegB := TBits.RotateLeft32(LRegB, 23) + LRegC; + LRegA := LData[13] + $289B7EC6 + LRegA + (LRegB xor LRegC xor LRegD); + LRegA := TBits.RotateLeft32(LRegA, 4) + LRegB; + LRegD := LData[0] + $EAA127FA + LRegD + (LRegA xor LRegB xor LRegC); + LRegD := TBits.RotateLeft32(LRegD, 11) + LRegA; + LRegC := LData[3] + $D4EF3085 + LRegC + (LRegD xor LRegA xor LRegB); + LRegC := TBits.RotateLeft32(LRegC, 16) + LRegD; + LRegB := LData[6] + $4881D05 + LRegB + (LRegC xor LRegD xor LRegA); + LRegB := TBits.RotateLeft32(LRegB, 23) + LRegC; + LRegA := LData[9] + $D9D4D039 + LRegA + (LRegB xor LRegC xor LRegD); + LRegA := TBits.RotateLeft32(LRegA, 4) + LRegB; + LRegD := LData[12] + $E6DB99E5 + LRegD + (LRegA xor LRegB xor LRegC); + LRegD := TBits.RotateLeft32(LRegD, 11) + LRegA; + LRegC := LData[15] + $1FA27CF8 + LRegC + (LRegD xor LRegA xor LRegB); + LRegC := TBits.RotateLeft32(LRegC, 16) + LRegD; + LRegB := LData[2] + $C4AC5665 + LRegB + (LRegC xor LRegD xor LRegA); + LRegB := TBits.RotateLeft32(LRegB, 23) + LRegC; + + LRegA := LData[0] + $F4292244 + LRegA + (LRegC xor (LRegB or not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 6) + LRegB; + LRegD := LData[7] + $432AFF97 + LRegD + (LRegB xor (LRegA or not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 10) + LRegA; + LRegC := LData[14] + $AB9423A7 + LRegC + (LRegA xor (LRegD or not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegD; + LRegB := LData[5] + $FC93A039 + LRegB + (LRegD xor (LRegC or not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 21) + LRegC; + LRegA := LData[12] + $655B59C3 + LRegA + (LRegC xor (LRegB or not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 6) + LRegB; + LRegD := LData[3] + $8F0CCC92 + LRegD + (LRegB xor (LRegA or not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 10) + LRegA; + LRegC := LData[10] + $FFEFF47D + LRegC + (LRegA xor (LRegD or not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegD; + LRegB := LData[1] + $85845DD1 + LRegB + (LRegD xor (LRegC or not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 21) + LRegC; + LRegA := LData[8] + $6FA87E4F + LRegA + (LRegC xor (LRegB or not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 6) + LRegB; + LRegD := LData[15] + $FE2CE6E0 + LRegD + (LRegB xor (LRegA or not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 10) + LRegA; + LRegC := LData[6] + $A3014314 + LRegC + (LRegA xor (LRegD or not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegD; + LRegB := LData[13] + $4E0811A1 + LRegB + (LRegD xor (LRegC or not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 21) + LRegC; + LRegA := LData[4] + $F7537E82 + LRegA + (LRegC xor (LRegB or not LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 6) + LRegB; + LRegD := LData[11] + $BD3AF235 + LRegD + (LRegB xor (LRegA or not LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 10) + LRegA; + LRegC := LData[2] + $2AD7D2BB + LRegC + (LRegA xor (LRegD or not LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegD; + LRegB := LData[9] + $EB86D391 + LRegB + (LRegD xor (LRegC or not LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 21) + LRegC; + + FState[0] := FState[0] + LRegA; + FState[1] := FState[1] + LRegB; + FState[2] := FState[2] + LRegC; + FState[3] := FState[3] + LRegD; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpMDBase.pas b/HashLib/src/Crypto/HlpMDBase.pas index e9189045..72838c1a 100644 --- a/HashLib/src/Crypto/HlpMDBase.pas +++ b/HashLib/src/Crypto/HlpMDBase.pas @@ -44,7 +44,7 @@ implementation constructor TMDBase.Create(AStateLength, AHashSize: Int32); begin - Inherited Create(AHashSize, 64); + inherited Create(AHashSize, 64); System.SetLength(FState, AStateLength); end; @@ -78,9 +78,9 @@ procedure TMDBase.Finish; function TMDBase.GetResult: THashLibByteArray; begin - System.SetLength(result, System.Length(FState) * System.SizeOf(UInt32)); - TConverters.le32_copy(PCardinal(FState), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, System.Length(FState) * System.SizeOf(UInt32)); + TConverters.le32_copy(PCardinal(FState), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TMDBase.Initialize; diff --git a/HashLib/src/Crypto/HlpPanama.pas b/HashLib/src/Crypto/HlpPanama.pas index b40c1008..bcdb5064 100644 --- a/HashLib/src/Crypto/HlpPanama.pas +++ b/HashLib/src/Crypto/HlpPanama.pas @@ -56,15 +56,15 @@ function TPanama.Clone(): IHash; LHashInstance.FTap := FTap; LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TPanama.Create; var LIdx: Int32; begin - Inherited Create(32, 32); + inherited Create(32, 32); System.SetLength(FState, 17); System.SetLength(FStages, 32); @@ -152,9 +152,9 @@ procedure TPanama.Finish; function TPanama.GetResult: THashLibByteArray; begin - System.SetLength(result, 8 * System.SizeOf(UInt32)); + System.SetLength(Result, 8 * System.SizeOf(UInt32)); TConverters.le32_copy(PCardinal(FState), 9 * System.SizeOf(UInt32), - PByte(result), 0, System.Length(result)); + PByte(Result), 0, System.Length(Result)); end; procedure TPanama.GPT(APtrTheta: PCardinal); @@ -225,7 +225,7 @@ procedure TPanama.Initialize; TArrayUtils.ZeroFill(FStages); - Inherited Initialize(); + inherited Initialize(); end; procedure TPanama.TransformBlock(AData: PByte; ADataLength: Int32; diff --git a/HashLib/src/Crypto/HlpRIPEMD.pas b/HashLib/src/Crypto/HlpRIPEMD.pas index ffc00f42..1fe8adeb 100644 --- a/HashLib/src/Crypto/HlpRIPEMD.pas +++ b/HashLib/src/Crypto/HlpRIPEMD.pas @@ -15,9 +15,9 @@ interface TRIPEMD = class sealed(TMDBase, ITransformBlock) strict private - class function P1(a, b, c: UInt32): UInt32; static; inline; - class function P2(a, b, c: UInt32): UInt32; static; inline; - class function P3(a, b, c: UInt32): UInt32; static; inline; + class function P1(AWord0, AWord1, AWord2: UInt32): UInt32; static; inline; + class function P2(AWord0, AWord1, AWord2: UInt32): UInt32; static; inline; + class function P3(AWord0, AWord1, AWord2: UInt32): UInt32; static; inline; strict protected procedure TransformBlock(AData: PByte; ADataLength: Int32; @@ -41,154 +41,154 @@ function TRIPEMD.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRIPEMD.Create; begin - Inherited Create(4, 16); + inherited Create(4, 16); end; -class function TRIPEMD.P1(a, b, c: UInt32): UInt32; +class function TRIPEMD.P1(AWord0, AWord1, AWord2: UInt32): UInt32; begin - result := (a and b) or (not a and c); + Result := (AWord0 and AWord1) or (not AWord0 and AWord2); end; -class function TRIPEMD.P2(a, b, c: UInt32): UInt32; +class function TRIPEMD.P2(AWord0, AWord1, AWord2: UInt32): UInt32; begin - result := (a and b) or (a and c) or (b and c); + Result := (AWord0 and AWord1) or (AWord0 and AWord2) or (AWord1 and AWord2); end; -class function TRIPEMD.P3(a, b, c: UInt32): UInt32; +class function TRIPEMD.P3(AWord0, AWord1, AWord2: UInt32): UInt32; begin - result := a xor b xor c; + Result := AWord0 xor AWord1 xor AWord2; end; procedure TRIPEMD.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, aa, bb, cc, dd: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegPA, LRegPB, LRegPC, LRegPD: UInt32; LData: array [0 .. 15] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - aa := a; - bb := b; - cc := c; - dd := d; - - a := TBits.RotateLeft32(P1(b, c, d) + a + LData[0], 11); - d := TBits.RotateLeft32(P1(a, b, c) + d + LData[1], 14); - c := TBits.RotateLeft32(P1(d, a, b) + c + LData[2], 15); - b := TBits.RotateLeft32(P1(c, d, a) + b + LData[3], 12); - a := TBits.RotateLeft32(P1(b, c, d) + a + LData[4], 5); - d := TBits.RotateLeft32(P1(a, b, c) + d + LData[5], 8); - c := TBits.RotateLeft32(P1(d, a, b) + c + LData[6], 7); - b := TBits.RotateLeft32(P1(c, d, a) + b + LData[7], 9); - a := TBits.RotateLeft32(P1(b, c, d) + a + LData[8], 11); - d := TBits.RotateLeft32(P1(a, b, c) + d + LData[9], 13); - c := TBits.RotateLeft32(P1(d, a, b) + c + LData[10], 14); - b := TBits.RotateLeft32(P1(c, d, a) + b + LData[11], 15); - a := TBits.RotateLeft32(P1(b, c, d) + a + LData[12], 6); - d := TBits.RotateLeft32(P1(a, b, c) + d + LData[13], 7); - c := TBits.RotateLeft32(P1(d, a, b) + c + LData[14], 9); - b := TBits.RotateLeft32(P1(c, d, a) + b + LData[15], 8); - - a := TBits.RotateLeft32(P2(b, c, d) + a + LData[7] + C2, 7); - d := TBits.RotateLeft32(P2(a, b, c) + d + LData[4] + C2, 6); - c := TBits.RotateLeft32(P2(d, a, b) + c + LData[13] + C2, 8); - b := TBits.RotateLeft32(P2(c, d, a) + b + LData[1] + C2, 13); - a := TBits.RotateLeft32(P2(b, c, d) + a + LData[10] + C2, 11); - d := TBits.RotateLeft32(P2(a, b, c) + d + LData[6] + C2, 9); - c := TBits.RotateLeft32(P2(d, a, b) + c + LData[15] + C2, 7); - b := TBits.RotateLeft32(P2(c, d, a) + b + LData[3] + C2, 15); - a := TBits.RotateLeft32(P2(b, c, d) + a + LData[12] + C2, 7); - d := TBits.RotateLeft32(P2(a, b, c) + d + LData[0] + C2, 12); - c := TBits.RotateLeft32(P2(d, a, b) + c + LData[9] + C2, 15); - b := TBits.RotateLeft32(P2(c, d, a) + b + LData[5] + C2, 9); - a := TBits.RotateLeft32(P2(b, c, d) + a + LData[14] + C2, 7); - d := TBits.RotateLeft32(P2(a, b, c) + d + LData[2] + C2, 11); - c := TBits.RotateLeft32(P2(d, a, b) + c + LData[11] + C2, 13); - b := TBits.RotateLeft32(P2(c, d, a) + b + LData[8] + C2, 12); - - a := TBits.RotateLeft32(P3(b, c, d) + a + LData[3] + C4, 11); - d := TBits.RotateLeft32(P3(a, b, c) + d + LData[10] + C4, 13); - c := TBits.RotateLeft32(P3(d, a, b) + c + LData[2] + C4, 14); - b := TBits.RotateLeft32(P3(c, d, a) + b + LData[4] + C4, 7); - a := TBits.RotateLeft32(P3(b, c, d) + a + LData[9] + C4, 14); - d := TBits.RotateLeft32(P3(a, b, c) + d + LData[15] + C4, 9); - c := TBits.RotateLeft32(P3(d, a, b) + c + LData[8] + C4, 13); - b := TBits.RotateLeft32(P3(c, d, a) + b + LData[1] + C4, 15); - a := TBits.RotateLeft32(P3(b, c, d) + a + LData[14] + C4, 6); - d := TBits.RotateLeft32(P3(a, b, c) + d + LData[7] + C4, 8); - c := TBits.RotateLeft32(P3(d, a, b) + c + LData[0] + C4, 13); - b := TBits.RotateLeft32(P3(c, d, a) + b + LData[6] + C4, 6); - a := TBits.RotateLeft32(P3(b, c, d) + a + LData[11] + C4, 12); - d := TBits.RotateLeft32(P3(a, b, c) + d + LData[13] + C4, 5); - c := TBits.RotateLeft32(P3(d, a, b) + c + LData[5] + C4, 7); - b := TBits.RotateLeft32(P3(c, d, a) + b + LData[12] + C4, 5); - - aa := TBits.RotateLeft32(P1(bb, cc, dd) + aa + LData[0] + C1, 11); - dd := TBits.RotateLeft32(P1(aa, bb, cc) + dd + LData[1] + C1, 14); - cc := TBits.RotateLeft32(P1(dd, aa, bb) + cc + LData[2] + C1, 15); - bb := TBits.RotateLeft32(P1(cc, dd, aa) + bb + LData[3] + C1, 12); - aa := TBits.RotateLeft32(P1(bb, cc, dd) + aa + LData[4] + C1, 5); - dd := TBits.RotateLeft32(P1(aa, bb, cc) + dd + LData[5] + C1, 8); - cc := TBits.RotateLeft32(P1(dd, aa, bb) + cc + LData[6] + C1, 7); - bb := TBits.RotateLeft32(P1(cc, dd, aa) + bb + LData[7] + C1, 9); - aa := TBits.RotateLeft32(P1(bb, cc, dd) + aa + LData[8] + C1, 11); - dd := TBits.RotateLeft32(P1(aa, bb, cc) + dd + LData[9] + C1, 13); - cc := TBits.RotateLeft32(P1(dd, aa, bb) + cc + LData[10] + C1, 14); - bb := TBits.RotateLeft32(P1(cc, dd, aa) + bb + LData[11] + C1, 15); - aa := TBits.RotateLeft32(P1(bb, cc, dd) + aa + LData[12] + C1, 6); - dd := TBits.RotateLeft32(P1(aa, bb, cc) + dd + LData[13] + C1, 7); - cc := TBits.RotateLeft32(P1(dd, aa, bb) + cc + LData[14] + C1, 9); - bb := TBits.RotateLeft32(P1(cc, dd, aa) + bb + LData[15] + C1, 8); - - aa := TBits.RotateLeft32(P2(bb, cc, dd) + aa + LData[7], 7); - dd := TBits.RotateLeft32(P2(aa, bb, cc) + dd + LData[4], 6); - cc := TBits.RotateLeft32(P2(dd, aa, bb) + cc + LData[13], 8); - bb := TBits.RotateLeft32(P2(cc, dd, aa) + bb + LData[1], 13); - aa := TBits.RotateLeft32(P2(bb, cc, dd) + aa + LData[10], 11); - dd := TBits.RotateLeft32(P2(aa, bb, cc) + dd + LData[6], 9); - cc := TBits.RotateLeft32(P2(dd, aa, bb) + cc + LData[15], 7); - bb := TBits.RotateLeft32(P2(cc, dd, aa) + bb + LData[3], 15); - aa := TBits.RotateLeft32(P2(bb, cc, dd) + aa + LData[12], 7); - dd := TBits.RotateLeft32(P2(aa, bb, cc) + dd + LData[0], 12); - cc := TBits.RotateLeft32(P2(dd, aa, bb) + cc + LData[9], 15); - bb := TBits.RotateLeft32(P2(cc, dd, aa) + bb + LData[5], 9); - aa := TBits.RotateLeft32(P2(bb, cc, dd) + aa + LData[14], 7); - dd := TBits.RotateLeft32(P2(aa, bb, cc) + dd + LData[2], 11); - cc := TBits.RotateLeft32(P2(dd, aa, bb) + cc + LData[11], 13); - bb := TBits.RotateLeft32(P2(cc, dd, aa) + bb + LData[8], 12); - - aa := TBits.RotateLeft32(P3(bb, cc, dd) + aa + LData[3] + C3, 11); - dd := TBits.RotateLeft32(P3(aa, bb, cc) + dd + LData[10] + C3, 13); - cc := TBits.RotateLeft32(P3(dd, aa, bb) + cc + LData[2] + C3, 14); - bb := TBits.RotateLeft32(P3(cc, dd, aa) + bb + LData[4] + C3, 7); - aa := TBits.RotateLeft32(P3(bb, cc, dd) + aa + LData[9] + C3, 14); - dd := TBits.RotateLeft32(P3(aa, bb, cc) + dd + LData[15] + C3, 9); - cc := TBits.RotateLeft32(P3(dd, aa, bb) + cc + LData[8] + C3, 13); - bb := TBits.RotateLeft32(P3(cc, dd, aa) + bb + LData[1] + C3, 15); - aa := TBits.RotateLeft32(P3(bb, cc, dd) + aa + LData[14] + C3, 6); - dd := TBits.RotateLeft32(P3(aa, bb, cc) + dd + LData[7] + C3, 8); - cc := TBits.RotateLeft32(P3(dd, aa, bb) + cc + LData[0] + C3, 13); - bb := TBits.RotateLeft32(P3(cc, dd, aa) + bb + LData[6] + C3, 6); - aa := TBits.RotateLeft32(P3(bb, cc, dd) + aa + LData[11] + C3, 12); - dd := TBits.RotateLeft32(P3(aa, bb, cc) + dd + LData[13] + C3, 5); - cc := TBits.RotateLeft32(P3(dd, aa, bb) + cc + LData[5] + C3, 7); - bb := TBits.RotateLeft32(P3(cc, dd, aa) + bb + LData[12] + C3, 5); - - cc := cc + FState[0] + b; - FState[0] := FState[1] + c + dd; - FState[1] := FState[2] + d + aa; - FState[2] := FState[3] + a + bb; - FState[3] := cc; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegPA := LRegA; + LRegPB := LRegB; + LRegPC := LRegC; + LRegPD := LRegD; + + LRegA := TBits.RotateLeft32(P1(LRegB, LRegC, LRegD) + LRegA + LData[0], 11); + LRegD := TBits.RotateLeft32(P1(LRegA, LRegB, LRegC) + LRegD + LData[1], 14); + LRegC := TBits.RotateLeft32(P1(LRegD, LRegA, LRegB) + LRegC + LData[2], 15); + LRegB := TBits.RotateLeft32(P1(LRegC, LRegD, LRegA) + LRegB + LData[3], 12); + LRegA := TBits.RotateLeft32(P1(LRegB, LRegC, LRegD) + LRegA + LData[4], 5); + LRegD := TBits.RotateLeft32(P1(LRegA, LRegB, LRegC) + LRegD + LData[5], 8); + LRegC := TBits.RotateLeft32(P1(LRegD, LRegA, LRegB) + LRegC + LData[6], 7); + LRegB := TBits.RotateLeft32(P1(LRegC, LRegD, LRegA) + LRegB + LData[7], 9); + LRegA := TBits.RotateLeft32(P1(LRegB, LRegC, LRegD) + LRegA + LData[8], 11); + LRegD := TBits.RotateLeft32(P1(LRegA, LRegB, LRegC) + LRegD + LData[9], 13); + LRegC := TBits.RotateLeft32(P1(LRegD, LRegA, LRegB) + LRegC + LData[10], 14); + LRegB := TBits.RotateLeft32(P1(LRegC, LRegD, LRegA) + LRegB + LData[11], 15); + LRegA := TBits.RotateLeft32(P1(LRegB, LRegC, LRegD) + LRegA + LData[12], 6); + LRegD := TBits.RotateLeft32(P1(LRegA, LRegB, LRegC) + LRegD + LData[13], 7); + LRegC := TBits.RotateLeft32(P1(LRegD, LRegA, LRegB) + LRegC + LData[14], 9); + LRegB := TBits.RotateLeft32(P1(LRegC, LRegD, LRegA) + LRegB + LData[15], 8); + + LRegA := TBits.RotateLeft32(P2(LRegB, LRegC, LRegD) + LRegA + LData[7] + C2, 7); + LRegD := TBits.RotateLeft32(P2(LRegA, LRegB, LRegC) + LRegD + LData[4] + C2, 6); + LRegC := TBits.RotateLeft32(P2(LRegD, LRegA, LRegB) + LRegC + LData[13] + C2, 8); + LRegB := TBits.RotateLeft32(P2(LRegC, LRegD, LRegA) + LRegB + LData[1] + C2, 13); + LRegA := TBits.RotateLeft32(P2(LRegB, LRegC, LRegD) + LRegA + LData[10] + C2, 11); + LRegD := TBits.RotateLeft32(P2(LRegA, LRegB, LRegC) + LRegD + LData[6] + C2, 9); + LRegC := TBits.RotateLeft32(P2(LRegD, LRegA, LRegB) + LRegC + LData[15] + C2, 7); + LRegB := TBits.RotateLeft32(P2(LRegC, LRegD, LRegA) + LRegB + LData[3] + C2, 15); + LRegA := TBits.RotateLeft32(P2(LRegB, LRegC, LRegD) + LRegA + LData[12] + C2, 7); + LRegD := TBits.RotateLeft32(P2(LRegA, LRegB, LRegC) + LRegD + LData[0] + C2, 12); + LRegC := TBits.RotateLeft32(P2(LRegD, LRegA, LRegB) + LRegC + LData[9] + C2, 15); + LRegB := TBits.RotateLeft32(P2(LRegC, LRegD, LRegA) + LRegB + LData[5] + C2, 9); + LRegA := TBits.RotateLeft32(P2(LRegB, LRegC, LRegD) + LRegA + LData[14] + C2, 7); + LRegD := TBits.RotateLeft32(P2(LRegA, LRegB, LRegC) + LRegD + LData[2] + C2, 11); + LRegC := TBits.RotateLeft32(P2(LRegD, LRegA, LRegB) + LRegC + LData[11] + C2, 13); + LRegB := TBits.RotateLeft32(P2(LRegC, LRegD, LRegA) + LRegB + LData[8] + C2, 12); + + LRegA := TBits.RotateLeft32(P3(LRegB, LRegC, LRegD) + LRegA + LData[3] + C4, 11); + LRegD := TBits.RotateLeft32(P3(LRegA, LRegB, LRegC) + LRegD + LData[10] + C4, 13); + LRegC := TBits.RotateLeft32(P3(LRegD, LRegA, LRegB) + LRegC + LData[2] + C4, 14); + LRegB := TBits.RotateLeft32(P3(LRegC, LRegD, LRegA) + LRegB + LData[4] + C4, 7); + LRegA := TBits.RotateLeft32(P3(LRegB, LRegC, LRegD) + LRegA + LData[9] + C4, 14); + LRegD := TBits.RotateLeft32(P3(LRegA, LRegB, LRegC) + LRegD + LData[15] + C4, 9); + LRegC := TBits.RotateLeft32(P3(LRegD, LRegA, LRegB) + LRegC + LData[8] + C4, 13); + LRegB := TBits.RotateLeft32(P3(LRegC, LRegD, LRegA) + LRegB + LData[1] + C4, 15); + LRegA := TBits.RotateLeft32(P3(LRegB, LRegC, LRegD) + LRegA + LData[14] + C4, 6); + LRegD := TBits.RotateLeft32(P3(LRegA, LRegB, LRegC) + LRegD + LData[7] + C4, 8); + LRegC := TBits.RotateLeft32(P3(LRegD, LRegA, LRegB) + LRegC + LData[0] + C4, 13); + LRegB := TBits.RotateLeft32(P3(LRegC, LRegD, LRegA) + LRegB + LData[6] + C4, 6); + LRegA := TBits.RotateLeft32(P3(LRegB, LRegC, LRegD) + LRegA + LData[11] + C4, 12); + LRegD := TBits.RotateLeft32(P3(LRegA, LRegB, LRegC) + LRegD + LData[13] + C4, 5); + LRegC := TBits.RotateLeft32(P3(LRegD, LRegA, LRegB) + LRegC + LData[5] + C4, 7); + LRegB := TBits.RotateLeft32(P3(LRegC, LRegD, LRegA) + LRegB + LData[12] + C4, 5); + + LRegPA := TBits.RotateLeft32(P1(LRegPB, LRegPC, LRegPD) + LRegPA + LData[0] + C1, 11); + LRegPD := TBits.RotateLeft32(P1(LRegPA, LRegPB, LRegPC) + LRegPD + LData[1] + C1, 14); + LRegPC := TBits.RotateLeft32(P1(LRegPD, LRegPA, LRegPB) + LRegPC + LData[2] + C1, 15); + LRegPB := TBits.RotateLeft32(P1(LRegPC, LRegPD, LRegPA) + LRegPB + LData[3] + C1, 12); + LRegPA := TBits.RotateLeft32(P1(LRegPB, LRegPC, LRegPD) + LRegPA + LData[4] + C1, 5); + LRegPD := TBits.RotateLeft32(P1(LRegPA, LRegPB, LRegPC) + LRegPD + LData[5] + C1, 8); + LRegPC := TBits.RotateLeft32(P1(LRegPD, LRegPA, LRegPB) + LRegPC + LData[6] + C1, 7); + LRegPB := TBits.RotateLeft32(P1(LRegPC, LRegPD, LRegPA) + LRegPB + LData[7] + C1, 9); + LRegPA := TBits.RotateLeft32(P1(LRegPB, LRegPC, LRegPD) + LRegPA + LData[8] + C1, 11); + LRegPD := TBits.RotateLeft32(P1(LRegPA, LRegPB, LRegPC) + LRegPD + LData[9] + C1, 13); + LRegPC := TBits.RotateLeft32(P1(LRegPD, LRegPA, LRegPB) + LRegPC + LData[10] + C1, 14); + LRegPB := TBits.RotateLeft32(P1(LRegPC, LRegPD, LRegPA) + LRegPB + LData[11] + C1, 15); + LRegPA := TBits.RotateLeft32(P1(LRegPB, LRegPC, LRegPD) + LRegPA + LData[12] + C1, 6); + LRegPD := TBits.RotateLeft32(P1(LRegPA, LRegPB, LRegPC) + LRegPD + LData[13] + C1, 7); + LRegPC := TBits.RotateLeft32(P1(LRegPD, LRegPA, LRegPB) + LRegPC + LData[14] + C1, 9); + LRegPB := TBits.RotateLeft32(P1(LRegPC, LRegPD, LRegPA) + LRegPB + LData[15] + C1, 8); + + LRegPA := TBits.RotateLeft32(P2(LRegPB, LRegPC, LRegPD) + LRegPA + LData[7], 7); + LRegPD := TBits.RotateLeft32(P2(LRegPA, LRegPB, LRegPC) + LRegPD + LData[4], 6); + LRegPC := TBits.RotateLeft32(P2(LRegPD, LRegPA, LRegPB) + LRegPC + LData[13], 8); + LRegPB := TBits.RotateLeft32(P2(LRegPC, LRegPD, LRegPA) + LRegPB + LData[1], 13); + LRegPA := TBits.RotateLeft32(P2(LRegPB, LRegPC, LRegPD) + LRegPA + LData[10], 11); + LRegPD := TBits.RotateLeft32(P2(LRegPA, LRegPB, LRegPC) + LRegPD + LData[6], 9); + LRegPC := TBits.RotateLeft32(P2(LRegPD, LRegPA, LRegPB) + LRegPC + LData[15], 7); + LRegPB := TBits.RotateLeft32(P2(LRegPC, LRegPD, LRegPA) + LRegPB + LData[3], 15); + LRegPA := TBits.RotateLeft32(P2(LRegPB, LRegPC, LRegPD) + LRegPA + LData[12], 7); + LRegPD := TBits.RotateLeft32(P2(LRegPA, LRegPB, LRegPC) + LRegPD + LData[0], 12); + LRegPC := TBits.RotateLeft32(P2(LRegPD, LRegPA, LRegPB) + LRegPC + LData[9], 15); + LRegPB := TBits.RotateLeft32(P2(LRegPC, LRegPD, LRegPA) + LRegPB + LData[5], 9); + LRegPA := TBits.RotateLeft32(P2(LRegPB, LRegPC, LRegPD) + LRegPA + LData[14], 7); + LRegPD := TBits.RotateLeft32(P2(LRegPA, LRegPB, LRegPC) + LRegPD + LData[2], 11); + LRegPC := TBits.RotateLeft32(P2(LRegPD, LRegPA, LRegPB) + LRegPC + LData[11], 13); + LRegPB := TBits.RotateLeft32(P2(LRegPC, LRegPD, LRegPA) + LRegPB + LData[8], 12); + + LRegPA := TBits.RotateLeft32(P3(LRegPB, LRegPC, LRegPD) + LRegPA + LData[3] + C3, 11); + LRegPD := TBits.RotateLeft32(P3(LRegPA, LRegPB, LRegPC) + LRegPD + LData[10] + C3, 13); + LRegPC := TBits.RotateLeft32(P3(LRegPD, LRegPA, LRegPB) + LRegPC + LData[2] + C3, 14); + LRegPB := TBits.RotateLeft32(P3(LRegPC, LRegPD, LRegPA) + LRegPB + LData[4] + C3, 7); + LRegPA := TBits.RotateLeft32(P3(LRegPB, LRegPC, LRegPD) + LRegPA + LData[9] + C3, 14); + LRegPD := TBits.RotateLeft32(P3(LRegPA, LRegPB, LRegPC) + LRegPD + LData[15] + C3, 9); + LRegPC := TBits.RotateLeft32(P3(LRegPD, LRegPA, LRegPB) + LRegPC + LData[8] + C3, 13); + LRegPB := TBits.RotateLeft32(P3(LRegPC, LRegPD, LRegPA) + LRegPB + LData[1] + C3, 15); + LRegPA := TBits.RotateLeft32(P3(LRegPB, LRegPC, LRegPD) + LRegPA + LData[14] + C3, 6); + LRegPD := TBits.RotateLeft32(P3(LRegPA, LRegPB, LRegPC) + LRegPD + LData[7] + C3, 8); + LRegPC := TBits.RotateLeft32(P3(LRegPD, LRegPA, LRegPB) + LRegPC + LData[0] + C3, 13); + LRegPB := TBits.RotateLeft32(P3(LRegPC, LRegPD, LRegPA) + LRegPB + LData[6] + C3, 6); + LRegPA := TBits.RotateLeft32(P3(LRegPB, LRegPC, LRegPD) + LRegPA + LData[11] + C3, 12); + LRegPD := TBits.RotateLeft32(P3(LRegPA, LRegPB, LRegPC) + LRegPD + LData[13] + C3, 5); + LRegPC := TBits.RotateLeft32(P3(LRegPD, LRegPA, LRegPB) + LRegPC + LData[5] + C3, 7); + LRegPB := TBits.RotateLeft32(P3(LRegPC, LRegPD, LRegPA) + LRegPB + LData[12] + C3, 5); + + LRegPC := LRegPC + FState[0] + LRegB; + FState[0] := FState[1] + LRegC + LRegPD; + FState[1] := FState[2] + LRegD + LRegPA; + FState[2] := FState[3] + LRegA + LRegPB; + FState[3] := LRegPC; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpRIPEMD128.pas b/HashLib/src/Crypto/HlpRIPEMD128.pas index 9d356462..91b1bf88 100644 --- a/HashLib/src/Crypto/HlpRIPEMD128.pas +++ b/HashLib/src/Crypto/HlpRIPEMD128.pas @@ -36,301 +36,301 @@ function TRIPEMD128.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRIPEMD128.Create; begin - Inherited Create(4, 16); + inherited Create(4, 16); end; procedure TRIPEMD128.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, aa, bb, cc, dd: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegAa, LRegBb, LRegCc, LRegDd: UInt32; LData: array [0 .. 15] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - aa := a; - bb := b; - cc := c; - dd := d; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegAa := LRegA; + LRegBb := LRegB; + LRegCc := LRegC; + LRegDd := LRegD; - a := a + (LData[0] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[1] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 14); - c := c + (LData[2] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 15); - b := b + (LData[3] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 12); - a := a + (LData[4] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 5); - d := d + (LData[5] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 8); - c := c + (LData[6] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 7); - b := b + (LData[7] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 9); - a := a + (LData[8] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[9] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 13); - c := c + (LData[10] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 14); - b := b + (LData[11] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[12] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 6); - d := d + (LData[13] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[14] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 9); - b := b + (LData[15] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 8); + LRegA := LRegA + (LData[0] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[1] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 14); + LRegC := LRegC + (LData[2] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 15); + LRegB := LRegB + (LData[3] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 12); + LRegA := LRegA + (LData[4] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5); + LRegD := LRegD + (LData[5] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 8); + LRegC := LRegC + (LData[6] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 7); + LRegB := LRegB + (LData[7] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 9); + LRegA := LRegA + (LData[8] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[9] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 13); + LRegC := LRegC + (LData[10] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 14); + LRegB := LRegB + (LData[11] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[12] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 6); + LRegD := LRegD + (LData[13] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[14] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 9); + LRegB := LRegB + (LData[15] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 8); - a := a + (LData[7] + C2 + ((b and c) or (not b and d))); - a := TBits.RotateLeft32(a, 7); - d := d + (LData[4] + C2 + ((a and b) or (not a and c))); - d := TBits.RotateLeft32(d, 6); - c := c + (LData[13] + C2 + ((d and a) or (not d and b))); - c := TBits.RotateLeft32(c, 8); - b := b + (LData[1] + C2 + ((c and d) or (not c and a))); - b := TBits.RotateLeft32(b, 13); - a := a + (LData[10] + C2 + ((b and c) or (not b and d))); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[6] + C2 + ((a and b) or (not a and c))); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[15] + C2 + ((d and a) or (not d and b))); - c := TBits.RotateLeft32(c, 7); - b := b + (LData[3] + C2 + ((c and d) or (not c and a))); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[12] + C2 + ((b and c) or (not b and d))); - a := TBits.RotateLeft32(a, 7); - d := d + (LData[0] + C2 + ((a and b) or (not a and c))); - d := TBits.RotateLeft32(d, 12); - c := c + (LData[9] + C2 + ((d and a) or (not d and b))); - c := TBits.RotateLeft32(c, 15); - b := b + (LData[5] + C2 + ((c and d) or (not c and a))); - b := TBits.RotateLeft32(b, 9); - a := a + (LData[2] + C2 + ((b and c) or (not b and d))); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[14] + C2 + ((a and b) or (not a and c))); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[11] + C2 + ((d and a) or (not d and b))); - c := TBits.RotateLeft32(c, 13); - b := b + (LData[8] + C2 + ((c and d) or (not c and a))); - b := TBits.RotateLeft32(b, 12); + LRegA := LRegA + (LData[7] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 7); + LRegD := LRegD + (LData[4] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 6); + LRegC := LRegC + (LData[13] + C2 + ((LRegD and LRegA) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 8); + LRegB := LRegB + (LData[1] + C2 + ((LRegC and LRegD) or (not LRegC and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 13); + LRegA := LRegA + (LData[10] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[6] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[15] + C2 + ((LRegD and LRegA) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 7); + LRegB := LRegB + (LData[3] + C2 + ((LRegC and LRegD) or (not LRegC and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[12] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 7); + LRegD := LRegD + (LData[0] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 12); + LRegC := LRegC + (LData[9] + C2 + ((LRegD and LRegA) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 15); + LRegB := LRegB + (LData[5] + C2 + ((LRegC and LRegD) or (not LRegC and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 9); + LRegA := LRegA + (LData[2] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[14] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[11] + C2 + ((LRegD and LRegA) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 13); + LRegB := LRegB + (LData[8] + C2 + ((LRegC and LRegD) or (not LRegC and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 12); - a := a + (LData[3] + C4 + ((b or not c) xor d)); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[10] + C4 + ((a or not b) xor c)); - d := TBits.RotateLeft32(d, 13); - c := c + (LData[14] + C4 + ((d or not a) xor b)); - c := TBits.RotateLeft32(c, 6); - b := b + (LData[4] + C4 + ((c or not d) xor a)); - b := TBits.RotateLeft32(b, 7); - a := a + (LData[9] + C4 + ((b or not c) xor d)); - a := TBits.RotateLeft32(a, 14); - d := d + (LData[15] + C4 + ((a or not b) xor c)); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[8] + C4 + ((d or not a) xor b)); - c := TBits.RotateLeft32(c, 13); - b := b + (LData[1] + C4 + ((c or not d) xor a)); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[2] + C4 + ((b or not c) xor d)); - a := TBits.RotateLeft32(a, 14); - d := d + (LData[7] + C4 + ((a or not b) xor c)); - d := TBits.RotateLeft32(d, 8); - c := c + (LData[0] + C4 + ((d or not a) xor b)); - c := TBits.RotateLeft32(c, 13); - b := b + (LData[6] + C4 + ((c or not d) xor a)); - b := TBits.RotateLeft32(b, 6); - a := a + (LData[13] + C4 + ((b or not c) xor d)); - a := TBits.RotateLeft32(a, 5); - d := d + (LData[11] + C4 + ((a or not b) xor c)); - d := TBits.RotateLeft32(d, 12); - c := c + (LData[5] + C4 + ((d or not a) xor b)); - c := TBits.RotateLeft32(c, 7); - b := b + (LData[12] + C4 + ((c or not d) xor a)); - b := TBits.RotateLeft32(b, 5); + LRegA := LRegA + (LData[3] + C4 + ((LRegB or not LRegC) xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[10] + C4 + ((LRegA or not LRegB) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 13); + LRegC := LRegC + (LData[14] + C4 + ((LRegD or not LRegA) xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 6); + LRegB := LRegB + (LData[4] + C4 + ((LRegC or not LRegD) xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 7); + LRegA := LRegA + (LData[9] + C4 + ((LRegB or not LRegC) xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 14); + LRegD := LRegD + (LData[15] + C4 + ((LRegA or not LRegB) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[8] + C4 + ((LRegD or not LRegA) xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 13); + LRegB := LRegB + (LData[1] + C4 + ((LRegC or not LRegD) xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[2] + C4 + ((LRegB or not LRegC) xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 14); + LRegD := LRegD + (LData[7] + C4 + ((LRegA or not LRegB) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 8); + LRegC := LRegC + (LData[0] + C4 + ((LRegD or not LRegA) xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 13); + LRegB := LRegB + (LData[6] + C4 + ((LRegC or not LRegD) xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 6); + LRegA := LRegA + (LData[13] + C4 + ((LRegB or not LRegC) xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5); + LRegD := LRegD + (LData[11] + C4 + ((LRegA or not LRegB) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 12); + LRegC := LRegC + (LData[5] + C4 + ((LRegD or not LRegA) xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 7); + LRegB := LRegB + (LData[12] + C4 + ((LRegC or not LRegD) xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 5); - a := a + (LData[1] + C6 + ((b and d) or (c and not d))); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[9] + C6 + ((a and c) or (b and not c))); - d := TBits.RotateLeft32(d, 12); - c := c + (LData[11] + C6 + ((d and b) or (a and not b))); - c := TBits.RotateLeft32(c, 14); - b := b + (LData[10] + C6 + ((c and a) or (d and not a))); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[0] + C6 + ((b and d) or (c and not d))); - a := TBits.RotateLeft32(a, 14); - d := d + (LData[8] + C6 + ((a and c) or (b and not c))); - d := TBits.RotateLeft32(d, 15); - c := c + (LData[12] + C6 + ((d and b) or (a and not b))); - c := TBits.RotateLeft32(c, 9); - b := b + (LData[4] + C6 + ((c and a) or (d and not a))); - b := TBits.RotateLeft32(b, 8); - a := a + (LData[13] + C6 + ((b and d) or (c and not d))); - a := TBits.RotateLeft32(a, 9); - d := d + (LData[3] + C6 + ((a and c) or (b and not c))); - d := TBits.RotateLeft32(d, 14); - c := c + (LData[7] + C6 + ((d and b) or (a and not b))); - c := TBits.RotateLeft32(c, 5); - b := b + (LData[15] + C6 + ((c and a) or (d and not a))); - b := TBits.RotateLeft32(b, 6); - a := a + (LData[14] + C6 + ((b and d) or (c and not d))); - a := TBits.RotateLeft32(a, 8); - d := d + (LData[5] + C6 + ((a and c) or (b and not c))); - d := TBits.RotateLeft32(d, 6); - c := c + (LData[6] + C6 + ((d and b) or (a and not b))); - c := TBits.RotateLeft32(c, 5); - b := b + (LData[2] + C6 + ((c and a) or (d and not a))); - b := TBits.RotateLeft32(b, 12); + LRegA := LRegA + (LData[1] + C6 + ((LRegB and LRegD) or (LRegC and not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[9] + C6 + ((LRegA and LRegC) or (LRegB and not LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 12); + LRegC := LRegC + (LData[11] + C6 + ((LRegD and LRegB) or (LRegA and not LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 14); + LRegB := LRegB + (LData[10] + C6 + ((LRegC and LRegA) or (LRegD and not LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[0] + C6 + ((LRegB and LRegD) or (LRegC and not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 14); + LRegD := LRegD + (LData[8] + C6 + ((LRegA and LRegC) or (LRegB and not LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 15); + LRegC := LRegC + (LData[12] + C6 + ((LRegD and LRegB) or (LRegA and not LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 9); + LRegB := LRegB + (LData[4] + C6 + ((LRegC and LRegA) or (LRegD and not LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 8); + LRegA := LRegA + (LData[13] + C6 + ((LRegB and LRegD) or (LRegC and not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 9); + LRegD := LRegD + (LData[3] + C6 + ((LRegA and LRegC) or (LRegB and not LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 14); + LRegC := LRegC + (LData[7] + C6 + ((LRegD and LRegB) or (LRegA and not LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 5); + LRegB := LRegB + (LData[15] + C6 + ((LRegC and LRegA) or (LRegD and not LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 6); + LRegA := LRegA + (LData[14] + C6 + ((LRegB and LRegD) or (LRegC and not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 8); + LRegD := LRegD + (LData[5] + C6 + ((LRegA and LRegC) or (LRegB and not LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 6); + LRegC := LRegC + (LData[6] + C6 + ((LRegD and LRegB) or (LRegA and not LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 5); + LRegB := LRegB + (LData[2] + C6 + ((LRegC and LRegA) or (LRegD and not LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 12); - aa := aa + (LData[5] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 8); - dd := dd + (LData[14] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 9); - cc := cc + (LData[7] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 9); - bb := bb + (LData[0] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 11); - aa := aa + (LData[9] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 13); - dd := dd + (LData[2] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 15); - cc := cc + (LData[11] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 15); - bb := bb + (LData[4] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 5); - aa := aa + (LData[13] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 7); - dd := dd + (LData[6] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 7); - cc := cc + (LData[15] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 8); - bb := bb + (LData[8] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 11); - aa := aa + (LData[1] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 14); - dd := dd + (LData[10] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 14); - cc := cc + (LData[3] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 12); - bb := bb + (LData[12] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 6); + LRegAa := LRegAa + (LData[5] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8); + LRegDd := LRegDd + (LData[14] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 9); + LRegCc := LRegCc + (LData[7] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 9); + LRegBb := LRegBb + (LData[0] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegAa := LRegAa + (LData[9] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 13); + LRegDd := LRegDd + (LData[2] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 15); + LRegCc := LRegCc + (LData[11] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 15); + LRegBb := LRegBb + (LData[4] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 5); + LRegAa := LRegAa + (LData[13] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 7); + LRegDd := LRegDd + (LData[6] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 7); + LRegCc := LRegCc + (LData[15] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 8); + LRegBb := LRegBb + (LData[8] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegAa := LRegAa + (LData[1] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 14); + LRegDd := LRegDd + (LData[10] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 14); + LRegCc := LRegCc + (LData[3] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 12); + LRegBb := LRegBb + (LData[12] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 6); - aa := aa + (LData[6] + C3 + ((bb or not cc) xor dd)); - aa := TBits.RotateLeft32(aa, 9); - dd := dd + (LData[11] + C3 + ((aa or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 13); - cc := cc + (LData[3] + C3 + ((dd or not aa) xor bb)); - cc := TBits.RotateLeft32(cc, 15); - bb := bb + (LData[7] + C3 + ((cc or not dd) xor aa)); - bb := TBits.RotateLeft32(bb, 7); - aa := aa + (LData[0] + C3 + ((bb or not cc) xor dd)); - aa := TBits.RotateLeft32(aa, 12); - dd := dd + (LData[13] + C3 + ((aa or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 8); - cc := cc + (LData[5] + C3 + ((dd or not aa) xor bb)); - cc := TBits.RotateLeft32(cc, 9); - bb := bb + (LData[10] + C3 + ((cc or not dd) xor aa)); - bb := TBits.RotateLeft32(bb, 11); - aa := aa + (LData[14] + C3 + ((bb or not cc) xor dd)); - aa := TBits.RotateLeft32(aa, 7); - dd := dd + (LData[15] + C3 + ((aa or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 7); - cc := cc + (LData[8] + C3 + ((dd or not aa) xor bb)); - cc := TBits.RotateLeft32(cc, 12); - bb := bb + (LData[12] + C3 + ((cc or not dd) xor aa)); - bb := TBits.RotateLeft32(bb, 7); - aa := aa + (LData[4] + C3 + ((bb or not cc) xor dd)); - aa := TBits.RotateLeft32(aa, 6); - dd := dd + (LData[9] + C3 + ((aa or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 15); - cc := cc + (LData[1] + C3 + ((dd or not aa) xor bb)); - cc := TBits.RotateLeft32(cc, 13); - bb := bb + (LData[2] + C3 + ((cc or not dd) xor aa)); - bb := TBits.RotateLeft32(bb, 11); + LRegAa := LRegAa + (LData[6] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 9); + LRegDd := LRegDd + (LData[11] + C3 + ((LRegAa or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 13); + LRegCc := LRegCc + (LData[3] + C3 + ((LRegDd or not LRegAa) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 15); + LRegBb := LRegBb + (LData[7] + C3 + ((LRegCc or not LRegDd) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 7); + LRegAa := LRegAa + (LData[0] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 12); + LRegDd := LRegDd + (LData[13] + C3 + ((LRegAa or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 8); + LRegCc := LRegCc + (LData[5] + C3 + ((LRegDd or not LRegAa) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 9); + LRegBb := LRegBb + (LData[10] + C3 + ((LRegCc or not LRegDd) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegAa := LRegAa + (LData[14] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 7); + LRegDd := LRegDd + (LData[15] + C3 + ((LRegAa or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 7); + LRegCc := LRegCc + (LData[8] + C3 + ((LRegDd or not LRegAa) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 12); + LRegBb := LRegBb + (LData[12] + C3 + ((LRegCc or not LRegDd) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 7); + LRegAa := LRegAa + (LData[4] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 6); + LRegDd := LRegDd + (LData[9] + C3 + ((LRegAa or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 15); + LRegCc := LRegCc + (LData[1] + C3 + ((LRegDd or not LRegAa) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 13); + LRegBb := LRegBb + (LData[2] + C3 + ((LRegCc or not LRegDd) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 11); - aa := aa + (LData[15] + C5 + ((bb and cc) or (not bb and dd))); - aa := TBits.RotateLeft32(aa, 9); - dd := dd + (LData[5] + C5 + ((aa and bb) or (not aa and cc))); - dd := TBits.RotateLeft32(dd, 7); - cc := cc + (LData[1] + C5 + ((dd and aa) or (not dd and bb))); - cc := TBits.RotateLeft32(cc, 15); - bb := bb + (LData[3] + C5 + ((cc and dd) or (not cc and aa))); - bb := TBits.RotateLeft32(bb, 11); - aa := aa + (LData[7] + C5 + ((bb and cc) or (not bb and dd))); - aa := TBits.RotateLeft32(aa, 8); - dd := dd + (LData[14] + C5 + ((aa and bb) or (not aa and cc))); - dd := TBits.RotateLeft32(dd, 6); - cc := cc + (LData[6] + C5 + ((dd and aa) or (not dd and bb))); - cc := TBits.RotateLeft32(cc, 6); - bb := bb + (LData[9] + C5 + ((cc and dd) or (not cc and aa))); - bb := TBits.RotateLeft32(bb, 14); - aa := aa + (LData[11] + C5 + ((bb and cc) or (not bb and dd))); - aa := TBits.RotateLeft32(aa, 12); - dd := dd + (LData[8] + C5 + ((aa and bb) or (not aa and cc))); - dd := TBits.RotateLeft32(dd, 13); - cc := cc + (LData[12] + C5 + ((dd and aa) or (not dd and bb))); - cc := TBits.RotateLeft32(cc, 5); - bb := bb + (LData[2] + C5 + ((cc and dd) or (not cc and aa))); - bb := TBits.RotateLeft32(bb, 14); - aa := aa + (LData[10] + C5 + ((bb and cc) or (not bb and dd))); - aa := TBits.RotateLeft32(aa, 13); - dd := dd + (LData[0] + C5 + ((aa and bb) or (not aa and cc))); - dd := TBits.RotateLeft32(dd, 13); - cc := cc + (LData[4] + C5 + ((dd and aa) or (not dd and bb))); - cc := TBits.RotateLeft32(cc, 7); - bb := bb + (LData[13] + C5 + ((cc and dd) or (not cc and aa))); - bb := TBits.RotateLeft32(bb, 5); + LRegAa := LRegAa + (LData[15] + C5 + ((LRegBb and LRegCc) or (not LRegBb and LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 9); + LRegDd := LRegDd + (LData[5] + C5 + ((LRegAa and LRegBb) or (not LRegAa and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 7); + LRegCc := LRegCc + (LData[1] + C5 + ((LRegDd and LRegAa) or (not LRegDd and LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 15); + LRegBb := LRegBb + (LData[3] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegAa := LRegAa + (LData[7] + C5 + ((LRegBb and LRegCc) or (not LRegBb and LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8); + LRegDd := LRegDd + (LData[14] + C5 + ((LRegAa and LRegBb) or (not LRegAa and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 6); + LRegCc := LRegCc + (LData[6] + C5 + ((LRegDd and LRegAa) or (not LRegDd and LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 6); + LRegBb := LRegBb + (LData[9] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 14); + LRegAa := LRegAa + (LData[11] + C5 + ((LRegBb and LRegCc) or (not LRegBb and LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 12); + LRegDd := LRegDd + (LData[8] + C5 + ((LRegAa and LRegBb) or (not LRegAa and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 13); + LRegCc := LRegCc + (LData[12] + C5 + ((LRegDd and LRegAa) or (not LRegDd and LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 5); + LRegBb := LRegBb + (LData[2] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 14); + LRegAa := LRegAa + (LData[10] + C5 + ((LRegBb and LRegCc) or (not LRegBb and LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 13); + LRegDd := LRegDd + (LData[0] + C5 + ((LRegAa and LRegBb) or (not LRegAa and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 13); + LRegCc := LRegCc + (LData[4] + C5 + ((LRegDd and LRegAa) or (not LRegDd and LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 7); + LRegBb := LRegBb + (LData[13] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 5); - aa := aa + (LData[8] + (bb xor cc xor dd)); - aa := TBits.RotateLeft32(aa, 15); - dd := dd + (LData[6] + (aa xor bb xor cc)); - dd := TBits.RotateLeft32(dd, 5); - cc := cc + (LData[4] + (dd xor aa xor bb)); - cc := TBits.RotateLeft32(cc, 8); - bb := bb + (LData[1] + (cc xor dd xor aa)); - bb := TBits.RotateLeft32(bb, 11); - aa := aa + (LData[3] + (bb xor cc xor dd)); - aa := TBits.RotateLeft32(aa, 14); - dd := dd + (LData[11] + (aa xor bb xor cc)); - dd := TBits.RotateLeft32(dd, 14); - cc := cc + (LData[15] + (dd xor aa xor bb)); - cc := TBits.RotateLeft32(cc, 6); - bb := bb + (LData[0] + (cc xor dd xor aa)); - bb := TBits.RotateLeft32(bb, 14); - aa := aa + (LData[5] + (bb xor cc xor dd)); - aa := TBits.RotateLeft32(aa, 6); - dd := dd + (LData[12] + (aa xor bb xor cc)); - dd := TBits.RotateLeft32(dd, 9); - cc := cc + (LData[2] + (dd xor aa xor bb)); - cc := TBits.RotateLeft32(cc, 12); - bb := bb + (LData[13] + (cc xor dd xor aa)); - bb := TBits.RotateLeft32(bb, 9); - aa := aa + (LData[9] + (bb xor cc xor dd)); - aa := TBits.RotateLeft32(aa, 12); - dd := dd + (LData[7] + (aa xor bb xor cc)); - dd := TBits.RotateLeft32(dd, 5); - cc := cc + (LData[10] + (dd xor aa xor bb)); - cc := TBits.RotateLeft32(cc, 15); - bb := bb + (LData[14] + (cc xor dd xor aa)); - bb := TBits.RotateLeft32(bb, 8); + LRegAa := LRegAa + (LData[8] + (LRegBb xor LRegCc xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 15); + LRegDd := LRegDd + (LData[6] + (LRegAa xor LRegBb xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 5); + LRegCc := LRegCc + (LData[4] + (LRegDd xor LRegAa xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 8); + LRegBb := LRegBb + (LData[1] + (LRegCc xor LRegDd xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegAa := LRegAa + (LData[3] + (LRegBb xor LRegCc xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 14); + LRegDd := LRegDd + (LData[11] + (LRegAa xor LRegBb xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 14); + LRegCc := LRegCc + (LData[15] + (LRegDd xor LRegAa xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 6); + LRegBb := LRegBb + (LData[0] + (LRegCc xor LRegDd xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 14); + LRegAa := LRegAa + (LData[5] + (LRegBb xor LRegCc xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 6); + LRegDd := LRegDd + (LData[12] + (LRegAa xor LRegBb xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 9); + LRegCc := LRegCc + (LData[2] + (LRegDd xor LRegAa xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 12); + LRegBb := LRegBb + (LData[13] + (LRegCc xor LRegDd xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 9); + LRegAa := LRegAa + (LData[9] + (LRegBb xor LRegCc xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 12); + LRegDd := LRegDd + (LData[7] + (LRegAa xor LRegBb xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 5); + LRegCc := LRegCc + (LData[10] + (LRegDd xor LRegAa xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 15); + LRegBb := LRegBb + (LData[14] + (LRegCc xor LRegDd xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 8); - dd := dd + c + FState[1]; - FState[1] := FState[2] + d + aa; - FState[2] := FState[3] + a + bb; - FState[3] := FState[0] + b + cc; - FState[0] := dd; + LRegDd := LRegDd + LRegC + FState[1]; + FState[1] := FState[2] + LRegD + LRegAa; + FState[2] := FState[3] + LRegA + LRegBb; + FState[3] := FState[0] + LRegB + LRegCc; + FState[0] := LRegDd; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpRIPEMD160.pas b/HashLib/src/Crypto/HlpRIPEMD160.pas index b5e05a60..168af9f8 100644 --- a/HashLib/src/Crypto/HlpRIPEMD160.pas +++ b/HashLib/src/Crypto/HlpRIPEMD160.pas @@ -37,536 +37,536 @@ function TRIPEMD160.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRIPEMD160.Create; begin - Inherited Create(5, 20); + inherited Create(5, 20); end; procedure TRIPEMD160.Initialize; begin FState[4] := $C3D2E1F0; - Inherited Initialize(); + inherited Initialize(); end; procedure TRIPEMD160.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, e, aa, bb, cc, dd, ee: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegE, LRegAa, LRegBb, LRegCc, LRegDd, LRegEe: UInt32; LData: array [0 .. 15] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - e := FState[4]; - aa := a; - bb := b; - cc := c; - dd := d; - ee := e; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegE := FState[4]; + LRegAa := LRegA; + LRegBb := LRegB; + LRegCc := LRegC; + LRegDd := LRegD; + LRegEe := LRegE; - a := a + (LData[0] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 11) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[1] + (a xor b xor c)); - e := TBits.RotateLeft32(e, 14) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[2] + (e xor a xor b)); - d := TBits.RotateLeft32(d, 15) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[3] + (d xor e xor a)); - c := TBits.RotateLeft32(c, 12) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[4] + (c xor d xor e)); - b := TBits.RotateLeft32(b, 5) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[5] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 8) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[6] + (a xor b xor c)); - e := TBits.RotateLeft32(e, 7) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[7] + (e xor a xor b)); - d := TBits.RotateLeft32(d, 9) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[8] + (d xor e xor a)); - c := TBits.RotateLeft32(c, 11) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[9] + (c xor d xor e)); - b := TBits.RotateLeft32(b, 13) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[10] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 14) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[11] + (a xor b xor c)); - e := TBits.RotateLeft32(e, 15) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[12] + (e xor a xor b)); - d := TBits.RotateLeft32(d, 6) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[13] + (d xor e xor a)); - c := TBits.RotateLeft32(c, 7) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[14] + (c xor d xor e)); - b := TBits.RotateLeft32(b, 9) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[15] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 8) + e; - c := TBits.RotateLeft32(c, 10); + LRegA := LRegA + (LData[0] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 11) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[1] + (LRegA xor LRegB xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 14) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[2] + (LRegE xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 15) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[3] + (LRegD xor LRegE xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 12) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[4] + (LRegC xor LRegD xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 5) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[5] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 8) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[6] + (LRegA xor LRegB xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 7) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[7] + (LRegE xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[8] + (LRegD xor LRegE xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 11) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[9] + (LRegC xor LRegD xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 13) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[10] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 14) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[11] + (LRegA xor LRegB xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 15) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[12] + (LRegE xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 6) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[13] + (LRegD xor LRegE xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 7) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[14] + (LRegC xor LRegD xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 9) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[15] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 8) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); - aa := aa + (LData[5] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 8) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[14] + C1 + (aa xor (bb or not cc))); - ee := TBits.RotateLeft32(ee, 9) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[7] + C1 + (ee xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 9) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[0] + C1 + (dd xor (ee or not aa))); - cc := TBits.RotateLeft32(cc, 11) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[9] + C1 + (cc xor (dd or not ee))); - bb := TBits.RotateLeft32(bb, 13) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[2] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 15) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[11] + C1 + (aa xor (bb or not cc))); - ee := TBits.RotateLeft32(ee, 15) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[4] + C1 + (ee xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 5) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[13] + C1 + (dd xor (ee or not aa))); - cc := TBits.RotateLeft32(cc, 7) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[6] + C1 + (cc xor (dd or not ee))); - bb := TBits.RotateLeft32(bb, 7) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[15] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 8) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[8] + C1 + (aa xor (bb or not cc))); - ee := TBits.RotateLeft32(ee, 11) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[1] + C1 + (ee xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 14) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[10] + C1 + (dd xor (ee or not aa))); - cc := TBits.RotateLeft32(cc, 14) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[3] + C1 + (cc xor (dd or not ee))); - bb := TBits.RotateLeft32(bb, 12) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[12] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 6) + ee; - cc := TBits.RotateLeft32(cc, 10); + LRegAa := LRegAa + (LData[5] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[14] + C1 + (LRegAa xor (LRegBb or not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 9) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[7] + C1 + (LRegEe xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[0] + C1 + (LRegDd xor (LRegEe or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 11) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[9] + C1 + (LRegCc xor (LRegDd or not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 13) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[2] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 15) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[11] + C1 + (LRegAa xor (LRegBb or not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 15) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[4] + C1 + (LRegEe xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 5) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[13] + C1 + (LRegDd xor (LRegEe or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 7) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[6] + C1 + (LRegCc xor (LRegDd or not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 7) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[15] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[8] + C1 + (LRegAa xor (LRegBb or not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 11) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[1] + C1 + (LRegEe xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 14) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[10] + C1 + (LRegDd xor (LRegEe or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 14) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[3] + C1 + (LRegCc xor (LRegDd or not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 12) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[12] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 6) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); - e := e + (LData[7] + C2 + ((a and b) or (not a and c))); - e := TBits.RotateLeft32(e, 7) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[4] + C2 + ((e and a) or (not e and b))); - d := TBits.RotateLeft32(d, 6) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[13] + C2 + ((d and e) or (not d and a))); - c := TBits.RotateLeft32(c, 8) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[1] + C2 + ((c and d) or (not c and e))); - b := TBits.RotateLeft32(b, 13) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[10] + C2 + ((b and c) or (not b and d))); - a := TBits.RotateLeft32(a, 11) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[6] + C2 + ((a and b) or (not a and c))); - e := TBits.RotateLeft32(e, 9) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[15] + C2 + ((e and a) or (not e and b))); - d := TBits.RotateLeft32(d, 7) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[3] + C2 + ((d and e) or (not d and a))); - c := TBits.RotateLeft32(c, 15) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[12] + C2 + ((c and d) or (not c and e))); - b := TBits.RotateLeft32(b, 7) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[0] + C2 + ((b and c) or (not b and d))); - a := TBits.RotateLeft32(a, 12) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[9] + C2 + ((a and b) or (not a and c))); - e := TBits.RotateLeft32(e, 15) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[5] + C2 + ((e and a) or (not e and b))); - d := TBits.RotateLeft32(d, 9) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[2] + C2 + ((d and e) or (not d and a))); - c := TBits.RotateLeft32(c, 11) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[14] + C2 + ((c and d) or (not c and e))); - b := TBits.RotateLeft32(b, 7) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[11] + C2 + ((b and c) or (not b and d))); - a := TBits.RotateLeft32(a, 13) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[8] + C2 + ((a and b) or (not a and c))); - e := TBits.RotateLeft32(e, 12) + d; - b := TBits.RotateLeft32(b, 10); + LRegE := LRegE + (LData[7] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 7) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[4] + C2 + ((LRegE and LRegA) or (not LRegE and LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 6) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[13] + C2 + ((LRegD and LRegE) or (not LRegD and LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 8) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[1] + C2 + ((LRegC and LRegD) or (not LRegC and LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 13) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[10] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 11) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[6] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 9) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[15] + C2 + ((LRegE and LRegA) or (not LRegE and LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 7) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[3] + C2 + ((LRegD and LRegE) or (not LRegD and LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[12] + C2 + ((LRegC and LRegD) or (not LRegC and LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 7) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[0] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 12) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[9] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 15) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[5] + C2 + ((LRegE and LRegA) or (not LRegE and LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[2] + C2 + ((LRegD and LRegE) or (not LRegD and LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 11) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[14] + C2 + ((LRegC and LRegD) or (not LRegC and LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 7) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[11] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 13) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[8] + C2 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 12) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); - ee := ee + (LData[6] + C3 + ((aa and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 9) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[11] + C3 + ((ee and bb) or (aa and not bb))); - dd := TBits.RotateLeft32(dd, 13) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[3] + C3 + ((dd and aa) or (ee and not aa))); - cc := TBits.RotateLeft32(cc, 15) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[7] + C3 + ((cc and ee) or (dd and not ee))); - bb := TBits.RotateLeft32(bb, 7) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[0] + C3 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 12) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[13] + C3 + ((aa and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 8) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[5] + C3 + ((ee and bb) or (aa and not bb))); - dd := TBits.RotateLeft32(dd, 9) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[10] + C3 + ((dd and aa) or (ee and not aa))); - cc := TBits.RotateLeft32(cc, 11) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[14] + C3 + ((cc and ee) or (dd and not ee))); - bb := TBits.RotateLeft32(bb, 7) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[15] + C3 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 7) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[8] + C3 + ((aa and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 12) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[12] + C3 + ((ee and bb) or (aa and not bb))); - dd := TBits.RotateLeft32(dd, 7) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[4] + C3 + ((dd and aa) or (ee and not aa))); - cc := TBits.RotateLeft32(cc, 6) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[9] + C3 + ((cc and ee) or (dd and not ee))); - bb := TBits.RotateLeft32(bb, 15) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[1] + C3 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 13) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[2] + C3 + ((aa and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 11) + dd; - bb := TBits.RotateLeft32(bb, 10); + LRegEe := LRegEe + (LData[6] + C3 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 9) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[11] + C3 + ((LRegEe and LRegBb) or (LRegAa and not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 13) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[3] + C3 + ((LRegDd and LRegAa) or (LRegEe and not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 15) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[7] + C3 + ((LRegCc and LRegEe) or (LRegDd and not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 7) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[0] + C3 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 12) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[13] + C3 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 8) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[5] + C3 + ((LRegEe and LRegBb) or (LRegAa and not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[10] + C3 + ((LRegDd and LRegAa) or (LRegEe and not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 11) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[14] + C3 + ((LRegCc and LRegEe) or (LRegDd and not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 7) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[15] + C3 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 7) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[8] + C3 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 12) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[12] + C3 + ((LRegEe and LRegBb) or (LRegAa and not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 7) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[4] + C3 + ((LRegDd and LRegAa) or (LRegEe and not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 6) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[9] + C3 + ((LRegCc and LRegEe) or (LRegDd and not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 15) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[1] + C3 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 13) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[2] + C3 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 11) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); - d := d + (LData[3] + C4 + ((e or not a) xor b)); - d := TBits.RotateLeft32(d, 11) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[10] + C4 + ((d or not e) xor a)); - c := TBits.RotateLeft32(c, 13) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[14] + C4 + ((c or not d) xor e)); - b := TBits.RotateLeft32(b, 6) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[4] + C4 + ((b or not c) xor d)); - a := TBits.RotateLeft32(a, 7) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[9] + C4 + ((a or not b) xor c)); - e := TBits.RotateLeft32(e, 14) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[15] + C4 + ((e or not a) xor b)); - d := TBits.RotateLeft32(d, 9) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[8] + C4 + ((d or not e) xor a)); - c := TBits.RotateLeft32(c, 13) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[1] + C4 + ((c or not d) xor e)); - b := TBits.RotateLeft32(b, 15) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[2] + C4 + ((b or not c) xor d)); - a := TBits.RotateLeft32(a, 14) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[7] + C4 + ((a or not b) xor c)); - e := TBits.RotateLeft32(e, 8) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[0] + C4 + ((e or not a) xor b)); - d := TBits.RotateLeft32(d, 13) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[6] + C4 + ((d or not e) xor a)); - c := TBits.RotateLeft32(c, 6) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[13] + C4 + ((c or not d) xor e)); - b := TBits.RotateLeft32(b, 5) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[11] + C4 + ((b or not c) xor d)); - a := TBits.RotateLeft32(a, 12) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[5] + C4 + ((a or not b) xor c)); - e := TBits.RotateLeft32(e, 7) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[12] + C4 + ((e or not a) xor b)); - d := TBits.RotateLeft32(d, 5) + c; - a := TBits.RotateLeft32(a, 10); + LRegD := LRegD + (LData[3] + C4 + ((LRegE or not LRegA) xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 11) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[10] + C4 + ((LRegD or not LRegE) xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 13) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[14] + C4 + ((LRegC or not LRegD) xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 6) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[4] + C4 + ((LRegB or not LRegC) xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 7) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[9] + C4 + ((LRegA or not LRegB) xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 14) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[15] + C4 + ((LRegE or not LRegA) xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[8] + C4 + ((LRegD or not LRegE) xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 13) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[1] + C4 + ((LRegC or not LRegD) xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 15) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[2] + C4 + ((LRegB or not LRegC) xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 14) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[7] + C4 + ((LRegA or not LRegB) xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 8) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[0] + C4 + ((LRegE or not LRegA) xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 13) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[6] + C4 + ((LRegD or not LRegE) xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 6) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[13] + C4 + ((LRegC or not LRegD) xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 5) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[11] + C4 + ((LRegB or not LRegC) xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 12) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[5] + C4 + ((LRegA or not LRegB) xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 7) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[12] + C4 + ((LRegE or not LRegA) xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 5) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); - dd := dd + (LData[15] + C5 + ((ee or not aa) xor bb)); - dd := TBits.RotateLeft32(dd, 9) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[5] + C5 + ((dd or not ee) xor aa)); - cc := TBits.RotateLeft32(cc, 7) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[1] + C5 + ((cc or not dd) xor ee)); - bb := TBits.RotateLeft32(bb, 15) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[3] + C5 + ((bb or not cc) xor dd)); - aa := TBits.RotateLeft32(aa, 11) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[7] + C5 + ((aa or not bb) xor cc)); - ee := TBits.RotateLeft32(ee, 8) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[14] + C5 + ((ee or not aa) xor bb)); - dd := TBits.RotateLeft32(dd, 6) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[6] + C5 + ((dd or not ee) xor aa)); - cc := TBits.RotateLeft32(cc, 6) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[9] + C5 + ((cc or not dd) xor ee)); - bb := TBits.RotateLeft32(bb, 14) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[11] + C5 + ((bb or not cc) xor dd)); - aa := TBits.RotateLeft32(aa, 12) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[8] + C5 + ((aa or not bb) xor cc)); - ee := TBits.RotateLeft32(ee, 13) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[12] + C5 + ((ee or not aa) xor bb)); - dd := TBits.RotateLeft32(dd, 5) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[2] + C5 + ((dd or not ee) xor aa)); - cc := TBits.RotateLeft32(cc, 14) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[10] + C5 + ((cc or not dd) xor ee)); - bb := TBits.RotateLeft32(bb, 13) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[0] + C5 + ((bb or not cc) xor dd)); - aa := TBits.RotateLeft32(aa, 13) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[4] + C5 + ((aa or not bb) xor cc)); - ee := TBits.RotateLeft32(ee, 7) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[13] + C5 + ((ee or not aa) xor bb)); - dd := TBits.RotateLeft32(dd, 5) + cc; - aa := TBits.RotateLeft32(aa, 10); + LRegDd := LRegDd + (LData[15] + C5 + ((LRegEe or not LRegAa) xor LRegBb)); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[5] + C5 + ((LRegDd or not LRegEe) xor LRegAa)); + LRegCc := TBits.RotateLeft32(LRegCc, 7) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[1] + C5 + ((LRegCc or not LRegDd) xor LRegEe)); + LRegBb := TBits.RotateLeft32(LRegBb, 15) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[3] + C5 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 11) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[7] + C5 + ((LRegAa or not LRegBb) xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 8) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[14] + C5 + ((LRegEe or not LRegAa) xor LRegBb)); + LRegDd := TBits.RotateLeft32(LRegDd, 6) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[6] + C5 + ((LRegDd or not LRegEe) xor LRegAa)); + LRegCc := TBits.RotateLeft32(LRegCc, 6) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[9] + C5 + ((LRegCc or not LRegDd) xor LRegEe)); + LRegBb := TBits.RotateLeft32(LRegBb, 14) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[11] + C5 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 12) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[8] + C5 + ((LRegAa or not LRegBb) xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 13) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[12] + C5 + ((LRegEe or not LRegAa) xor LRegBb)); + LRegDd := TBits.RotateLeft32(LRegDd, 5) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[2] + C5 + ((LRegDd or not LRegEe) xor LRegAa)); + LRegCc := TBits.RotateLeft32(LRegCc, 14) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[10] + C5 + ((LRegCc or not LRegDd) xor LRegEe)); + LRegBb := TBits.RotateLeft32(LRegBb, 13) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[0] + C5 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 13) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[4] + C5 + ((LRegAa or not LRegBb) xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 7) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[13] + C5 + ((LRegEe or not LRegAa) xor LRegBb)); + LRegDd := TBits.RotateLeft32(LRegDd, 5) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); - c := c + (LData[1] + C6 + ((d and a) or (e and not a))); - c := TBits.RotateLeft32(c, 11) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[9] + C6 + ((c and e) or (d and not e))); - b := TBits.RotateLeft32(b, 12) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[11] + C6 + ((b and d) or (c and not d))); - a := TBits.RotateLeft32(a, 14) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[10] + C6 + ((a and c) or (b and not c))); - e := TBits.RotateLeft32(e, 15) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[0] + C6 + ((e and b) or (a and not b))); - d := TBits.RotateLeft32(d, 14) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[8] + C6 + ((d and a) or (e and not a))); - c := TBits.RotateLeft32(c, 15) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[12] + C6 + ((c and e) or (d and not e))); - b := TBits.RotateLeft32(b, 9) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[4] + C6 + ((b and d) or (c and not d))); - a := TBits.RotateLeft32(a, 8) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[13] + C6 + ((a and c) or (b and not c))); - e := TBits.RotateLeft32(e, 9) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[3] + C6 + ((e and b) or (a and not b))); - d := TBits.RotateLeft32(d, 14) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[7] + C6 + ((d and a) or (e and not a))); - c := TBits.RotateLeft32(c, 5) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[15] + C6 + ((c and e) or (d and not e))); - b := TBits.RotateLeft32(b, 6) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[14] + C6 + ((b and d) or (c and not d))); - a := TBits.RotateLeft32(a, 8) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[5] + C6 + ((a and c) or (b and not c))); - e := TBits.RotateLeft32(e, 6) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[6] + C6 + ((e and b) or (a and not b))); - d := TBits.RotateLeft32(d, 5) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[2] + C6 + ((d and a) or (e and not a))); - c := TBits.RotateLeft32(c, 12) + b; - e := TBits.RotateLeft32(e, 10); + LRegC := LRegC + (LData[1] + C6 + ((LRegD and LRegA) or (LRegE and not LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 11) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[9] + C6 + ((LRegC and LRegE) or (LRegD and not LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 12) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[11] + C6 + ((LRegB and LRegD) or (LRegC and not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 14) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[10] + C6 + ((LRegA and LRegC) or (LRegB and not LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 15) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[0] + C6 + ((LRegE and LRegB) or (LRegA and not LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 14) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[8] + C6 + ((LRegD and LRegA) or (LRegE and not LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[12] + C6 + ((LRegC and LRegE) or (LRegD and not LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 9) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[4] + C6 + ((LRegB and LRegD) or (LRegC and not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 8) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[13] + C6 + ((LRegA and LRegC) or (LRegB and not LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 9) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[3] + C6 + ((LRegE and LRegB) or (LRegA and not LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 14) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[7] + C6 + ((LRegD and LRegA) or (LRegE and not LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 5) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[15] + C6 + ((LRegC and LRegE) or (LRegD and not LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 6) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[14] + C6 + ((LRegB and LRegD) or (LRegC and not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 8) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[5] + C6 + ((LRegA and LRegC) or (LRegB and not LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 6) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[6] + C6 + ((LRegE and LRegB) or (LRegA and not LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 5) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[2] + C6 + ((LRegD and LRegA) or (LRegE and not LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 12) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); - cc := cc + (LData[8] + C7 + ((dd and ee) or (not dd and aa))); - cc := TBits.RotateLeft32(cc, 15) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[6] + C7 + ((cc and dd) or (not cc and ee))); - bb := TBits.RotateLeft32(bb, 5) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[4] + C7 + ((bb and cc) or (not bb and dd))); - aa := TBits.RotateLeft32(aa, 8) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[1] + C7 + ((aa and bb) or (not aa and cc))); - ee := TBits.RotateLeft32(ee, 11) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[3] + C7 + ((ee and aa) or (not ee and bb))); - dd := TBits.RotateLeft32(dd, 14) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[11] + C7 + ((dd and ee) or (not dd and aa))); - cc := TBits.RotateLeft32(cc, 14) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[15] + C7 + ((cc and dd) or (not cc and ee))); - bb := TBits.RotateLeft32(bb, 6) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[0] + C7 + ((bb and cc) or (not bb and dd))); - aa := TBits.RotateLeft32(aa, 14) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[5] + C7 + ((aa and bb) or (not aa and cc))); - ee := TBits.RotateLeft32(ee, 6) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[12] + C7 + ((ee and aa) or (not ee and bb))); - dd := TBits.RotateLeft32(dd, 9) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[2] + C7 + ((dd and ee) or (not dd and aa))); - cc := TBits.RotateLeft32(cc, 12) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[13] + C7 + ((cc and dd) or (not cc and ee))); - bb := TBits.RotateLeft32(bb, 9) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[9] + C7 + ((bb and cc) or (not bb and dd))); - aa := TBits.RotateLeft32(aa, 12) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[7] + C7 + ((aa and bb) or (not aa and cc))); - ee := TBits.RotateLeft32(ee, 5) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[10] + C7 + ((ee and aa) or (not ee and bb))); - dd := TBits.RotateLeft32(dd, 15) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[14] + C7 + ((dd and ee) or (not dd and aa))); - cc := TBits.RotateLeft32(cc, 8) + bb; - ee := TBits.RotateLeft32(ee, 10); + LRegCc := LRegCc + (LData[8] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 15) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[6] + C7 + ((LRegCc and LRegDd) or (not LRegCc and LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 5) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[4] + C7 + ((LRegBb and LRegCc) or (not LRegBb and LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[1] + C7 + ((LRegAa and LRegBb) or (not LRegAa and LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 11) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[3] + C7 + ((LRegEe and LRegAa) or (not LRegEe and LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 14) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[11] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 14) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[15] + C7 + ((LRegCc and LRegDd) or (not LRegCc and LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 6) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[0] + C7 + ((LRegBb and LRegCc) or (not LRegBb and LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 14) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[5] + C7 + ((LRegAa and LRegBb) or (not LRegAa and LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 6) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[12] + C7 + ((LRegEe and LRegAa) or (not LRegEe and LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[2] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 12) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[13] + C7 + ((LRegCc and LRegDd) or (not LRegCc and LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 9) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[9] + C7 + ((LRegBb and LRegCc) or (not LRegBb and LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 12) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[7] + C7 + ((LRegAa and LRegBb) or (not LRegAa and LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 5) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[10] + C7 + ((LRegEe and LRegAa) or (not LRegEe and LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 15) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[14] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 8) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); - b := b + (LData[4] + C8 + (c xor (d or not e))); - b := TBits.RotateLeft32(b, 9) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[0] + C8 + (b xor (c or not d))); - a := TBits.RotateLeft32(a, 15) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[5] + C8 + (a xor (b or not c))); - e := TBits.RotateLeft32(e, 5) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[9] + C8 + (e xor (a or not b))); - d := TBits.RotateLeft32(d, 11) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[7] + C8 + (d xor (e or not a))); - c := TBits.RotateLeft32(c, 6) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[12] + C8 + (c xor (d or not e))); - b := TBits.RotateLeft32(b, 8) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[2] + C8 + (b xor (c or not d))); - a := TBits.RotateLeft32(a, 13) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[10] + C8 + (a xor (b or not c))); - e := TBits.RotateLeft32(e, 12) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[14] + C8 + (e xor (a or not b))); - d := TBits.RotateLeft32(d, 5) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[1] + C8 + (d xor (e or not a))); - c := TBits.RotateLeft32(c, 12) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[3] + C8 + (c xor (d or not e))); - b := TBits.RotateLeft32(b, 13) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[8] + C8 + (b xor (c or not d))); - a := TBits.RotateLeft32(a, 14) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[11] + C8 + (a xor (b or not c))); - e := TBits.RotateLeft32(e, 11) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[6] + C8 + (e xor (a or not b))); - d := TBits.RotateLeft32(d, 8) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[15] + C8 + (d xor (e or not a))); - c := TBits.RotateLeft32(c, 5) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[13] + C8 + (c xor (d or not e))); - b := TBits.RotateLeft32(b, 6) + a; - d := TBits.RotateLeft32(d, 10); + LRegB := LRegB + (LData[4] + C8 + (LRegC xor (LRegD or not LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 9) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[0] + C8 + (LRegB xor (LRegC or not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 15) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[5] + C8 + (LRegA xor (LRegB or not LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 5) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[9] + C8 + (LRegE xor (LRegA or not LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 11) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[7] + C8 + (LRegD xor (LRegE or not LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 6) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[12] + C8 + (LRegC xor (LRegD or not LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 8) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[2] + C8 + (LRegB xor (LRegC or not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 13) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[10] + C8 + (LRegA xor (LRegB or not LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 12) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[14] + C8 + (LRegE xor (LRegA or not LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 5) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[1] + C8 + (LRegD xor (LRegE or not LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 12) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[3] + C8 + (LRegC xor (LRegD or not LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 13) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[8] + C8 + (LRegB xor (LRegC or not LRegD))); + LRegA := TBits.RotateLeft32(LRegA, 14) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[11] + C8 + (LRegA xor (LRegB or not LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 11) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[6] + C8 + (LRegE xor (LRegA or not LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 8) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[15] + C8 + (LRegD xor (LRegE or not LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 5) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[13] + C8 + (LRegC xor (LRegD or not LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 6) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); - bb := bb + (LData[12] + (cc xor dd xor ee)); - bb := TBits.RotateLeft32(bb, 8) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[15] + (bb xor cc xor dd)); - aa := TBits.RotateLeft32(aa, 5) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[10] + (aa xor bb xor cc)); - ee := TBits.RotateLeft32(ee, 12) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[4] + (ee xor aa xor bb)); - dd := TBits.RotateLeft32(dd, 9) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[1] + (dd xor ee xor aa)); - cc := TBits.RotateLeft32(cc, 12) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[5] + (cc xor dd xor ee)); - bb := TBits.RotateLeft32(bb, 5) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[8] + (bb xor cc xor dd)); - aa := TBits.RotateLeft32(aa, 14) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[7] + (aa xor bb xor cc)); - ee := TBits.RotateLeft32(ee, 6) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[6] + (ee xor aa xor bb)); - dd := TBits.RotateLeft32(dd, 8) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[2] + (dd xor ee xor aa)); - cc := TBits.RotateLeft32(cc, 13) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[13] + (cc xor dd xor ee)); - bb := TBits.RotateLeft32(bb, 6) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[14] + (bb xor cc xor dd)); - aa := TBits.RotateLeft32(aa, 5) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[0] + (aa xor bb xor cc)); - ee := TBits.RotateLeft32(ee, 15) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[3] + (ee xor aa xor bb)); - dd := TBits.RotateLeft32(dd, 13) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[9] + (dd xor ee xor aa)); - cc := TBits.RotateLeft32(cc, 11) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[11] + (cc xor dd xor ee)); - bb := TBits.RotateLeft32(bb, 11) + aa; - dd := TBits.RotateLeft32(dd, 10); + LRegBb := LRegBb + (LData[12] + (LRegCc xor LRegDd xor LRegEe)); + LRegBb := TBits.RotateLeft32(LRegBb, 8) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[15] + (LRegBb xor LRegCc xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 5) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[10] + (LRegAa xor LRegBb xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 12) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[4] + (LRegEe xor LRegAa xor LRegBb)); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[1] + (LRegDd xor LRegEe xor LRegAa)); + LRegCc := TBits.RotateLeft32(LRegCc, 12) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[5] + (LRegCc xor LRegDd xor LRegEe)); + LRegBb := TBits.RotateLeft32(LRegBb, 5) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[8] + (LRegBb xor LRegCc xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 14) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[7] + (LRegAa xor LRegBb xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 6) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[6] + (LRegEe xor LRegAa xor LRegBb)); + LRegDd := TBits.RotateLeft32(LRegDd, 8) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[2] + (LRegDd xor LRegEe xor LRegAa)); + LRegCc := TBits.RotateLeft32(LRegCc, 13) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[13] + (LRegCc xor LRegDd xor LRegEe)); + LRegBb := TBits.RotateLeft32(LRegBb, 6) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[14] + (LRegBb xor LRegCc xor LRegDd)); + LRegAa := TBits.RotateLeft32(LRegAa, 5) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[0] + (LRegAa xor LRegBb xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 15) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[3] + (LRegEe xor LRegAa xor LRegBb)); + LRegDd := TBits.RotateLeft32(LRegDd, 13) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[9] + (LRegDd xor LRegEe xor LRegAa)); + LRegCc := TBits.RotateLeft32(LRegCc, 11) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[11] + (LRegCc xor LRegDd xor LRegEe)); + LRegBb := TBits.RotateLeft32(LRegBb, 11) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); - dd := dd + c + FState[1]; - FState[1] := FState[2] + d + ee; - FState[2] := FState[3] + e + aa; - FState[3] := FState[4] + a + bb; - FState[4] := FState[0] + b + cc; - FState[0] := dd; + LRegDd := LRegDd + LRegC + FState[1]; + FState[1] := FState[2] + LRegD + LRegEe; + FState[2] := FState[3] + LRegE + LRegAa; + FState[3] := FState[4] + LRegA + LRegBb; + FState[4] := FState[0] + LRegB + LRegCc; + FState[0] := LRegDd; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpRIPEMD256.pas b/HashLib/src/Crypto/HlpRIPEMD256.pas index 9418dda9..a45c30f3 100644 --- a/HashLib/src/Crypto/HlpRIPEMD256.pas +++ b/HashLib/src/Crypto/HlpRIPEMD256.pas @@ -37,13 +37,13 @@ function TRIPEMD256.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRIPEMD256.Create; begin - Inherited Create(8, 32); + inherited Create(8, 32); end; procedure TRIPEMD256.Initialize; @@ -52,298 +52,298 @@ procedure TRIPEMD256.Initialize; FState[5] := $FEDCBA98; FState[6] := $89ABCDEF; FState[7] := $01234567; - Inherited Initialize(); + inherited Initialize(); end; procedure TRIPEMD256.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, aa, bb, cc, dd: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegAa, LRegBb, LRegCc, LRegDd: UInt32; LData: array [0 .. 15] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - aa := FState[4]; - bb := FState[5]; - cc := FState[6]; - dd := FState[7]; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegAa := FState[4]; + LRegBb := FState[5]; + LRegCc := FState[6]; + LRegDd := FState[7]; - a := a + (LData[0] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[1] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 14); - c := c + (LData[2] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 15); - b := b + (LData[3] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 12); - a := a + (LData[4] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 5); - d := d + (LData[5] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 8); - c := c + (LData[6] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 7); - b := b + (LData[7] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 9); - a := a + (LData[8] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 11); - d := d + (LData[9] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 13); - c := c + (LData[10] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 14); - b := b + (LData[11] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 15); - a := a + (LData[12] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 6); - d := d + (LData[13] + (a xor b xor c)); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[14] + (d xor a xor b)); - c := TBits.RotateLeft32(c, 9); - b := b + (LData[15] + (c xor d xor a)); - b := TBits.RotateLeft32(b, 8); + LRegA := LRegA + (LData[0] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[1] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 14); + LRegC := LRegC + (LData[2] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 15); + LRegB := LRegB + (LData[3] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 12); + LRegA := LRegA + (LData[4] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5); + LRegD := LRegD + (LData[5] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 8); + LRegC := LRegC + (LData[6] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 7); + LRegB := LRegB + (LData[7] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 9); + LRegA := LRegA + (LData[8] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 11); + LRegD := LRegD + (LData[9] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 13); + LRegC := LRegC + (LData[10] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 14); + LRegB := LRegB + (LData[11] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegA := LRegA + (LData[12] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 6); + LRegD := LRegD + (LData[13] + (LRegA xor LRegB xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[14] + (LRegD xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 9); + LRegB := LRegB + (LData[15] + (LRegC xor LRegD xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 8); - aa := aa + (LData[5] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 8); - dd := dd + (LData[14] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 9); - cc := cc + (LData[7] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 9); - bb := bb + (LData[0] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 11); - aa := aa + (LData[9] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 13); - dd := dd + (LData[2] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 15); - cc := cc + (LData[11] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 15); - bb := bb + (LData[4] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 5); - aa := aa + (LData[13] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 7); - dd := dd + (LData[6] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 7); - cc := cc + (LData[15] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 8); - bb := bb + (LData[8] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 11); - aa := aa + (LData[1] + C1 + ((bb and dd) or (cc and not dd))); - aa := TBits.RotateLeft32(aa, 14); - dd := dd + (LData[10] + C1 + ((aa and cc) or (bb and not cc))); - dd := TBits.RotateLeft32(dd, 14); - cc := cc + (LData[3] + C1 + ((dd and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 12); - bb := bb + (LData[12] + C1 + ((cc and aa) or (dd and not aa))); - bb := TBits.RotateLeft32(bb, 6); + LRegAa := LRegAa + (LData[5] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8); + LRegDd := LRegDd + (LData[14] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 9); + LRegCc := LRegCc + (LData[7] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 9); + LRegBb := LRegBb + (LData[0] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegAa := LRegAa + (LData[9] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 13); + LRegDd := LRegDd + (LData[2] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 15); + LRegCc := LRegCc + (LData[11] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 15); + LRegBb := LRegBb + (LData[4] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 5); + LRegAa := LRegAa + (LData[13] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 7); + LRegDd := LRegDd + (LData[6] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 7); + LRegCc := LRegCc + (LData[15] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 8); + LRegBb := LRegBb + (LData[8] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegAa := LRegAa + (LData[1] + C1 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 14); + LRegDd := LRegDd + (LData[10] + C1 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 14); + LRegCc := LRegCc + (LData[3] + C1 + ((LRegDd and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 12); + LRegBb := LRegBb + (LData[12] + C1 + ((LRegCc and LRegAa) or (LRegDd and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 6); - aa := aa + (LData[7] + C2 + ((b and c) or (not b and d))); - aa := TBits.RotateLeft32(aa, 7); - d := d + (LData[4] + C2 + ((aa and b) or (not aa and c))); - d := TBits.RotateLeft32(d, 6); - c := c + (LData[13] + C2 + ((d and aa) or (not d and b))); - c := TBits.RotateLeft32(c, 8); - b := b + (LData[1] + C2 + ((c and d) or (not c and aa))); - b := TBits.RotateLeft32(b, 13); - aa := aa + (LData[10] + C2 + ((b and c) or (not b and d))); - aa := TBits.RotateLeft32(aa, 11); - d := d + (LData[6] + C2 + ((aa and b) or (not aa and c))); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[15] + C2 + ((d and aa) or (not d and b))); - c := TBits.RotateLeft32(c, 7); - b := b + (LData[3] + C2 + ((c and d) or (not c and aa))); - b := TBits.RotateLeft32(b, 15); - aa := aa + (LData[12] + C2 + ((b and c) or (not b and d))); - aa := TBits.RotateLeft32(aa, 7); - d := d + (LData[0] + C2 + ((aa and b) or (not aa and c))); - d := TBits.RotateLeft32(d, 12); - c := c + (LData[9] + C2 + ((d and aa) or (not d and b))); - c := TBits.RotateLeft32(c, 15); - b := b + (LData[5] + C2 + ((c and d) or (not c and aa))); - b := TBits.RotateLeft32(b, 9); - aa := aa + (LData[2] + C2 + ((b and c) or (not b and d))); - aa := TBits.RotateLeft32(aa, 11); - d := d + (LData[14] + C2 + ((aa and b) or (not aa and c))); - d := TBits.RotateLeft32(d, 7); - c := c + (LData[11] + C2 + ((d and aa) or (not d and b))); - c := TBits.RotateLeft32(c, 13); - b := b + (LData[8] + C2 + ((c and d) or (not c and aa))); - b := TBits.RotateLeft32(b, 12); + LRegAa := LRegAa + (LData[7] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 7); + LRegD := LRegD + (LData[4] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 6); + LRegC := LRegC + (LData[13] + C2 + ((LRegD and LRegAa) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 8); + LRegB := LRegB + (LData[1] + C2 + ((LRegC and LRegD) or (not LRegC and LRegAa))); + LRegB := TBits.RotateLeft32(LRegB, 13); + LRegAa := LRegAa + (LData[10] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 11); + LRegD := LRegD + (LData[6] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[15] + C2 + ((LRegD and LRegAa) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 7); + LRegB := LRegB + (LData[3] + C2 + ((LRegC and LRegD) or (not LRegC and LRegAa))); + LRegB := TBits.RotateLeft32(LRegB, 15); + LRegAa := LRegAa + (LData[12] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 7); + LRegD := LRegD + (LData[0] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 12); + LRegC := LRegC + (LData[9] + C2 + ((LRegD and LRegAa) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 15); + LRegB := LRegB + (LData[5] + C2 + ((LRegC and LRegD) or (not LRegC and LRegAa))); + LRegB := TBits.RotateLeft32(LRegB, 9); + LRegAa := LRegAa + (LData[2] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 11); + LRegD := LRegD + (LData[14] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegD := TBits.RotateLeft32(LRegD, 7); + LRegC := LRegC + (LData[11] + C2 + ((LRegD and LRegAa) or (not LRegD and LRegB))); + LRegC := TBits.RotateLeft32(LRegC, 13); + LRegB := LRegB + (LData[8] + C2 + ((LRegC and LRegD) or (not LRegC and LRegAa))); + LRegB := TBits.RotateLeft32(LRegB, 12); - a := a + (LData[6] + C3 + ((bb or not cc) xor dd)); - a := TBits.RotateLeft32(a, 9); - dd := dd + (LData[11] + C3 + ((a or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 13); - cc := cc + (LData[3] + C3 + ((dd or not a) xor bb)); - cc := TBits.RotateLeft32(cc, 15); - bb := bb + (LData[7] + C3 + ((cc or not dd) xor a)); - bb := TBits.RotateLeft32(bb, 7); - a := a + (LData[0] + C3 + ((bb or not cc) xor dd)); - a := TBits.RotateLeft32(a, 12); - dd := dd + (LData[13] + C3 + ((a or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 8); - cc := cc + (LData[5] + C3 + ((dd or not a) xor bb)); - cc := TBits.RotateLeft32(cc, 9); - bb := bb + (LData[10] + C3 + ((cc or not dd) xor a)); - bb := TBits.RotateLeft32(bb, 11); - a := a + (LData[14] + C3 + ((bb or not cc) xor dd)); - a := TBits.RotateLeft32(a, 7); - dd := dd + (LData[15] + C3 + ((a or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 7); - cc := cc + (LData[8] + C3 + ((dd or not a) xor bb)); - cc := TBits.RotateLeft32(cc, 12); - bb := bb + (LData[12] + C3 + ((cc or not dd) xor a)); - bb := TBits.RotateLeft32(bb, 7); - a := a + (LData[4] + C3 + ((bb or not cc) xor dd)); - a := TBits.RotateLeft32(a, 6); - dd := dd + (LData[9] + C3 + ((a or not bb) xor cc)); - dd := TBits.RotateLeft32(dd, 15); - cc := cc + (LData[1] + C3 + ((dd or not a) xor bb)); - cc := TBits.RotateLeft32(cc, 13); - bb := bb + (LData[2] + C3 + ((cc or not dd) xor a)); - bb := TBits.RotateLeft32(bb, 11); + LRegA := LRegA + (LData[6] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 9); + LRegDd := LRegDd + (LData[11] + C3 + ((LRegA or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 13); + LRegCc := LRegCc + (LData[3] + C3 + ((LRegDd or not LRegA) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 15); + LRegBb := LRegBb + (LData[7] + C3 + ((LRegCc or not LRegDd) xor LRegA)); + LRegBb := TBits.RotateLeft32(LRegBb, 7); + LRegA := LRegA + (LData[0] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 12); + LRegDd := LRegDd + (LData[13] + C3 + ((LRegA or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 8); + LRegCc := LRegCc + (LData[5] + C3 + ((LRegDd or not LRegA) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 9); + LRegBb := LRegBb + (LData[10] + C3 + ((LRegCc or not LRegDd) xor LRegA)); + LRegBb := TBits.RotateLeft32(LRegBb, 11); + LRegA := LRegA + (LData[14] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 7); + LRegDd := LRegDd + (LData[15] + C3 + ((LRegA or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 7); + LRegCc := LRegCc + (LData[8] + C3 + ((LRegDd or not LRegA) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 12); + LRegBb := LRegBb + (LData[12] + C3 + ((LRegCc or not LRegDd) xor LRegA)); + LRegBb := TBits.RotateLeft32(LRegBb, 7); + LRegA := LRegA + (LData[4] + C3 + ((LRegBb or not LRegCc) xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 6); + LRegDd := LRegDd + (LData[9] + C3 + ((LRegA or not LRegBb) xor LRegCc)); + LRegDd := TBits.RotateLeft32(LRegDd, 15); + LRegCc := LRegCc + (LData[1] + C3 + ((LRegDd or not LRegA) xor LRegBb)); + LRegCc := TBits.RotateLeft32(LRegCc, 13); + LRegBb := LRegBb + (LData[2] + C3 + ((LRegCc or not LRegDd) xor LRegA)); + LRegBb := TBits.RotateLeft32(LRegBb, 11); - aa := aa + (LData[3] + C4 + ((bb or not c) xor d)); - aa := TBits.RotateLeft32(aa, 11); - d := d + (LData[10] + C4 + ((aa or not bb) xor c)); - d := TBits.RotateLeft32(d, 13); - c := c + (LData[14] + C4 + ((d or not aa) xor bb)); - c := TBits.RotateLeft32(c, 6); - bb := bb + (LData[4] + C4 + ((c or not d) xor aa)); - bb := TBits.RotateLeft32(bb, 7); - aa := aa + (LData[9] + C4 + ((bb or not c) xor d)); - aa := TBits.RotateLeft32(aa, 14); - d := d + (LData[15] + C4 + ((aa or not bb) xor c)); - d := TBits.RotateLeft32(d, 9); - c := c + (LData[8] + C4 + ((d or not aa) xor bb)); - c := TBits.RotateLeft32(c, 13); - bb := bb + (LData[1] + C4 + ((c or not d) xor aa)); - bb := TBits.RotateLeft32(bb, 15); - aa := aa + (LData[2] + C4 + ((bb or not c) xor d)); - aa := TBits.RotateLeft32(aa, 14); - d := d + (LData[7] + C4 + ((aa or not bb) xor c)); - d := TBits.RotateLeft32(d, 8); - c := c + (LData[0] + C4 + ((d or not aa) xor bb)); - c := TBits.RotateLeft32(c, 13); - bb := bb + (LData[6] + C4 + ((c or not d) xor aa)); - bb := TBits.RotateLeft32(bb, 6); - aa := aa + (LData[13] + C4 + ((bb or not c) xor d)); - aa := TBits.RotateLeft32(aa, 5); - d := d + (LData[11] + C4 + ((aa or not bb) xor c)); - d := TBits.RotateLeft32(d, 12); - c := c + (LData[5] + C4 + ((d or not aa) xor bb)); - c := TBits.RotateLeft32(c, 7); - bb := bb + (LData[12] + C4 + ((c or not d) xor aa)); - bb := TBits.RotateLeft32(bb, 5); + LRegAa := LRegAa + (LData[3] + C4 + ((LRegBb or not LRegC) xor LRegD)); + LRegAa := TBits.RotateLeft32(LRegAa, 11); + LRegD := LRegD + (LData[10] + C4 + ((LRegAa or not LRegBb) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 13); + LRegC := LRegC + (LData[14] + C4 + ((LRegD or not LRegAa) xor LRegBb)); + LRegC := TBits.RotateLeft32(LRegC, 6); + LRegBb := LRegBb + (LData[4] + C4 + ((LRegC or not LRegD) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 7); + LRegAa := LRegAa + (LData[9] + C4 + ((LRegBb or not LRegC) xor LRegD)); + LRegAa := TBits.RotateLeft32(LRegAa, 14); + LRegD := LRegD + (LData[15] + C4 + ((LRegAa or not LRegBb) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 9); + LRegC := LRegC + (LData[8] + C4 + ((LRegD or not LRegAa) xor LRegBb)); + LRegC := TBits.RotateLeft32(LRegC, 13); + LRegBb := LRegBb + (LData[1] + C4 + ((LRegC or not LRegD) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 15); + LRegAa := LRegAa + (LData[2] + C4 + ((LRegBb or not LRegC) xor LRegD)); + LRegAa := TBits.RotateLeft32(LRegAa, 14); + LRegD := LRegD + (LData[7] + C4 + ((LRegAa or not LRegBb) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 8); + LRegC := LRegC + (LData[0] + C4 + ((LRegD or not LRegAa) xor LRegBb)); + LRegC := TBits.RotateLeft32(LRegC, 13); + LRegBb := LRegBb + (LData[6] + C4 + ((LRegC or not LRegD) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 6); + LRegAa := LRegAa + (LData[13] + C4 + ((LRegBb or not LRegC) xor LRegD)); + LRegAa := TBits.RotateLeft32(LRegAa, 5); + LRegD := LRegD + (LData[11] + C4 + ((LRegAa or not LRegBb) xor LRegC)); + LRegD := TBits.RotateLeft32(LRegD, 12); + LRegC := LRegC + (LData[5] + C4 + ((LRegD or not LRegAa) xor LRegBb)); + LRegC := TBits.RotateLeft32(LRegC, 7); + LRegBb := LRegBb + (LData[12] + C4 + ((LRegC or not LRegD) xor LRegAa)); + LRegBb := TBits.RotateLeft32(LRegBb, 5); - a := a + (LData[15] + C5 + ((b and cc) or (not b and dd))); - a := TBits.RotateLeft32(a, 9); - dd := dd + (LData[5] + C5 + ((a and b) or (not a and cc))); - dd := TBits.RotateLeft32(dd, 7); - cc := cc + (LData[1] + C5 + ((dd and a) or (not dd and b))); - cc := TBits.RotateLeft32(cc, 15); - b := b + (LData[3] + C5 + ((cc and dd) or (not cc and a))); - b := TBits.RotateLeft32(b, 11); - a := a + (LData[7] + C5 + ((b and cc) or (not b and dd))); - a := TBits.RotateLeft32(a, 8); - dd := dd + (LData[14] + C5 + ((a and b) or (not a and cc))); - dd := TBits.RotateLeft32(dd, 6); - cc := cc + (LData[6] + C5 + ((dd and a) or (not dd and b))); - cc := TBits.RotateLeft32(cc, 6); - b := b + (LData[9] + C5 + ((cc and dd) or (not cc and a))); - b := TBits.RotateLeft32(b, 14); - a := a + (LData[11] + C5 + ((b and cc) or (not b and dd))); - a := TBits.RotateLeft32(a, 12); - dd := dd + (LData[8] + C5 + ((a and b) or (not a and cc))); - dd := TBits.RotateLeft32(dd, 13); - cc := cc + (LData[12] + C5 + ((dd and a) or (not dd and b))); - cc := TBits.RotateLeft32(cc, 5); - b := b + (LData[2] + C5 + ((cc and dd) or (not cc and a))); - b := TBits.RotateLeft32(b, 14); - a := a + (LData[10] + C5 + ((b and cc) or (not b and dd))); - a := TBits.RotateLeft32(a, 13); - dd := dd + (LData[0] + C5 + ((a and b) or (not a and cc))); - dd := TBits.RotateLeft32(dd, 13); - cc := cc + (LData[4] + C5 + ((dd and a) or (not dd and b))); - cc := TBits.RotateLeft32(cc, 7); - b := b + (LData[13] + C5 + ((cc and dd) or (not cc and a))); - b := TBits.RotateLeft32(b, 5); + LRegA := LRegA + (LData[15] + C5 + ((LRegB and LRegCc) or (not LRegB and LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 9); + LRegDd := LRegDd + (LData[5] + C5 + ((LRegA and LRegB) or (not LRegA and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 7); + LRegCc := LRegCc + (LData[1] + C5 + ((LRegDd and LRegA) or (not LRegDd and LRegB))); + LRegCc := TBits.RotateLeft32(LRegCc, 15); + LRegB := LRegB + (LData[3] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 11); + LRegA := LRegA + (LData[7] + C5 + ((LRegB and LRegCc) or (not LRegB and LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 8); + LRegDd := LRegDd + (LData[14] + C5 + ((LRegA and LRegB) or (not LRegA and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 6); + LRegCc := LRegCc + (LData[6] + C5 + ((LRegDd and LRegA) or (not LRegDd and LRegB))); + LRegCc := TBits.RotateLeft32(LRegCc, 6); + LRegB := LRegB + (LData[9] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 14); + LRegA := LRegA + (LData[11] + C5 + ((LRegB and LRegCc) or (not LRegB and LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 12); + LRegDd := LRegDd + (LData[8] + C5 + ((LRegA and LRegB) or (not LRegA and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 13); + LRegCc := LRegCc + (LData[12] + C5 + ((LRegDd and LRegA) or (not LRegDd and LRegB))); + LRegCc := TBits.RotateLeft32(LRegCc, 5); + LRegB := LRegB + (LData[2] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 14); + LRegA := LRegA + (LData[10] + C5 + ((LRegB and LRegCc) or (not LRegB and LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 13); + LRegDd := LRegDd + (LData[0] + C5 + ((LRegA and LRegB) or (not LRegA and LRegCc))); + LRegDd := TBits.RotateLeft32(LRegDd, 13); + LRegCc := LRegCc + (LData[4] + C5 + ((LRegDd and LRegA) or (not LRegDd and LRegB))); + LRegCc := TBits.RotateLeft32(LRegCc, 7); + LRegB := LRegB + (LData[13] + C5 + ((LRegCc and LRegDd) or (not LRegCc and LRegA))); + LRegB := TBits.RotateLeft32(LRegB, 5); - aa := aa + (LData[1] + C6 + ((bb and d) or (cc and not d))); - aa := TBits.RotateLeft32(aa, 11); - d := d + (LData[9] + C6 + ((aa and cc) or (bb and not cc))); - d := TBits.RotateLeft32(d, 12); - cc := cc + (LData[11] + C6 + ((d and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 14); - bb := bb + (LData[10] + C6 + ((cc and aa) or (d and not aa))); - bb := TBits.RotateLeft32(bb, 15); - aa := aa + (LData[0] + C6 + ((bb and d) or (cc and not d))); - aa := TBits.RotateLeft32(aa, 14); - d := d + (LData[8] + C6 + ((aa and cc) or (bb and not cc))); - d := TBits.RotateLeft32(d, 15); - cc := cc + (LData[12] + C6 + ((d and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 9); - bb := bb + (LData[4] + C6 + ((cc and aa) or (d and not aa))); - bb := TBits.RotateLeft32(bb, 8); - aa := aa + (LData[13] + C6 + ((bb and d) or (cc and not d))); - aa := TBits.RotateLeft32(aa, 9); - d := d + (LData[3] + C6 + ((aa and cc) or (bb and not cc))); - d := TBits.RotateLeft32(d, 14); - cc := cc + (LData[7] + C6 + ((d and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 5); - bb := bb + (LData[15] + C6 + ((cc and aa) or (d and not aa))); - bb := TBits.RotateLeft32(bb, 6); - aa := aa + (LData[14] + C6 + ((bb and d) or (cc and not d))); - aa := TBits.RotateLeft32(aa, 8); - d := d + (LData[5] + C6 + ((aa and cc) or (bb and not cc))); - d := TBits.RotateLeft32(d, 6); - cc := cc + (LData[6] + C6 + ((d and bb) or (aa and not bb))); - cc := TBits.RotateLeft32(cc, 5); - bb := bb + (LData[2] + C6 + ((cc and aa) or (d and not aa))); - bb := TBits.RotateLeft32(bb, 12); + LRegAa := LRegAa + (LData[1] + C6 + ((LRegBb and LRegD) or (LRegCc and not LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 11); + LRegD := LRegD + (LData[9] + C6 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegD := TBits.RotateLeft32(LRegD, 12); + LRegCc := LRegCc + (LData[11] + C6 + ((LRegD and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 14); + LRegBb := LRegBb + (LData[10] + C6 + ((LRegCc and LRegAa) or (LRegD and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 15); + LRegAa := LRegAa + (LData[0] + C6 + ((LRegBb and LRegD) or (LRegCc and not LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 14); + LRegD := LRegD + (LData[8] + C6 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegD := TBits.RotateLeft32(LRegD, 15); + LRegCc := LRegCc + (LData[12] + C6 + ((LRegD and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 9); + LRegBb := LRegBb + (LData[4] + C6 + ((LRegCc and LRegAa) or (LRegD and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 8); + LRegAa := LRegAa + (LData[13] + C6 + ((LRegBb and LRegD) or (LRegCc and not LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 9); + LRegD := LRegD + (LData[3] + C6 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegD := TBits.RotateLeft32(LRegD, 14); + LRegCc := LRegCc + (LData[7] + C6 + ((LRegD and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 5); + LRegBb := LRegBb + (LData[15] + C6 + ((LRegCc and LRegAa) or (LRegD and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 6); + LRegAa := LRegAa + (LData[14] + C6 + ((LRegBb and LRegD) or (LRegCc and not LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 8); + LRegD := LRegD + (LData[5] + C6 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegD := TBits.RotateLeft32(LRegD, 6); + LRegCc := LRegCc + (LData[6] + C6 + ((LRegD and LRegBb) or (LRegAa and not LRegBb))); + LRegCc := TBits.RotateLeft32(LRegCc, 5); + LRegBb := LRegBb + (LData[2] + C6 + ((LRegCc and LRegAa) or (LRegD and not LRegAa))); + LRegBb := TBits.RotateLeft32(LRegBb, 12); - a := a + (LData[8] + (b xor c xor dd)); - a := TBits.RotateLeft32(a, 15); - dd := dd + (LData[6] + (a xor b xor c)); - dd := TBits.RotateLeft32(dd, 5); - c := c + (LData[4] + (dd xor a xor b)); - c := TBits.RotateLeft32(c, 8); - b := b + (LData[1] + (c xor dd xor a)); - b := TBits.RotateLeft32(b, 11); - a := a + (LData[3] + (b xor c xor dd)); - a := TBits.RotateLeft32(a, 14); - dd := dd + (LData[11] + (a xor b xor c)); - dd := TBits.RotateLeft32(dd, 14); - c := c + (LData[15] + (dd xor a xor b)); - c := TBits.RotateLeft32(c, 6); - b := b + (LData[0] + (c xor dd xor a)); - b := TBits.RotateLeft32(b, 14); - a := a + (LData[5] + (b xor c xor dd)); - a := TBits.RotateLeft32(a, 6); - dd := dd + (LData[12] + (a xor b xor c)); - dd := TBits.RotateLeft32(dd, 9); - c := c + (LData[2] + (dd xor a xor b)); - c := TBits.RotateLeft32(c, 12); - b := b + (LData[13] + (c xor dd xor a)); - b := TBits.RotateLeft32(b, 9); - a := a + (LData[9] + (b xor c xor dd)); - a := TBits.RotateLeft32(a, 12); - dd := dd + (LData[7] + (a xor b xor c)); - dd := TBits.RotateLeft32(dd, 5); - c := c + (LData[10] + (dd xor a xor b)); - c := TBits.RotateLeft32(c, 15); - b := b + (LData[14] + (c xor dd xor a)); - b := TBits.RotateLeft32(b, 8); + LRegA := LRegA + (LData[8] + (LRegB xor LRegC xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 15); + LRegDd := LRegDd + (LData[6] + (LRegA xor LRegB xor LRegC)); + LRegDd := TBits.RotateLeft32(LRegDd, 5); + LRegC := LRegC + (LData[4] + (LRegDd xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 8); + LRegB := LRegB + (LData[1] + (LRegC xor LRegDd xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 11); + LRegA := LRegA + (LData[3] + (LRegB xor LRegC xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 14); + LRegDd := LRegDd + (LData[11] + (LRegA xor LRegB xor LRegC)); + LRegDd := TBits.RotateLeft32(LRegDd, 14); + LRegC := LRegC + (LData[15] + (LRegDd xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 6); + LRegB := LRegB + (LData[0] + (LRegC xor LRegDd xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 14); + LRegA := LRegA + (LData[5] + (LRegB xor LRegC xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 6); + LRegDd := LRegDd + (LData[12] + (LRegA xor LRegB xor LRegC)); + LRegDd := TBits.RotateLeft32(LRegDd, 9); + LRegC := LRegC + (LData[2] + (LRegDd xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 12); + LRegB := LRegB + (LData[13] + (LRegC xor LRegDd xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 9); + LRegA := LRegA + (LData[9] + (LRegB xor LRegC xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 12); + LRegDd := LRegDd + (LData[7] + (LRegA xor LRegB xor LRegC)); + LRegDd := TBits.RotateLeft32(LRegDd, 5); + LRegC := LRegC + (LData[10] + (LRegDd xor LRegA xor LRegB)); + LRegC := TBits.RotateLeft32(LRegC, 15); + LRegB := LRegB + (LData[14] + (LRegC xor LRegDd xor LRegA)); + LRegB := TBits.RotateLeft32(LRegB, 8); - FState[0] := FState[0] + aa; - FState[1] := FState[1] + bb; - FState[2] := FState[2] + cc; - FState[3] := FState[3] + dd; - FState[4] := FState[4] + a; - FState[5] := FState[5] + b; - FState[6] := FState[6] + c; - FState[7] := FState[7] + d; + FState[0] := FState[0] + LRegAa; + FState[1] := FState[1] + LRegBb; + FState[2] := FState[2] + LRegCc; + FState[3] := FState[3] + LRegDd; + FState[4] := FState[4] + LRegA; + FState[5] := FState[5] + LRegB; + FState[6] := FState[6] + LRegC; + FState[7] := FState[7] + LRegD; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpRIPEMD320.pas b/HashLib/src/Crypto/HlpRIPEMD320.pas index 2d6faab7..3762ceb2 100644 --- a/HashLib/src/Crypto/HlpRIPEMD320.pas +++ b/HashLib/src/Crypto/HlpRIPEMD320.pas @@ -37,13 +37,13 @@ function TRIPEMD320.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRIPEMD320.Create; begin - Inherited Create(10, 40); + inherited Create(10, 40); end; procedure TRIPEMD320.Initialize; @@ -55,529 +55,529 @@ procedure TRIPEMD320.Initialize; FState[8] := $01234567; FState[9] := $3C2D1E0F; - Inherited Initialize(); + inherited Initialize(); end; procedure TRIPEMD320.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - a, b, c, d, e, aa, bb, cc, dd, ee: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegE, LRegAa, LRegBb, LRegCc, LRegDd, LRegEe: UInt32; LData: array [0 .. 15] of UInt32; begin TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - e := FState[4]; - aa := FState[5]; - bb := FState[6]; - cc := FState[7]; - dd := FState[8]; - ee := FState[9]; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegE := FState[4]; + LRegAa := FState[5]; + LRegBb := FState[6]; + LRegCc := FState[7]; + LRegDd := FState[8]; + LRegEe := FState[9]; - a := a + (LData[0] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 11) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[1] + (a xor b xor c)); - e := TBits.RotateLeft32(e, 14) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[2] + (e xor a xor b)); - d := TBits.RotateLeft32(d, 15) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[3] + (d xor e xor a)); - c := TBits.RotateLeft32(c, 12) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[4] + (c xor d xor e)); - b := TBits.RotateLeft32(b, 5) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[5] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 8) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[6] + (a xor b xor c)); - e := TBits.RotateLeft32(e, 7) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[7] + (e xor a xor b)); - d := TBits.RotateLeft32(d, 9) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[8] + (d xor e xor a)); - c := TBits.RotateLeft32(c, 11) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[9] + (c xor d xor e)); - b := TBits.RotateLeft32(b, 13) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[10] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 14) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[11] + (a xor b xor c)); - e := TBits.RotateLeft32(e, 15) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[12] + (e xor a xor b)); - d := TBits.RotateLeft32(d, 6) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[13] + (d xor e xor a)); - c := TBits.RotateLeft32(c, 7) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[14] + (c xor d xor e)); - b := TBits.RotateLeft32(b, 9) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[15] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 8) + e; - c := TBits.RotateLeft32(c, 10); + LRegA := LRegA + (LData[0] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 11) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[1] + (LRegA xor LRegB xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 14) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[2] + (LRegE xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 15) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[3] + (LRegD xor LRegE xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 12) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[4] + (LRegC xor LRegD xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 5) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[5] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 8) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[6] + (LRegA xor LRegB xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 7) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[7] + (LRegE xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[8] + (LRegD xor LRegE xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 11) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[9] + (LRegC xor LRegD xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 13) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[10] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 14) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[11] + (LRegA xor LRegB xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 15) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[12] + (LRegE xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 6) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[13] + (LRegD xor LRegE xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 7) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[14] + (LRegC xor LRegD xor LRegE)); + LRegB := TBits.RotateLeft32(LRegB, 9) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[15] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 8) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); - aa := aa + (LData[5] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 8) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[14] + C1 + (aa xor (bb or not cc))); - ee := TBits.RotateLeft32(ee, 9) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[7] + C1 + (ee xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 9) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[0] + C1 + (dd xor (ee or not aa))); - cc := TBits.RotateLeft32(cc, 11) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[9] + C1 + (cc xor (dd or not ee))); - bb := TBits.RotateLeft32(bb, 13) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[2] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 15) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[11] + C1 + (aa xor (bb or not cc))); - ee := TBits.RotateLeft32(ee, 15) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[4] + C1 + (ee xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 5) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[13] + C1 + (dd xor (ee or not aa))); - cc := TBits.RotateLeft32(cc, 7) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[6] + C1 + (cc xor (dd or not ee))); - bb := TBits.RotateLeft32(bb, 7) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[15] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 8) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[8] + C1 + (aa xor (bb or not cc))); - ee := TBits.RotateLeft32(ee, 11) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[1] + C1 + (ee xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 14) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[10] + C1 + (dd xor (ee or not aa))); - cc := TBits.RotateLeft32(cc, 14) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[3] + C1 + (cc xor (dd or not ee))); - bb := TBits.RotateLeft32(bb, 12) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[12] + C1 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 6) + ee; - cc := TBits.RotateLeft32(cc, 10); + LRegAa := LRegAa + (LData[5] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[14] + C1 + (LRegAa xor (LRegBb or not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 9) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[7] + C1 + (LRegEe xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[0] + C1 + (LRegDd xor (LRegEe or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 11) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[9] + C1 + (LRegCc xor (LRegDd or not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 13) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[2] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 15) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[11] + C1 + (LRegAa xor (LRegBb or not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 15) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[4] + C1 + (LRegEe xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 5) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[13] + C1 + (LRegDd xor (LRegEe or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 7) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[6] + C1 + (LRegCc xor (LRegDd or not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 7) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[15] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 8) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[8] + C1 + (LRegAa xor (LRegBb or not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 11) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[1] + C1 + (LRegEe xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 14) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[10] + C1 + (LRegDd xor (LRegEe or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 14) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[3] + C1 + (LRegCc xor (LRegDd or not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 12) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[12] + C1 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 6) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); - e := e + (LData[7] + C2 + ((aa and b) or (not aa and c))); - e := TBits.RotateLeft32(e, 7) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[4] + C2 + ((e and aa) or (not e and b))); - d := TBits.RotateLeft32(d, 6) + c; - aa := TBits.RotateLeft32(aa, 10); - c := c + (LData[13] + C2 + ((d and e) or (not d and aa))); - c := TBits.RotateLeft32(c, 8) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[1] + C2 + ((c and d) or (not c and e))); - b := TBits.RotateLeft32(b, 13) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[10] + C2 + ((b and c) or (not b and d))); - aa := TBits.RotateLeft32(aa, 11) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[6] + C2 + ((aa and b) or (not aa and c))); - e := TBits.RotateLeft32(e, 9) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[15] + C2 + ((e and aa) or (not e and b))); - d := TBits.RotateLeft32(d, 7) + c; - aa := TBits.RotateLeft32(aa, 10); - c := c + (LData[3] + C2 + ((d and e) or (not d and aa))); - c := TBits.RotateLeft32(c, 15) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[12] + C2 + ((c and d) or (not c and e))); - b := TBits.RotateLeft32(b, 7) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[0] + C2 + ((b and c) or (not b and d))); - aa := TBits.RotateLeft32(aa, 12) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[9] + C2 + ((aa and b) or (not aa and c))); - e := TBits.RotateLeft32(e, 15) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[5] + C2 + ((e and aa) or (not e and b))); - d := TBits.RotateLeft32(d, 9) + c; - aa := TBits.RotateLeft32(aa, 10); - c := c + (LData[2] + C2 + ((d and e) or (not d and aa))); - c := TBits.RotateLeft32(c, 11) + b; - e := TBits.RotateLeft32(e, 10); - b := b + (LData[14] + C2 + ((c and d) or (not c and e))); - b := TBits.RotateLeft32(b, 7) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[11] + C2 + ((b and c) or (not b and d))); - aa := TBits.RotateLeft32(aa, 13) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[8] + C2 + ((aa and b) or (not aa and c))); - e := TBits.RotateLeft32(e, 12) + d; - b := TBits.RotateLeft32(b, 10); + LRegE := LRegE + (LData[7] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 7) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[4] + C2 + ((LRegE and LRegAa) or (not LRegE and LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 6) + LRegC; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegC := LRegC + (LData[13] + C2 + ((LRegD and LRegE) or (not LRegD and LRegAa))); + LRegC := TBits.RotateLeft32(LRegC, 8) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[1] + C2 + ((LRegC and LRegD) or (not LRegC and LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 13) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[10] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 11) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[6] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 9) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[15] + C2 + ((LRegE and LRegAa) or (not LRegE and LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 7) + LRegC; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegC := LRegC + (LData[3] + C2 + ((LRegD and LRegE) or (not LRegD and LRegAa))); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[12] + C2 + ((LRegC and LRegD) or (not LRegC and LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 7) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[0] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 12) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[9] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 15) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[5] + C2 + ((LRegE and LRegAa) or (not LRegE and LRegB))); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegC; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegC := LRegC + (LData[2] + C2 + ((LRegD and LRegE) or (not LRegD and LRegAa))); + LRegC := TBits.RotateLeft32(LRegC, 11) + LRegB; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegB := LRegB + (LData[14] + C2 + ((LRegC and LRegD) or (not LRegC and LRegE))); + LRegB := TBits.RotateLeft32(LRegB, 7) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[11] + C2 + ((LRegB and LRegC) or (not LRegB and LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 13) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[8] + C2 + ((LRegAa and LRegB) or (not LRegAa and LRegC))); + LRegE := TBits.RotateLeft32(LRegE, 12) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); - ee := ee + (LData[6] + C3 + ((a and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 9) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[11] + C3 + ((ee and bb) or (a and not bb))); - dd := TBits.RotateLeft32(dd, 13) + cc; - a := TBits.RotateLeft32(a, 10); - cc := cc + (LData[3] + C3 + ((dd and a) or (ee and not a))); - cc := TBits.RotateLeft32(cc, 15) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[7] + C3 + ((cc and ee) or (dd and not ee))); - bb := TBits.RotateLeft32(bb, 7) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[0] + C3 + ((bb and dd) or (cc and not dd))); - a := TBits.RotateLeft32(a, 12) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[13] + C3 + ((a and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 8) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[5] + C3 + ((ee and bb) or (a and not bb))); - dd := TBits.RotateLeft32(dd, 9) + cc; - a := TBits.RotateLeft32(a, 10); - cc := cc + (LData[10] + C3 + ((dd and a) or (ee and not a))); - cc := TBits.RotateLeft32(cc, 11) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[14] + C3 + ((cc and ee) or (dd and not ee))); - bb := TBits.RotateLeft32(bb, 7) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[15] + C3 + ((bb and dd) or (cc and not dd))); - a := TBits.RotateLeft32(a, 7) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[8] + C3 + ((a and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 12) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[12] + C3 + ((ee and bb) or (a and not bb))); - dd := TBits.RotateLeft32(dd, 7) + cc; - a := TBits.RotateLeft32(a, 10); - cc := cc + (LData[4] + C3 + ((dd and a) or (ee and not a))); - cc := TBits.RotateLeft32(cc, 6) + bb; - ee := TBits.RotateLeft32(ee, 10); - bb := bb + (LData[9] + C3 + ((cc and ee) or (dd and not ee))); - bb := TBits.RotateLeft32(bb, 15) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[1] + C3 + ((bb and dd) or (cc and not dd))); - a := TBits.RotateLeft32(a, 13) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[2] + C3 + ((a and cc) or (bb and not cc))); - ee := TBits.RotateLeft32(ee, 11) + dd; - bb := TBits.RotateLeft32(bb, 10); + LRegEe := LRegEe + (LData[6] + C3 + ((LRegA and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 9) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[11] + C3 + ((LRegEe and LRegBb) or (LRegA and not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 13) + LRegCc; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegCc := LRegCc + (LData[3] + C3 + ((LRegDd and LRegA) or (LRegEe and not LRegA))); + LRegCc := TBits.RotateLeft32(LRegCc, 15) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[7] + C3 + ((LRegCc and LRegEe) or (LRegDd and not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 7) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[0] + C3 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 12) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[13] + C3 + ((LRegA and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 8) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[5] + C3 + ((LRegEe and LRegBb) or (LRegA and not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegCc := LRegCc + (LData[10] + C3 + ((LRegDd and LRegA) or (LRegEe and not LRegA))); + LRegCc := TBits.RotateLeft32(LRegCc, 11) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[14] + C3 + ((LRegCc and LRegEe) or (LRegDd and not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 7) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[15] + C3 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 7) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[8] + C3 + ((LRegA and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 12) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[12] + C3 + ((LRegEe and LRegBb) or (LRegA and not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 7) + LRegCc; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegCc := LRegCc + (LData[4] + C3 + ((LRegDd and LRegA) or (LRegEe and not LRegA))); + LRegCc := TBits.RotateLeft32(LRegCc, 6) + LRegBb; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegBb := LRegBb + (LData[9] + C3 + ((LRegCc and LRegEe) or (LRegDd and not LRegEe))); + LRegBb := TBits.RotateLeft32(LRegBb, 15) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[1] + C3 + ((LRegBb and LRegDd) or (LRegCc and not LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 13) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[2] + C3 + ((LRegA and LRegCc) or (LRegBb and not LRegCc))); + LRegEe := TBits.RotateLeft32(LRegEe, 11) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); - d := d + (LData[3] + C4 + ((e or not aa) xor bb)); - d := TBits.RotateLeft32(d, 11) + c; - aa := TBits.RotateLeft32(aa, 10); - c := c + (LData[10] + C4 + ((d or not e) xor aa)); - c := TBits.RotateLeft32(c, 13) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[14] + C4 + ((c or not d) xor e)); - bb := TBits.RotateLeft32(bb, 6) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[4] + C4 + ((bb or not c) xor d)); - aa := TBits.RotateLeft32(aa, 7) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[9] + C4 + ((aa or not bb) xor c)); - e := TBits.RotateLeft32(e, 14) + d; - bb := TBits.RotateLeft32(bb, 10); - d := d + (LData[15] + C4 + ((e or not aa) xor bb)); - d := TBits.RotateLeft32(d, 9) + c; - aa := TBits.RotateLeft32(aa, 10); - c := c + (LData[8] + C4 + ((d or not e) xor aa)); - c := TBits.RotateLeft32(c, 13) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[1] + C4 + ((c or not d) xor e)); - bb := TBits.RotateLeft32(bb, 15) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[2] + C4 + ((bb or not c) xor d)); - aa := TBits.RotateLeft32(aa, 14) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[7] + C4 + ((aa or not bb) xor c)); - e := TBits.RotateLeft32(e, 8) + d; - bb := TBits.RotateLeft32(bb, 10); - d := d + (LData[0] + C4 + ((e or not aa) xor bb)); - d := TBits.RotateLeft32(d, 13) + c; - aa := TBits.RotateLeft32(aa, 10); - c := c + (LData[6] + C4 + ((d or not e) xor aa)); - c := TBits.RotateLeft32(c, 6) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[13] + C4 + ((c or not d) xor e)); - bb := TBits.RotateLeft32(bb, 5) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[11] + C4 + ((bb or not c) xor d)); - aa := TBits.RotateLeft32(aa, 12) + e; - c := TBits.RotateLeft32(c, 10); - e := e + (LData[5] + C4 + ((aa or not bb) xor c)); - e := TBits.RotateLeft32(e, 7) + d; - bb := TBits.RotateLeft32(bb, 10); - d := d + (LData[12] + C4 + ((e or not aa) xor bb)); - d := TBits.RotateLeft32(d, 5) + c; - aa := TBits.RotateLeft32(aa, 10); + LRegD := LRegD + (LData[3] + C4 + ((LRegE or not LRegAa) xor LRegBb)); + LRegD := TBits.RotateLeft32(LRegD, 11) + LRegC; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegC := LRegC + (LData[10] + C4 + ((LRegD or not LRegE) xor LRegAa)); + LRegC := TBits.RotateLeft32(LRegC, 13) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[14] + C4 + ((LRegC or not LRegD) xor LRegE)); + LRegBb := TBits.RotateLeft32(LRegBb, 6) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[4] + C4 + ((LRegBb or not LRegC) xor LRegD)); + LRegAa := TBits.RotateLeft32(LRegAa, 7) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[9] + C4 + ((LRegAa or not LRegBb) xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 14) + LRegD; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegD := LRegD + (LData[15] + C4 + ((LRegE or not LRegAa) xor LRegBb)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegC; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegC := LRegC + (LData[8] + C4 + ((LRegD or not LRegE) xor LRegAa)); + LRegC := TBits.RotateLeft32(LRegC, 13) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[1] + C4 + ((LRegC or not LRegD) xor LRegE)); + LRegBb := TBits.RotateLeft32(LRegBb, 15) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[2] + C4 + ((LRegBb or not LRegC) xor LRegD)); + LRegAa := TBits.RotateLeft32(LRegAa, 14) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[7] + C4 + ((LRegAa or not LRegBb) xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 8) + LRegD; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegD := LRegD + (LData[0] + C4 + ((LRegE or not LRegAa) xor LRegBb)); + LRegD := TBits.RotateLeft32(LRegD, 13) + LRegC; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegC := LRegC + (LData[6] + C4 + ((LRegD or not LRegE) xor LRegAa)); + LRegC := TBits.RotateLeft32(LRegC, 6) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[13] + C4 + ((LRegC or not LRegD) xor LRegE)); + LRegBb := TBits.RotateLeft32(LRegBb, 5) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[11] + C4 + ((LRegBb or not LRegC) xor LRegD)); + LRegAa := TBits.RotateLeft32(LRegAa, 12) + LRegE; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegE := LRegE + (LData[5] + C4 + ((LRegAa or not LRegBb) xor LRegC)); + LRegE := TBits.RotateLeft32(LRegE, 7) + LRegD; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegD := LRegD + (LData[12] + C4 + ((LRegE or not LRegAa) xor LRegBb)); + LRegD := TBits.RotateLeft32(LRegD, 5) + LRegC; + LRegAa := TBits.RotateLeft32(LRegAa, 10); - dd := dd + (LData[15] + C5 + ((ee or not a) xor b)); - dd := TBits.RotateLeft32(dd, 9) + cc; - a := TBits.RotateLeft32(a, 10); - cc := cc + (LData[5] + C5 + ((dd or not ee) xor a)); - cc := TBits.RotateLeft32(cc, 7) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[1] + C5 + ((cc or not dd) xor ee)); - b := TBits.RotateLeft32(b, 15) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[3] + C5 + ((b or not cc) xor dd)); - a := TBits.RotateLeft32(a, 11) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[7] + C5 + ((a or not b) xor cc)); - ee := TBits.RotateLeft32(ee, 8) + dd; - b := TBits.RotateLeft32(b, 10); - dd := dd + (LData[14] + C5 + ((ee or not a) xor b)); - dd := TBits.RotateLeft32(dd, 6) + cc; - a := TBits.RotateLeft32(a, 10); - cc := cc + (LData[6] + C5 + ((dd or not ee) xor a)); - cc := TBits.RotateLeft32(cc, 6) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[9] + C5 + ((cc or not dd) xor ee)); - b := TBits.RotateLeft32(b, 14) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[11] + C5 + ((b or not cc) xor dd)); - a := TBits.RotateLeft32(a, 12) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[8] + C5 + ((a or not b) xor cc)); - ee := TBits.RotateLeft32(ee, 13) + dd; - b := TBits.RotateLeft32(b, 10); - dd := dd + (LData[12] + C5 + ((ee or not a) xor b)); - dd := TBits.RotateLeft32(dd, 5) + cc; - a := TBits.RotateLeft32(a, 10); - cc := cc + (LData[2] + C5 + ((dd or not ee) xor a)); - cc := TBits.RotateLeft32(cc, 14) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[10] + C5 + ((cc or not dd) xor ee)); - b := TBits.RotateLeft32(b, 13) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[0] + C5 + ((b or not cc) xor dd)); - a := TBits.RotateLeft32(a, 13) + ee; - cc := TBits.RotateLeft32(cc, 10); - ee := ee + (LData[4] + C5 + ((a or not b) xor cc)); - ee := TBits.RotateLeft32(ee, 7) + dd; - b := TBits.RotateLeft32(b, 10); - dd := dd + (LData[13] + C5 + ((ee or not a) xor b)); - dd := TBits.RotateLeft32(dd, 5) + cc; - a := TBits.RotateLeft32(a, 10); + LRegDd := LRegDd + (LData[15] + C5 + ((LRegEe or not LRegA) xor LRegB)); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegCc; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegCc := LRegCc + (LData[5] + C5 + ((LRegDd or not LRegEe) xor LRegA)); + LRegCc := TBits.RotateLeft32(LRegCc, 7) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[1] + C5 + ((LRegCc or not LRegDd) xor LRegEe)); + LRegB := TBits.RotateLeft32(LRegB, 15) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[3] + C5 + ((LRegB or not LRegCc) xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 11) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[7] + C5 + ((LRegA or not LRegB) xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 8) + LRegDd; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegDd := LRegDd + (LData[14] + C5 + ((LRegEe or not LRegA) xor LRegB)); + LRegDd := TBits.RotateLeft32(LRegDd, 6) + LRegCc; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegCc := LRegCc + (LData[6] + C5 + ((LRegDd or not LRegEe) xor LRegA)); + LRegCc := TBits.RotateLeft32(LRegCc, 6) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[9] + C5 + ((LRegCc or not LRegDd) xor LRegEe)); + LRegB := TBits.RotateLeft32(LRegB, 14) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[11] + C5 + ((LRegB or not LRegCc) xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 12) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[8] + C5 + ((LRegA or not LRegB) xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 13) + LRegDd; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegDd := LRegDd + (LData[12] + C5 + ((LRegEe or not LRegA) xor LRegB)); + LRegDd := TBits.RotateLeft32(LRegDd, 5) + LRegCc; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegCc := LRegCc + (LData[2] + C5 + ((LRegDd or not LRegEe) xor LRegA)); + LRegCc := TBits.RotateLeft32(LRegCc, 14) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[10] + C5 + ((LRegCc or not LRegDd) xor LRegEe)); + LRegB := TBits.RotateLeft32(LRegB, 13) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[0] + C5 + ((LRegB or not LRegCc) xor LRegDd)); + LRegA := TBits.RotateLeft32(LRegA, 13) + LRegEe; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegEe := LRegEe + (LData[4] + C5 + ((LRegA or not LRegB) xor LRegCc)); + LRegEe := TBits.RotateLeft32(LRegEe, 7) + LRegDd; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegDd := LRegDd + (LData[13] + C5 + ((LRegEe or not LRegA) xor LRegB)); + LRegDd := TBits.RotateLeft32(LRegDd, 5) + LRegCc; + LRegA := TBits.RotateLeft32(LRegA, 10); - cc := cc + (LData[1] + C6 + ((d and aa) or (e and not aa))); - cc := TBits.RotateLeft32(cc, 11) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[9] + C6 + ((cc and e) or (d and not e))); - bb := TBits.RotateLeft32(bb, 12) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[11] + C6 + ((bb and d) or (cc and not d))); - aa := TBits.RotateLeft32(aa, 14) + e; - cc := TBits.RotateLeft32(cc, 10); - e := e + (LData[10] + C6 + ((aa and cc) or (bb and not cc))); - e := TBits.RotateLeft32(e, 15) + d; - bb := TBits.RotateLeft32(bb, 10); - d := d + (LData[0] + C6 + ((e and bb) or (aa and not bb))); - d := TBits.RotateLeft32(d, 14) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[8] + C6 + ((d and aa) or (e and not aa))); - cc := TBits.RotateLeft32(cc, 15) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[12] + C6 + ((cc and e) or (d and not e))); - bb := TBits.RotateLeft32(bb, 9) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[4] + C6 + ((bb and d) or (cc and not d))); - aa := TBits.RotateLeft32(aa, 8) + e; - cc := TBits.RotateLeft32(cc, 10); - e := e + (LData[13] + C6 + ((aa and cc) or (bb and not cc))); - e := TBits.RotateLeft32(e, 9) + d; - bb := TBits.RotateLeft32(bb, 10); - d := d + (LData[3] + C6 + ((e and bb) or (aa and not bb))); - d := TBits.RotateLeft32(d, 14) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[7] + C6 + ((d and aa) or (e and not aa))); - cc := TBits.RotateLeft32(cc, 5) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[15] + C6 + ((cc and e) or (d and not e))); - bb := TBits.RotateLeft32(bb, 6) + aa; - d := TBits.RotateLeft32(d, 10); - aa := aa + (LData[14] + C6 + ((bb and d) or (cc and not d))); - aa := TBits.RotateLeft32(aa, 8) + e; - cc := TBits.RotateLeft32(cc, 10); - e := e + (LData[5] + C6 + ((aa and cc) or (bb and not cc))); - e := TBits.RotateLeft32(e, 6) + d; - bb := TBits.RotateLeft32(bb, 10); - d := d + (LData[6] + C6 + ((e and bb) or (aa and not bb))); - d := TBits.RotateLeft32(d, 5) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[2] + C6 + ((d and aa) or (e and not aa))); - cc := TBits.RotateLeft32(cc, 12) + bb; - e := TBits.RotateLeft32(e, 10); + LRegCc := LRegCc + (LData[1] + C6 + ((LRegD and LRegAa) or (LRegE and not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 11) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[9] + C6 + ((LRegCc and LRegE) or (LRegD and not LRegE))); + LRegBb := TBits.RotateLeft32(LRegBb, 12) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[11] + C6 + ((LRegBb and LRegD) or (LRegCc and not LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 14) + LRegE; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegE := LRegE + (LData[10] + C6 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegE := TBits.RotateLeft32(LRegE, 15) + LRegD; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegD := LRegD + (LData[0] + C6 + ((LRegE and LRegBb) or (LRegAa and not LRegBb))); + LRegD := TBits.RotateLeft32(LRegD, 14) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[8] + C6 + ((LRegD and LRegAa) or (LRegE and not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 15) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[12] + C6 + ((LRegCc and LRegE) or (LRegD and not LRegE))); + LRegBb := TBits.RotateLeft32(LRegBb, 9) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[4] + C6 + ((LRegBb and LRegD) or (LRegCc and not LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 8) + LRegE; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegE := LRegE + (LData[13] + C6 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegE := TBits.RotateLeft32(LRegE, 9) + LRegD; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegD := LRegD + (LData[3] + C6 + ((LRegE and LRegBb) or (LRegAa and not LRegBb))); + LRegD := TBits.RotateLeft32(LRegD, 14) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[7] + C6 + ((LRegD and LRegAa) or (LRegE and not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 5) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[15] + C6 + ((LRegCc and LRegE) or (LRegD and not LRegE))); + LRegBb := TBits.RotateLeft32(LRegBb, 6) + LRegAa; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegAa := LRegAa + (LData[14] + C6 + ((LRegBb and LRegD) or (LRegCc and not LRegD))); + LRegAa := TBits.RotateLeft32(LRegAa, 8) + LRegE; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegE := LRegE + (LData[5] + C6 + ((LRegAa and LRegCc) or (LRegBb and not LRegCc))); + LRegE := TBits.RotateLeft32(LRegE, 6) + LRegD; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegD := LRegD + (LData[6] + C6 + ((LRegE and LRegBb) or (LRegAa and not LRegBb))); + LRegD := TBits.RotateLeft32(LRegD, 5) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[2] + C6 + ((LRegD and LRegAa) or (LRegE and not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 12) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); - c := c + (LData[8] + C7 + ((dd and ee) or (not dd and a))); - c := TBits.RotateLeft32(c, 15) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[6] + C7 + ((c and dd) or (not c and ee))); - b := TBits.RotateLeft32(b, 5) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[4] + C7 + ((b and c) or (not b and dd))); - a := TBits.RotateLeft32(a, 8) + ee; - c := TBits.RotateLeft32(c, 10); - ee := ee + (LData[1] + C7 + ((a and b) or (not a and c))); - ee := TBits.RotateLeft32(ee, 11) + dd; - b := TBits.RotateLeft32(b, 10); - dd := dd + (LData[3] + C7 + ((ee and a) or (not ee and b))); - dd := TBits.RotateLeft32(dd, 14) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[11] + C7 + ((dd and ee) or (not dd and a))); - c := TBits.RotateLeft32(c, 14) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[15] + C7 + ((c and dd) or (not c and ee))); - b := TBits.RotateLeft32(b, 6) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[0] + C7 + ((b and c) or (not b and dd))); - a := TBits.RotateLeft32(a, 14) + ee; - c := TBits.RotateLeft32(c, 10); - ee := ee + (LData[5] + C7 + ((a and b) or (not a and c))); - ee := TBits.RotateLeft32(ee, 6) + dd; - b := TBits.RotateLeft32(b, 10); - dd := dd + (LData[12] + C7 + ((ee and a) or (not ee and b))); - dd := TBits.RotateLeft32(dd, 9) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[2] + C7 + ((dd and ee) or (not dd and a))); - c := TBits.RotateLeft32(c, 12) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[13] + C7 + ((c and dd) or (not c and ee))); - b := TBits.RotateLeft32(b, 9) + a; - dd := TBits.RotateLeft32(dd, 10); - a := a + (LData[9] + C7 + ((b and c) or (not b and dd))); - a := TBits.RotateLeft32(a, 12) + ee; - c := TBits.RotateLeft32(c, 10); - ee := ee + (LData[7] + C7 + ((a and b) or (not a and c))); - ee := TBits.RotateLeft32(ee, 5) + dd; - b := TBits.RotateLeft32(b, 10); - dd := dd + (LData[10] + C7 + ((ee and a) or (not ee and b))); - dd := TBits.RotateLeft32(dd, 15) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[14] + C7 + ((dd and ee) or (not dd and a))); - c := TBits.RotateLeft32(c, 8) + b; - ee := TBits.RotateLeft32(ee, 10); + LRegC := LRegC + (LData[8] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 15) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[6] + C7 + ((LRegC and LRegDd) or (not LRegC and LRegEe))); + LRegB := TBits.RotateLeft32(LRegB, 5) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[4] + C7 + ((LRegB and LRegC) or (not LRegB and LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 8) + LRegEe; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegEe := LRegEe + (LData[1] + C7 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegEe := TBits.RotateLeft32(LRegEe, 11) + LRegDd; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegDd := LRegDd + (LData[3] + C7 + ((LRegEe and LRegA) or (not LRegEe and LRegB))); + LRegDd := TBits.RotateLeft32(LRegDd, 14) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[11] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 14) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[15] + C7 + ((LRegC and LRegDd) or (not LRegC and LRegEe))); + LRegB := TBits.RotateLeft32(LRegB, 6) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[0] + C7 + ((LRegB and LRegC) or (not LRegB and LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 14) + LRegEe; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegEe := LRegEe + (LData[5] + C7 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegEe := TBits.RotateLeft32(LRegEe, 6) + LRegDd; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegDd := LRegDd + (LData[12] + C7 + ((LRegEe and LRegA) or (not LRegEe and LRegB))); + LRegDd := TBits.RotateLeft32(LRegDd, 9) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[2] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 12) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[13] + C7 + ((LRegC and LRegDd) or (not LRegC and LRegEe))); + LRegB := TBits.RotateLeft32(LRegB, 9) + LRegA; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegA := LRegA + (LData[9] + C7 + ((LRegB and LRegC) or (not LRegB and LRegDd))); + LRegA := TBits.RotateLeft32(LRegA, 12) + LRegEe; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegEe := LRegEe + (LData[7] + C7 + ((LRegA and LRegB) or (not LRegA and LRegC))); + LRegEe := TBits.RotateLeft32(LRegEe, 5) + LRegDd; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegDd := LRegDd + (LData[10] + C7 + ((LRegEe and LRegA) or (not LRegEe and LRegB))); + LRegDd := TBits.RotateLeft32(LRegDd, 15) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[14] + C7 + ((LRegDd and LRegEe) or (not LRegDd and LRegA))); + LRegC := TBits.RotateLeft32(LRegC, 8) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); - bb := bb + (LData[4] + C8 + (cc xor (dd or not e))); - bb := TBits.RotateLeft32(bb, 9) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[0] + C8 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 15) + e; - cc := TBits.RotateLeft32(cc, 10); - e := e + (LData[5] + C8 + (aa xor (bb or not cc))); - e := TBits.RotateLeft32(e, 5) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[9] + C8 + (e xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 11) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[7] + C8 + (dd xor (e or not aa))); - cc := TBits.RotateLeft32(cc, 6) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[12] + C8 + (cc xor (dd or not e))); - bb := TBits.RotateLeft32(bb, 8) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[2] + C8 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 13) + e; - cc := TBits.RotateLeft32(cc, 10); - e := e + (LData[10] + C8 + (aa xor (bb or not cc))); - e := TBits.RotateLeft32(e, 12) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[14] + C8 + (e xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 5) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[1] + C8 + (dd xor (e or not aa))); - cc := TBits.RotateLeft32(cc, 12) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[3] + C8 + (cc xor (dd or not e))); - bb := TBits.RotateLeft32(bb, 13) + aa; - dd := TBits.RotateLeft32(dd, 10); - aa := aa + (LData[8] + C8 + (bb xor (cc or not dd))); - aa := TBits.RotateLeft32(aa, 14) + e; - cc := TBits.RotateLeft32(cc, 10); - e := e + (LData[11] + C8 + (aa xor (bb or not cc))); - e := TBits.RotateLeft32(e, 11) + dd; - bb := TBits.RotateLeft32(bb, 10); - dd := dd + (LData[6] + C8 + (e xor (aa or not bb))); - dd := TBits.RotateLeft32(dd, 8) + cc; - aa := TBits.RotateLeft32(aa, 10); - cc := cc + (LData[15] + C8 + (dd xor (e or not aa))); - cc := TBits.RotateLeft32(cc, 5) + bb; - e := TBits.RotateLeft32(e, 10); - bb := bb + (LData[13] + C8 + (cc xor (dd or not e))); - bb := TBits.RotateLeft32(bb, 6) + aa; - dd := TBits.RotateLeft32(dd, 10); + LRegBb := LRegBb + (LData[4] + C8 + (LRegCc xor (LRegDd or not LRegE))); + LRegBb := TBits.RotateLeft32(LRegBb, 9) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[0] + C8 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 15) + LRegE; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegE := LRegE + (LData[5] + C8 + (LRegAa xor (LRegBb or not LRegCc))); + LRegE := TBits.RotateLeft32(LRegE, 5) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[9] + C8 + (LRegE xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 11) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[7] + C8 + (LRegDd xor (LRegE or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 6) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[12] + C8 + (LRegCc xor (LRegDd or not LRegE))); + LRegBb := TBits.RotateLeft32(LRegBb, 8) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[2] + C8 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 13) + LRegE; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegE := LRegE + (LData[10] + C8 + (LRegAa xor (LRegBb or not LRegCc))); + LRegE := TBits.RotateLeft32(LRegE, 12) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[14] + C8 + (LRegE xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 5) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[1] + C8 + (LRegDd xor (LRegE or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 12) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[3] + C8 + (LRegCc xor (LRegDd or not LRegE))); + LRegBb := TBits.RotateLeft32(LRegBb, 13) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); + LRegAa := LRegAa + (LData[8] + C8 + (LRegBb xor (LRegCc or not LRegDd))); + LRegAa := TBits.RotateLeft32(LRegAa, 14) + LRegE; + LRegCc := TBits.RotateLeft32(LRegCc, 10); + LRegE := LRegE + (LData[11] + C8 + (LRegAa xor (LRegBb or not LRegCc))); + LRegE := TBits.RotateLeft32(LRegE, 11) + LRegDd; + LRegBb := TBits.RotateLeft32(LRegBb, 10); + LRegDd := LRegDd + (LData[6] + C8 + (LRegE xor (LRegAa or not LRegBb))); + LRegDd := TBits.RotateLeft32(LRegDd, 8) + LRegCc; + LRegAa := TBits.RotateLeft32(LRegAa, 10); + LRegCc := LRegCc + (LData[15] + C8 + (LRegDd xor (LRegE or not LRegAa))); + LRegCc := TBits.RotateLeft32(LRegCc, 5) + LRegBb; + LRegE := TBits.RotateLeft32(LRegE, 10); + LRegBb := LRegBb + (LData[13] + C8 + (LRegCc xor (LRegDd or not LRegE))); + LRegBb := TBits.RotateLeft32(LRegBb, 6) + LRegAa; + LRegDd := TBits.RotateLeft32(LRegDd, 10); - b := b + (LData[12] + (c xor d xor ee)); - b := TBits.RotateLeft32(b, 8) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[15] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 5) + ee; - c := TBits.RotateLeft32(c, 10); - ee := ee + (LData[10] + (a xor b xor c)); - ee := TBits.RotateLeft32(ee, 12) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[4] + (ee xor a xor b)); - d := TBits.RotateLeft32(d, 9) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[1] + (d xor ee xor a)); - c := TBits.RotateLeft32(c, 12) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[5] + (c xor d xor ee)); - b := TBits.RotateLeft32(b, 5) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[8] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 14) + ee; - c := TBits.RotateLeft32(c, 10); - ee := ee + (LData[7] + (a xor b xor c)); - ee := TBits.RotateLeft32(ee, 6) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[6] + (ee xor a xor b)); - d := TBits.RotateLeft32(d, 8) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[2] + (d xor ee xor a)); - c := TBits.RotateLeft32(c, 13) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[13] + (c xor d xor ee)); - b := TBits.RotateLeft32(b, 6) + a; - d := TBits.RotateLeft32(d, 10); - a := a + (LData[14] + (b xor c xor d)); - a := TBits.RotateLeft32(a, 5) + ee; - c := TBits.RotateLeft32(c, 10); - ee := ee + (LData[0] + (a xor b xor c)); - ee := TBits.RotateLeft32(ee, 15) + d; - b := TBits.RotateLeft32(b, 10); - d := d + (LData[3] + (ee xor a xor b)); - d := TBits.RotateLeft32(d, 13) + c; - a := TBits.RotateLeft32(a, 10); - c := c + (LData[9] + (d xor ee xor a)); - c := TBits.RotateLeft32(c, 11) + b; - ee := TBits.RotateLeft32(ee, 10); - b := b + (LData[11] + (c xor d xor ee)); - b := TBits.RotateLeft32(b, 11) + a; - d := TBits.RotateLeft32(d, 10); + LRegB := LRegB + (LData[12] + (LRegC xor LRegD xor LRegEe)); + LRegB := TBits.RotateLeft32(LRegB, 8) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[15] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5) + LRegEe; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegEe := LRegEe + (LData[10] + (LRegA xor LRegB xor LRegC)); + LRegEe := TBits.RotateLeft32(LRegEe, 12) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[4] + (LRegEe xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 9) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[1] + (LRegD xor LRegEe xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 12) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[5] + (LRegC xor LRegD xor LRegEe)); + LRegB := TBits.RotateLeft32(LRegB, 5) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[8] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 14) + LRegEe; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegEe := LRegEe + (LData[7] + (LRegA xor LRegB xor LRegC)); + LRegEe := TBits.RotateLeft32(LRegEe, 6) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[6] + (LRegEe xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 8) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[2] + (LRegD xor LRegEe xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 13) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[13] + (LRegC xor LRegD xor LRegEe)); + LRegB := TBits.RotateLeft32(LRegB, 6) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); + LRegA := LRegA + (LData[14] + (LRegB xor LRegC xor LRegD)); + LRegA := TBits.RotateLeft32(LRegA, 5) + LRegEe; + LRegC := TBits.RotateLeft32(LRegC, 10); + LRegEe := LRegEe + (LData[0] + (LRegA xor LRegB xor LRegC)); + LRegEe := TBits.RotateLeft32(LRegEe, 15) + LRegD; + LRegB := TBits.RotateLeft32(LRegB, 10); + LRegD := LRegD + (LData[3] + (LRegEe xor LRegA xor LRegB)); + LRegD := TBits.RotateLeft32(LRegD, 13) + LRegC; + LRegA := TBits.RotateLeft32(LRegA, 10); + LRegC := LRegC + (LData[9] + (LRegD xor LRegEe xor LRegA)); + LRegC := TBits.RotateLeft32(LRegC, 11) + LRegB; + LRegEe := TBits.RotateLeft32(LRegEe, 10); + LRegB := LRegB + (LData[11] + (LRegC xor LRegD xor LRegEe)); + LRegB := TBits.RotateLeft32(LRegB, 11) + LRegA; + LRegD := TBits.RotateLeft32(LRegD, 10); - FState[0] := FState[0] + aa; - FState[1] := FState[1] + bb; - FState[2] := FState[2] + cc; - FState[3] := FState[3] + dd; - FState[4] := FState[4] + ee; - FState[5] := FState[5] + a; - FState[6] := FState[6] + b; - FState[7] := FState[7] + c; - FState[8] := FState[8] + d; - FState[9] := FState[9] + e; + FState[0] := FState[0] + LRegAa; + FState[1] := FState[1] + LRegBb; + FState[2] := FState[2] + LRegCc; + FState[3] := FState[3] + LRegDd; + FState[4] := FState[4] + LRegEe; + FState[5] := FState[5] + LRegA; + FState[6] := FState[6] + LRegB; + FState[7] := FState[7] + LRegC; + FState[8] := FState[8] + LRegD; + FState[9] := FState[9] + LRegE; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpRadioGatun32.pas b/HashLib/src/Crypto/HlpRadioGatun32.pas index 5d531724..7404d07c 100644 --- a/HashLib/src/Crypto/HlpRadioGatun32.pas +++ b/HashLib/src/Crypto/HlpRadioGatun32.pas @@ -49,15 +49,15 @@ function TRadioGatun32.Clone(): IHash; LHashInstance.FBelt := TArrayUtils.Clone(FBelt); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRadioGatun32.Create; var LIdx: Int32; begin - Inherited Create(32, 12); + inherited Create(32, 12); System.SetLength(FMill, 19); System.SetLength(FBelt, 13); @@ -95,7 +95,7 @@ function TRadioGatun32.GetResult: THashLibByteArray; begin System.SetLength(LBuffer, 8); - System.SetLength(result, System.Length(LBuffer) * System.SizeOf(UInt32)); + System.SetLength(Result, System.Length(LBuffer) * System.SizeOf(UInt32)); LIdx := 0; @@ -107,24 +107,24 @@ function TRadioGatun32.GetResult: THashLibByteArray; System.Inc(LIdx); end; - TConverters.le32_copy(PCardinal(LBuffer), 0, PByte(result), 0, - System.Length(result)); + TConverters.le32_copy(PCardinal(LBuffer), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TRadioGatun32.Initialize; begin TArrayUtils.ZeroFill(FMill); TArrayUtils.ZeroFill(FBelt); - Inherited Initialize(); + inherited Initialize(); end; procedure TRadioGatun32.RoundFunction; var - LQ: THashLibUInt32Array; - LA: array [0 .. 18] of UInt32; + LBeltQRow: THashLibUInt32Array; + LMillScratch: array [0 .. 18] of UInt32; LIdx: Int32; begin - LQ := FBelt[12]; + LBeltQRow := FBelt[12]; LIdx := 12; while LIdx > 0 do begin @@ -132,7 +132,7 @@ procedure TRadioGatun32.RoundFunction; System.Dec(LIdx); end; - FBelt[0] := LQ; + FBelt[0] := LBeltQRow; LIdx := 0; while LIdx < 12 do @@ -145,7 +145,7 @@ procedure TRadioGatun32.RoundFunction; LIdx := 0; while LIdx < 19 do begin - LA[LIdx] := FMill[LIdx] xor (FMill[(LIdx + 1) mod 19] or + LMillScratch[LIdx] := FMill[LIdx] xor (FMill[(LIdx + 1) mod 19] or not FMill[(LIdx + 2) mod 19]); System.Inc(LIdx); end; @@ -153,7 +153,7 @@ procedure TRadioGatun32.RoundFunction; LIdx := 0; while LIdx < 19 do begin - FMill[LIdx] := TBits.RotateRight32(LA[(7 * LIdx) mod 19], + FMill[LIdx] := TBits.RotateRight32(LMillScratch[(7 * LIdx) mod 19], (LIdx * (LIdx + 1)) shr 1); System.Inc(LIdx); end; @@ -161,24 +161,24 @@ procedure TRadioGatun32.RoundFunction; LIdx := 0; while LIdx < 19 do begin - LA[LIdx] := FMill[LIdx] xor FMill[(LIdx + 1) mod 19] xor FMill + LMillScratch[LIdx] := FMill[LIdx] xor FMill[(LIdx + 1) mod 19] xor FMill [(LIdx + 4) mod 19]; System.Inc(LIdx); end; - LA[0] := LA[0] xor 1; + LMillScratch[0] := LMillScratch[0] xor 1; LIdx := 0; while LIdx < 19 do begin - FMill[LIdx] := LA[LIdx]; + FMill[LIdx] := LMillScratch[LIdx]; System.Inc(LIdx); end; LIdx := 0; while LIdx < 3 do begin - FMill[LIdx + 13] := FMill[LIdx + 13] xor LQ[LIdx]; + FMill[LIdx + 13] := FMill[LIdx + 13] xor LBeltQRow[LIdx]; System.Inc(LIdx); end; diff --git a/HashLib/src/Crypto/HlpRadioGatun64.pas b/HashLib/src/Crypto/HlpRadioGatun64.pas index bb719130..1e1549ae 100644 --- a/HashLib/src/Crypto/HlpRadioGatun64.pas +++ b/HashLib/src/Crypto/HlpRadioGatun64.pas @@ -49,15 +49,15 @@ function TRadioGatun64.Clone(): IHash; LHashInstance.FBelt := TArrayUtils.Clone(FBelt); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRadioGatun64.Create; var LIdx: Int32; begin - Inherited Create(32, 24); + inherited Create(32, 24); System.SetLength(FMill, 19); System.SetLength(FBelt, 13); @@ -94,7 +94,7 @@ function TRadioGatun64.GetResult: THashLibByteArray; begin System.SetLength(LBuffer, 4); - System.SetLength(result, System.Length(LBuffer) * System.SizeOf(UInt64)); + System.SetLength(Result, System.Length(LBuffer) * System.SizeOf(UInt64)); LIdx := 0; while LIdx < 2 do @@ -105,24 +105,24 @@ function TRadioGatun64.GetResult: THashLibByteArray; System.Inc(LIdx); end; - TConverters.le64_copy(PCardinal(LBuffer), 0, PByte(result), 0, - System.Length(result)); + TConverters.le64_copy(PCardinal(LBuffer), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TRadioGatun64.Initialize; begin TArrayUtils.ZeroFill(FMill); TArrayUtils.ZeroFill(FBelt); - Inherited Initialize(); + inherited Initialize(); end; procedure TRadioGatun64.RoundFunction; var - LQ: THashLibUInt64Array; - LA: array [0 .. 18] of UInt64; + LBeltQRow: THashLibUInt64Array; + LMillScratch: array [0 .. 18] of UInt64; LIdx: Int32; begin - LQ := FBelt[12]; + LBeltQRow := FBelt[12]; LIdx := 12; while LIdx > 0 do begin @@ -130,7 +130,7 @@ procedure TRadioGatun64.RoundFunction; System.Dec(LIdx); end; - FBelt[0] := LQ; + FBelt[0] := LBeltQRow; LIdx := 0; while LIdx < 12 do @@ -143,7 +143,7 @@ procedure TRadioGatun64.RoundFunction; LIdx := 0; while LIdx < 19 do begin - LA[LIdx] := FMill[LIdx] xor (FMill[(LIdx + 1) mod 19] or + LMillScratch[LIdx] := FMill[LIdx] xor (FMill[(LIdx + 1) mod 19] or not FMill[(LIdx + 2) mod 19]); System.Inc(LIdx); end; @@ -151,7 +151,7 @@ procedure TRadioGatun64.RoundFunction; LIdx := 0; while LIdx < 19 do begin - FMill[LIdx] := TBits.RotateRight64(LA[(7 * LIdx) mod 19], + FMill[LIdx] := TBits.RotateRight64(LMillScratch[(7 * LIdx) mod 19], (LIdx * (LIdx + 1)) shr 1); System.Inc(LIdx); end; @@ -159,24 +159,24 @@ procedure TRadioGatun64.RoundFunction; LIdx := 0; while LIdx < 19 do begin - LA[LIdx] := FMill[LIdx] xor FMill[(LIdx + 1) mod 19] xor FMill + LMillScratch[LIdx] := FMill[LIdx] xor FMill[(LIdx + 1) mod 19] xor FMill [(LIdx + 4) mod 19]; System.Inc(LIdx); end; - LA[0] := LA[0] xor 1; + LMillScratch[0] := LMillScratch[0] xor 1; LIdx := 0; while LIdx < 19 do begin - FMill[LIdx] := LA[LIdx]; + FMill[LIdx] := LMillScratch[LIdx]; System.Inc(LIdx); end; LIdx := 0; while LIdx < 3 do begin - FMill[LIdx + 13] := FMill[LIdx + 13] xor LQ[LIdx]; + FMill[LIdx + 13] := FMill[LIdx + 13] xor LBeltQRow[LIdx]; System.Inc(LIdx); end; end; diff --git a/HashLib/src/Crypto/HlpSHA0.pas b/HashLib/src/Crypto/HlpSHA0.pas index 28241037..c88a3387 100644 --- a/HashLib/src/Crypto/HlpSHA0.pas +++ b/HashLib/src/Crypto/HlpSHA0.pas @@ -54,13 +54,13 @@ function TSHA0.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA0.Create; begin - Inherited Create(20, 64); + inherited Create(20, 64); System.SetLength(FState, 5); end; @@ -240,9 +240,9 @@ procedure TSHA0.Finish; function TSHA0.GetResult: THashLibByteArray; begin - System.SetLength(result, 5 * System.SizeOf(UInt32)); - TConverters.be32_copy(PCardinal(FState), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 5 * System.SizeOf(UInt32)); + TConverters.be32_copy(PCardinal(FState), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TSHA0.Initialize; @@ -252,12 +252,12 @@ procedure TSHA0.Initialize; FState[2] := $98BADCFE; FState[3] := $10325476; FState[4] := $C3D2E1F0; - Inherited Initialize(); + inherited Initialize(); end; procedure TSHA0.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - A, B, C, D, E: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegE: UInt32; LData: array [0 .. 79] of UInt32; LPtrData: PCardinal; begin @@ -267,298 +267,298 @@ procedure TSHA0.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); Expand(LPtrData); - A := FState[0]; - B := FState[1]; - C := FState[2]; - D := FState[3]; - E := FState[4]; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegE := FState[4]; - E := (LData[0] + C1 + TBits.RotateLeft32(A, 5) + - (D xor (B and (C xor D)))) + E; + LRegE := (LData[0] + C1 + TBits.RotateLeft32(LRegA, 5) + + (LRegD xor (LRegB and (LRegC xor LRegD)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[1] + C1 + TBits.RotateLeft32(E, 5) + - (C xor (A and (B xor C)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[1] + C1 + TBits.RotateLeft32(LRegE, 5) + + (LRegC xor (LRegA and (LRegB xor LRegC)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[2] + C1 + TBits.RotateLeft32(D, 5) + - (B xor (E and (A xor B)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[2] + C1 + TBits.RotateLeft32(LRegD, 5) + + (LRegB xor (LRegE and (LRegA xor LRegB)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[3] + C1 + TBits.RotateLeft32(C, 5) + - (A xor (D and (E xor A)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[3] + C1 + TBits.RotateLeft32(LRegC, 5) + + (LRegA xor (LRegD and (LRegE xor LRegA)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[4] + C1 + TBits.RotateLeft32(B, 5) + - (E xor (C and (D xor E)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[4] + C1 + TBits.RotateLeft32(LRegB, 5) + + (LRegE xor (LRegC and (LRegD xor LRegE)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[5] + C1 + TBits.RotateLeft32(A, 5) + - (D xor (B and (C xor D)))) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[5] + C1 + TBits.RotateLeft32(LRegA, 5) + + (LRegD xor (LRegB and (LRegC xor LRegD)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[6] + C1 + TBits.RotateLeft32(E, 5) + - (C xor (A and (B xor C)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[6] + C1 + TBits.RotateLeft32(LRegE, 5) + + (LRegC xor (LRegA and (LRegB xor LRegC)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[7] + C1 + TBits.RotateLeft32(D, 5) + - (B xor (E and (A xor B)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[7] + C1 + TBits.RotateLeft32(LRegD, 5) + + (LRegB xor (LRegE and (LRegA xor LRegB)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[8] + C1 + TBits.RotateLeft32(C, 5) + - (A xor (D and (E xor A)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[8] + C1 + TBits.RotateLeft32(LRegC, 5) + + (LRegA xor (LRegD and (LRegE xor LRegA)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[9] + C1 + TBits.RotateLeft32(B, 5) + - (E xor (C and (D xor E)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[9] + C1 + TBits.RotateLeft32(LRegB, 5) + + (LRegE xor (LRegC and (LRegD xor LRegE)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[10] + C1 + TBits.RotateLeft32(A, 5) + - (D xor (B and (C xor D)))) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[10] + C1 + TBits.RotateLeft32(LRegA, 5) + + (LRegD xor (LRegB and (LRegC xor LRegD)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[11] + C1 + TBits.RotateLeft32(E, 5) + - (C xor (A and (B xor C)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[11] + C1 + TBits.RotateLeft32(LRegE, 5) + + (LRegC xor (LRegA and (LRegB xor LRegC)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[12] + C1 + TBits.RotateLeft32(D, 5) + - (B xor (E and (A xor B)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[12] + C1 + TBits.RotateLeft32(LRegD, 5) + + (LRegB xor (LRegE and (LRegA xor LRegB)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[13] + C1 + TBits.RotateLeft32(C, 5) + - (A xor (D and (E xor A)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[13] + C1 + TBits.RotateLeft32(LRegC, 5) + + (LRegA xor (LRegD and (LRegE xor LRegA)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[14] + C1 + TBits.RotateLeft32(B, 5) + - (E xor (C and (D xor E)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[14] + C1 + TBits.RotateLeft32(LRegB, 5) + + (LRegE xor (LRegC and (LRegD xor LRegE)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[15] + C1 + TBits.RotateLeft32(A, 5) + - (D xor (B and (C xor D)))) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[15] + C1 + TBits.RotateLeft32(LRegA, 5) + + (LRegD xor (LRegB and (LRegC xor LRegD)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[16] + C1 + TBits.RotateLeft32(E, 5) + - (C xor (A and (B xor C)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[16] + C1 + TBits.RotateLeft32(LRegE, 5) + + (LRegC xor (LRegA and (LRegB xor LRegC)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[17] + C1 + TBits.RotateLeft32(D, 5) + - (B xor (E and (A xor B)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[17] + C1 + TBits.RotateLeft32(LRegD, 5) + + (LRegB xor (LRegE and (LRegA xor LRegB)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[18] + C1 + TBits.RotateLeft32(C, 5) + - (A xor (D and (E xor A)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[18] + C1 + TBits.RotateLeft32(LRegC, 5) + + (LRegA xor (LRegD and (LRegE xor LRegA)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[19] + C1 + TBits.RotateLeft32(B, 5) + - (E xor (C and (D xor E)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[19] + C1 + TBits.RotateLeft32(LRegB, 5) + + (LRegE xor (LRegC and (LRegD xor LRegE)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[20] + C2 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[20] + C2 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[21] + C2 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[21] + C2 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[22] + C2 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[22] + C2 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[23] + C2 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[23] + C2 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[24] + C2 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[24] + C2 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[25] + C2 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[25] + C2 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[26] + C2 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[26] + C2 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[27] + C2 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[27] + C2 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[28] + C2 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[28] + C2 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[29] + C2 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[29] + C2 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[30] + C2 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[30] + C2 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[31] + C2 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[31] + C2 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[32] + C2 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[32] + C2 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[33] + C2 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[33] + C2 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[34] + C2 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[34] + C2 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[35] + C2 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[35] + C2 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[36] + C2 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[36] + C2 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[37] + C2 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[37] + C2 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[38] + C2 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[38] + C2 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[39] + C2 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[39] + C2 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[40] + C3 + TBits.RotateLeft32(A, 5) + - ((B and C) or (D and (B or C)))) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[40] + C3 + TBits.RotateLeft32(LRegA, 5) + + ((LRegB and LRegC) or (LRegD and (LRegB or LRegC)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[41] + C3 + TBits.RotateLeft32(E, 5) + - ((A and B) or (C and (A or B)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[41] + C3 + TBits.RotateLeft32(LRegE, 5) + + ((LRegA and LRegB) or (LRegC and (LRegA or LRegB)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[42] + C3 + TBits.RotateLeft32(D, 5) + - ((E and A) or (B and (E or A)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[42] + C3 + TBits.RotateLeft32(LRegD, 5) + + ((LRegE and LRegA) or (LRegB and (LRegE or LRegA)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[43] + C3 + TBits.RotateLeft32(C, 5) + - ((D and E) or (A and (D or E)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[43] + C3 + TBits.RotateLeft32(LRegC, 5) + + ((LRegD and LRegE) or (LRegA and (LRegD or LRegE)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[44] + C3 + TBits.RotateLeft32(B, 5) + - ((C and D) or (E and (C or D)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[44] + C3 + TBits.RotateLeft32(LRegB, 5) + + ((LRegC and LRegD) or (LRegE and (LRegC or LRegD)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[45] + C3 + TBits.RotateLeft32(A, 5) + - ((B and C) or (D and (B or C)))) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[45] + C3 + TBits.RotateLeft32(LRegA, 5) + + ((LRegB and LRegC) or (LRegD and (LRegB or LRegC)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[46] + C3 + TBits.RotateLeft32(E, 5) + - ((A and B) or (C and (A or B)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[46] + C3 + TBits.RotateLeft32(LRegE, 5) + + ((LRegA and LRegB) or (LRegC and (LRegA or LRegB)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[47] + C3 + TBits.RotateLeft32(D, 5) + - ((E and A) or (B and (E or A)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[47] + C3 + TBits.RotateLeft32(LRegD, 5) + + ((LRegE and LRegA) or (LRegB and (LRegE or LRegA)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[48] + C3 + TBits.RotateLeft32(C, 5) + - ((D and E) or (A and (D or E)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[48] + C3 + TBits.RotateLeft32(LRegC, 5) + + ((LRegD and LRegE) or (LRegA and (LRegD or LRegE)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[49] + C3 + TBits.RotateLeft32(B, 5) + - ((C and D) or (E and (C or D)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[49] + C3 + TBits.RotateLeft32(LRegB, 5) + + ((LRegC and LRegD) or (LRegE and (LRegC or LRegD)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[50] + C3 + TBits.RotateLeft32(A, 5) + - ((B and C) or (D and (B or C)))) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[50] + C3 + TBits.RotateLeft32(LRegA, 5) + + ((LRegB and LRegC) or (LRegD and (LRegB or LRegC)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[51] + C3 + TBits.RotateLeft32(E, 5) + - ((A and B) or (C and (A or B)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[51] + C3 + TBits.RotateLeft32(LRegE, 5) + + ((LRegA and LRegB) or (LRegC and (LRegA or LRegB)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[52] + C3 + TBits.RotateLeft32(D, 5) + - ((E and A) or (B and (E or A)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[52] + C3 + TBits.RotateLeft32(LRegD, 5) + + ((LRegE and LRegA) or (LRegB and (LRegE or LRegA)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[53] + C3 + TBits.RotateLeft32(C, 5) + - ((D and E) or (A and (D or E)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[53] + C3 + TBits.RotateLeft32(LRegC, 5) + + ((LRegD and LRegE) or (LRegA and (LRegD or LRegE)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[54] + C3 + TBits.RotateLeft32(B, 5) + - ((C and D) or (E and (C or D)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[54] + C3 + TBits.RotateLeft32(LRegB, 5) + + ((LRegC and LRegD) or (LRegE and (LRegC or LRegD)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[55] + C3 + TBits.RotateLeft32(A, 5) + - ((B and C) or (D and (B or C)))) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[55] + C3 + TBits.RotateLeft32(LRegA, 5) + + ((LRegB and LRegC) or (LRegD and (LRegB or LRegC)))) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[56] + C3 + TBits.RotateLeft32(E, 5) + - ((A and B) or (C and (A or B)))) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[56] + C3 + TBits.RotateLeft32(LRegE, 5) + + ((LRegA and LRegB) or (LRegC and (LRegA or LRegB)))) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[57] + C3 + TBits.RotateLeft32(D, 5) + - ((E and A) or (B and (E or A)))) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[57] + C3 + TBits.RotateLeft32(LRegD, 5) + + ((LRegE and LRegA) or (LRegB and (LRegE or LRegA)))) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[58] + C3 + TBits.RotateLeft32(C, 5) + - ((D and E) or (A and (D or E)))) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[58] + C3 + TBits.RotateLeft32(LRegC, 5) + + ((LRegD and LRegE) or (LRegA and (LRegD or LRegE)))) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[59] + C3 + TBits.RotateLeft32(B, 5) + - ((C and D) or (E and (C or D)))) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[59] + C3 + TBits.RotateLeft32(LRegB, 5) + + ((LRegC and LRegD) or (LRegE and (LRegC or LRegD)))) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[60] + C4 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[60] + C4 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[61] + C4 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[61] + C4 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[62] + C4 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[62] + C4 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[63] + C4 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[63] + C4 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[64] + C4 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[64] + C4 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[65] + C4 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[65] + C4 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[66] + C4 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[66] + C4 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[67] + C4 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[67] + C4 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[68] + C4 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[68] + C4 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[69] + C4 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[69] + C4 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[70] + C4 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[70] + C4 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[71] + C4 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[71] + C4 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[72] + C4 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[72] + C4 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[73] + C4 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[73] + C4 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[74] + C4 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[74] + C4 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); - E := (LData[75] + C4 + TBits.RotateLeft32(A, 5) + (B xor C xor D)) + E; + LRegC := TBits.RotateLeft32(LRegC, 30); + LRegE := (LData[75] + C4 + TBits.RotateLeft32(LRegA, 5) + (LRegB xor LRegC xor LRegD)) + LRegE; - B := TBits.RotateLeft32(B, 30); - D := (LData[76] + C4 + TBits.RotateLeft32(E, 5) + (A xor B xor C)) + D; + LRegB := TBits.RotateLeft32(LRegB, 30); + LRegD := (LData[76] + C4 + TBits.RotateLeft32(LRegE, 5) + (LRegA xor LRegB xor LRegC)) + LRegD; - A := TBits.RotateLeft32(A, 30); - C := (LData[77] + C4 + TBits.RotateLeft32(D, 5) + (E xor A xor B)) + C; + LRegA := TBits.RotateLeft32(LRegA, 30); + LRegC := (LData[77] + C4 + TBits.RotateLeft32(LRegD, 5) + (LRegE xor LRegA xor LRegB)) + LRegC; - E := TBits.RotateLeft32(E, 30); - B := (LData[78] + C4 + TBits.RotateLeft32(C, 5) + (D xor E xor A)) + B; + LRegE := TBits.RotateLeft32(LRegE, 30); + LRegB := (LData[78] + C4 + TBits.RotateLeft32(LRegC, 5) + (LRegD xor LRegE xor LRegA)) + LRegB; - D := TBits.RotateLeft32(D, 30); - A := (LData[79] + C4 + TBits.RotateLeft32(B, 5) + (C xor D xor E)) + A; + LRegD := TBits.RotateLeft32(LRegD, 30); + LRegA := (LData[79] + C4 + TBits.RotateLeft32(LRegB, 5) + (LRegC xor LRegD xor LRegE)) + LRegA; - C := TBits.RotateLeft32(C, 30); + LRegC := TBits.RotateLeft32(LRegC, 30); - FState[0] := FState[0] + A; - FState[1] := FState[1] + B; - FState[2] := FState[2] + C; - FState[3] := FState[3] + D; - FState[4] := FState[4] + E; + FState[0] := FState[0] + LRegA; + FState[1] := FState[1] + LRegB; + FState[2] := FState[2] + LRegC; + FState[3] := FState[3] + LRegD; + FState[4] := FState[4] + LRegE; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpSHA1.pas b/HashLib/src/Crypto/HlpSHA1.pas index 567dce0e..7e3b81c7 100644 --- a/HashLib/src/Crypto/HlpSHA1.pas +++ b/HashLib/src/Crypto/HlpSHA1.pas @@ -36,13 +36,13 @@ function TSHA1.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA1.Create; begin - Inherited Create(); + inherited Create(); end; procedure TSHA1.Expand(AData: PCardinal); @@ -50,145 +50,145 @@ procedure TSHA1.Expand(AData: PCardinal); {$IFNDEF USE_UNROLLED_VARIANT} LIdx: Int32; {$ENDIF USE_UNROLLED_VARIANT} - LT: UInt32; + LScheduleTemp: UInt32; begin {$IFDEF USE_UNROLLED_VARIANT} - LT := AData[16 - 3] xor AData[16 - 8] xor AData[16 - 14] xor AData[0]; - AData[16] := TBits.RotateLeft32(LT, 1); - LT := AData[17 - 3] xor AData[17 - 8] xor AData[17 - 14] xor AData[17 - 16]; - AData[17] := TBits.RotateLeft32(LT, 1); - LT := AData[18 - 3] xor AData[18 - 8] xor AData[18 - 14] xor AData[18 - 16]; - AData[18] := TBits.RotateLeft32(LT, 1); - LT := AData[19 - 3] xor AData[19 - 8] xor AData[19 - 14] xor AData[19 - 16]; - AData[19] := TBits.RotateLeft32(LT, 1); - LT := AData[20 - 3] xor AData[20 - 8] xor AData[20 - 14] xor AData[20 - 16]; - AData[20] := TBits.RotateLeft32(LT, 1); - LT := AData[21 - 3] xor AData[21 - 8] xor AData[21 - 14] xor AData[21 - 16]; - AData[21] := TBits.RotateLeft32(LT, 1); - LT := AData[22 - 3] xor AData[22 - 8] xor AData[22 - 14] xor AData[22 - 16]; - AData[22] := TBits.RotateLeft32(LT, 1); - LT := AData[23 - 3] xor AData[23 - 8] xor AData[23 - 14] xor AData[23 - 16]; - AData[23] := TBits.RotateLeft32(LT, 1); - LT := AData[24 - 3] xor AData[24 - 8] xor AData[24 - 14] xor AData[24 - 16]; - AData[24] := TBits.RotateLeft32(LT, 1); - LT := AData[25 - 3] xor AData[25 - 8] xor AData[25 - 14] xor AData[25 - 16]; - AData[25] := TBits.RotateLeft32(LT, 1); - LT := AData[26 - 3] xor AData[26 - 8] xor AData[26 - 14] xor AData[26 - 16]; - AData[26] := TBits.RotateLeft32(LT, 1); - LT := AData[27 - 3] xor AData[27 - 8] xor AData[27 - 14] xor AData[27 - 16]; - AData[27] := TBits.RotateLeft32(LT, 1); - LT := AData[28 - 3] xor AData[28 - 8] xor AData[28 - 14] xor AData[28 - 16]; - AData[28] := TBits.RotateLeft32(LT, 1); - LT := AData[29 - 3] xor AData[29 - 8] xor AData[29 - 14] xor AData[29 - 16]; - AData[29] := TBits.RotateLeft32(LT, 1); - LT := AData[30 - 3] xor AData[30 - 8] xor AData[30 - 14] xor AData[30 - 16]; - AData[30] := TBits.RotateLeft32(LT, 1); - LT := AData[31 - 3] xor AData[31 - 8] xor AData[31 - 14] xor AData[31 - 16]; - AData[31] := TBits.RotateLeft32(LT, 1); - LT := AData[32 - 3] xor AData[32 - 8] xor AData[32 - 14] xor AData[32 - 16]; - AData[32] := TBits.RotateLeft32(LT, 1); - LT := AData[33 - 3] xor AData[33 - 8] xor AData[33 - 14] xor AData[33 - 16]; - AData[33] := TBits.RotateLeft32(LT, 1); - LT := AData[34 - 3] xor AData[34 - 8] xor AData[34 - 14] xor AData[34 - 16]; - AData[34] := TBits.RotateLeft32(LT, 1); - LT := AData[35 - 3] xor AData[35 - 8] xor AData[35 - 14] xor AData[35 - 16]; - AData[35] := TBits.RotateLeft32(LT, 1); - LT := AData[36 - 3] xor AData[36 - 8] xor AData[36 - 14] xor AData[36 - 16]; - AData[36] := TBits.RotateLeft32(LT, 1); - LT := AData[37 - 3] xor AData[37 - 8] xor AData[37 - 14] xor AData[37 - 16]; - AData[37] := TBits.RotateLeft32(LT, 1); - LT := AData[38 - 3] xor AData[38 - 8] xor AData[38 - 14] xor AData[38 - 16]; - AData[38] := TBits.RotateLeft32(LT, 1); - LT := AData[39 - 3] xor AData[39 - 8] xor AData[39 - 14] xor AData[39 - 16]; - AData[39] := TBits.RotateLeft32(LT, 1); - LT := AData[40 - 3] xor AData[40 - 8] xor AData[40 - 14] xor AData[40 - 16]; - AData[40] := TBits.RotateLeft32(LT, 1); - LT := AData[41 - 3] xor AData[41 - 8] xor AData[41 - 14] xor AData[41 - 16]; - AData[41] := TBits.RotateLeft32(LT, 1); - LT := AData[42 - 3] xor AData[42 - 8] xor AData[42 - 14] xor AData[42 - 16]; - AData[42] := TBits.RotateLeft32(LT, 1); - LT := AData[43 - 3] xor AData[43 - 8] xor AData[43 - 14] xor AData[43 - 16]; - AData[43] := TBits.RotateLeft32(LT, 1); - LT := AData[44 - 3] xor AData[44 - 8] xor AData[44 - 14] xor AData[44 - 16]; - AData[44] := TBits.RotateLeft32(LT, 1); - LT := AData[45 - 3] xor AData[45 - 8] xor AData[45 - 14] xor AData[45 - 16]; - AData[45] := TBits.RotateLeft32(LT, 1); - LT := AData[46 - 3] xor AData[46 - 8] xor AData[46 - 14] xor AData[46 - 16]; - AData[46] := TBits.RotateLeft32(LT, 1); - LT := AData[47 - 3] xor AData[47 - 8] xor AData[47 - 14] xor AData[47 - 16]; - AData[47] := TBits.RotateLeft32(LT, 1); - LT := AData[48 - 3] xor AData[48 - 8] xor AData[48 - 14] xor AData[48 - 16]; - AData[48] := TBits.RotateLeft32(LT, 1); - LT := AData[49 - 3] xor AData[49 - 8] xor AData[49 - 14] xor AData[49 - 16]; - AData[49] := TBits.RotateLeft32(LT, 1); - LT := AData[50 - 3] xor AData[50 - 8] xor AData[50 - 14] xor AData[50 - 16]; - AData[50] := TBits.RotateLeft32(LT, 1); - LT := AData[51 - 3] xor AData[51 - 8] xor AData[51 - 14] xor AData[51 - 16]; - AData[51] := TBits.RotateLeft32(LT, 1); - LT := AData[52 - 3] xor AData[52 - 8] xor AData[52 - 14] xor AData[52 - 16]; - AData[52] := TBits.RotateLeft32(LT, 1); - LT := AData[53 - 3] xor AData[53 - 8] xor AData[53 - 14] xor AData[53 - 16]; - AData[53] := TBits.RotateLeft32(LT, 1); - LT := AData[54 - 3] xor AData[54 - 8] xor AData[54 - 14] xor AData[54 - 16]; - AData[54] := TBits.RotateLeft32(LT, 1); - LT := AData[55 - 3] xor AData[55 - 8] xor AData[55 - 14] xor AData[55 - 16]; - AData[55] := TBits.RotateLeft32(LT, 1); - LT := AData[56 - 3] xor AData[56 - 8] xor AData[56 - 14] xor AData[56 - 16]; - AData[56] := TBits.RotateLeft32(LT, 1); - LT := AData[57 - 3] xor AData[57 - 8] xor AData[57 - 14] xor AData[57 - 16]; - AData[57] := TBits.RotateLeft32(LT, 1); - LT := AData[58 - 3] xor AData[58 - 8] xor AData[58 - 14] xor AData[58 - 16]; - AData[58] := TBits.RotateLeft32(LT, 1); - LT := AData[59 - 3] xor AData[59 - 8] xor AData[59 - 14] xor AData[59 - 16]; - AData[59] := TBits.RotateLeft32(LT, 1); - LT := AData[60 - 3] xor AData[60 - 8] xor AData[60 - 14] xor AData[60 - 16]; - AData[60] := TBits.RotateLeft32(LT, 1); - LT := AData[61 - 3] xor AData[61 - 8] xor AData[61 - 14] xor AData[61 - 16]; - AData[61] := TBits.RotateLeft32(LT, 1); - LT := AData[62 - 3] xor AData[62 - 8] xor AData[62 - 14] xor AData[62 - 16]; - AData[62] := TBits.RotateLeft32(LT, 1); - LT := AData[63 - 3] xor AData[63 - 8] xor AData[63 - 14] xor AData[63 - 16]; - AData[63] := TBits.RotateLeft32(LT, 1); - LT := AData[64 - 3] xor AData[64 - 8] xor AData[64 - 14] xor AData[64 - 16]; - AData[64] := TBits.RotateLeft32(LT, 1); - LT := AData[65 - 3] xor AData[65 - 8] xor AData[65 - 14] xor AData[65 - 16]; - AData[65] := TBits.RotateLeft32(LT, 1); - LT := AData[66 - 3] xor AData[66 - 8] xor AData[66 - 14] xor AData[66 - 16]; - AData[66] := TBits.RotateLeft32(LT, 1); - LT := AData[67 - 3] xor AData[67 - 8] xor AData[67 - 14] xor AData[67 - 16]; - AData[67] := TBits.RotateLeft32(LT, 1); - LT := AData[68 - 3] xor AData[68 - 8] xor AData[68 - 14] xor AData[68 - 16]; - AData[68] := TBits.RotateLeft32(LT, 1); - LT := AData[69 - 3] xor AData[69 - 8] xor AData[69 - 14] xor AData[69 - 16]; - AData[69] := TBits.RotateLeft32(LT, 1); - LT := AData[70 - 3] xor AData[70 - 8] xor AData[70 - 14] xor AData[70 - 16]; - AData[70] := TBits.RotateLeft32(LT, 1); - LT := AData[71 - 3] xor AData[71 - 8] xor AData[71 - 14] xor AData[71 - 16]; - AData[71] := TBits.RotateLeft32(LT, 1); - LT := AData[72 - 3] xor AData[72 - 8] xor AData[72 - 14] xor AData[72 - 16]; - AData[72] := TBits.RotateLeft32(LT, 1); - LT := AData[73 - 3] xor AData[73 - 8] xor AData[73 - 14] xor AData[73 - 16]; - AData[73] := TBits.RotateLeft32(LT, 1); - LT := AData[74 - 3] xor AData[74 - 8] xor AData[74 - 14] xor AData[74 - 16]; - AData[74] := TBits.RotateLeft32(LT, 1); - LT := AData[75 - 3] xor AData[75 - 8] xor AData[75 - 14] xor AData[75 - 16]; - AData[75] := TBits.RotateLeft32(LT, 1); - LT := AData[76 - 3] xor AData[76 - 8] xor AData[76 - 14] xor AData[76 - 16]; - AData[76] := TBits.RotateLeft32(LT, 1); - LT := AData[77 - 3] xor AData[77 - 8] xor AData[77 - 14] xor AData[77 - 16]; - AData[77] := TBits.RotateLeft32(LT, 1); - LT := AData[78 - 3] xor AData[78 - 8] xor AData[78 - 14] xor AData[78 - 16]; - AData[78] := TBits.RotateLeft32(LT, 1); - LT := AData[79 - 3] xor AData[79 - 8] xor AData[79 - 14] xor AData[79 - 16]; - AData[79] := TBits.RotateLeft32(LT, 1); + LScheduleTemp := AData[16 - 3] xor AData[16 - 8] xor AData[16 - 14] xor AData[0]; + AData[16] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[17 - 3] xor AData[17 - 8] xor AData[17 - 14] xor AData[17 - 16]; + AData[17] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[18 - 3] xor AData[18 - 8] xor AData[18 - 14] xor AData[18 - 16]; + AData[18] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[19 - 3] xor AData[19 - 8] xor AData[19 - 14] xor AData[19 - 16]; + AData[19] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[20 - 3] xor AData[20 - 8] xor AData[20 - 14] xor AData[20 - 16]; + AData[20] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[21 - 3] xor AData[21 - 8] xor AData[21 - 14] xor AData[21 - 16]; + AData[21] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[22 - 3] xor AData[22 - 8] xor AData[22 - 14] xor AData[22 - 16]; + AData[22] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[23 - 3] xor AData[23 - 8] xor AData[23 - 14] xor AData[23 - 16]; + AData[23] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[24 - 3] xor AData[24 - 8] xor AData[24 - 14] xor AData[24 - 16]; + AData[24] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[25 - 3] xor AData[25 - 8] xor AData[25 - 14] xor AData[25 - 16]; + AData[25] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[26 - 3] xor AData[26 - 8] xor AData[26 - 14] xor AData[26 - 16]; + AData[26] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[27 - 3] xor AData[27 - 8] xor AData[27 - 14] xor AData[27 - 16]; + AData[27] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[28 - 3] xor AData[28 - 8] xor AData[28 - 14] xor AData[28 - 16]; + AData[28] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[29 - 3] xor AData[29 - 8] xor AData[29 - 14] xor AData[29 - 16]; + AData[29] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[30 - 3] xor AData[30 - 8] xor AData[30 - 14] xor AData[30 - 16]; + AData[30] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[31 - 3] xor AData[31 - 8] xor AData[31 - 14] xor AData[31 - 16]; + AData[31] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[32 - 3] xor AData[32 - 8] xor AData[32 - 14] xor AData[32 - 16]; + AData[32] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[33 - 3] xor AData[33 - 8] xor AData[33 - 14] xor AData[33 - 16]; + AData[33] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[34 - 3] xor AData[34 - 8] xor AData[34 - 14] xor AData[34 - 16]; + AData[34] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[35 - 3] xor AData[35 - 8] xor AData[35 - 14] xor AData[35 - 16]; + AData[35] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[36 - 3] xor AData[36 - 8] xor AData[36 - 14] xor AData[36 - 16]; + AData[36] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[37 - 3] xor AData[37 - 8] xor AData[37 - 14] xor AData[37 - 16]; + AData[37] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[38 - 3] xor AData[38 - 8] xor AData[38 - 14] xor AData[38 - 16]; + AData[38] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[39 - 3] xor AData[39 - 8] xor AData[39 - 14] xor AData[39 - 16]; + AData[39] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[40 - 3] xor AData[40 - 8] xor AData[40 - 14] xor AData[40 - 16]; + AData[40] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[41 - 3] xor AData[41 - 8] xor AData[41 - 14] xor AData[41 - 16]; + AData[41] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[42 - 3] xor AData[42 - 8] xor AData[42 - 14] xor AData[42 - 16]; + AData[42] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[43 - 3] xor AData[43 - 8] xor AData[43 - 14] xor AData[43 - 16]; + AData[43] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[44 - 3] xor AData[44 - 8] xor AData[44 - 14] xor AData[44 - 16]; + AData[44] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[45 - 3] xor AData[45 - 8] xor AData[45 - 14] xor AData[45 - 16]; + AData[45] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[46 - 3] xor AData[46 - 8] xor AData[46 - 14] xor AData[46 - 16]; + AData[46] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[47 - 3] xor AData[47 - 8] xor AData[47 - 14] xor AData[47 - 16]; + AData[47] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[48 - 3] xor AData[48 - 8] xor AData[48 - 14] xor AData[48 - 16]; + AData[48] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[49 - 3] xor AData[49 - 8] xor AData[49 - 14] xor AData[49 - 16]; + AData[49] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[50 - 3] xor AData[50 - 8] xor AData[50 - 14] xor AData[50 - 16]; + AData[50] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[51 - 3] xor AData[51 - 8] xor AData[51 - 14] xor AData[51 - 16]; + AData[51] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[52 - 3] xor AData[52 - 8] xor AData[52 - 14] xor AData[52 - 16]; + AData[52] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[53 - 3] xor AData[53 - 8] xor AData[53 - 14] xor AData[53 - 16]; + AData[53] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[54 - 3] xor AData[54 - 8] xor AData[54 - 14] xor AData[54 - 16]; + AData[54] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[55 - 3] xor AData[55 - 8] xor AData[55 - 14] xor AData[55 - 16]; + AData[55] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[56 - 3] xor AData[56 - 8] xor AData[56 - 14] xor AData[56 - 16]; + AData[56] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[57 - 3] xor AData[57 - 8] xor AData[57 - 14] xor AData[57 - 16]; + AData[57] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[58 - 3] xor AData[58 - 8] xor AData[58 - 14] xor AData[58 - 16]; + AData[58] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[59 - 3] xor AData[59 - 8] xor AData[59 - 14] xor AData[59 - 16]; + AData[59] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[60 - 3] xor AData[60 - 8] xor AData[60 - 14] xor AData[60 - 16]; + AData[60] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[61 - 3] xor AData[61 - 8] xor AData[61 - 14] xor AData[61 - 16]; + AData[61] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[62 - 3] xor AData[62 - 8] xor AData[62 - 14] xor AData[62 - 16]; + AData[62] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[63 - 3] xor AData[63 - 8] xor AData[63 - 14] xor AData[63 - 16]; + AData[63] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[64 - 3] xor AData[64 - 8] xor AData[64 - 14] xor AData[64 - 16]; + AData[64] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[65 - 3] xor AData[65 - 8] xor AData[65 - 14] xor AData[65 - 16]; + AData[65] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[66 - 3] xor AData[66 - 8] xor AData[66 - 14] xor AData[66 - 16]; + AData[66] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[67 - 3] xor AData[67 - 8] xor AData[67 - 14] xor AData[67 - 16]; + AData[67] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[68 - 3] xor AData[68 - 8] xor AData[68 - 14] xor AData[68 - 16]; + AData[68] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[69 - 3] xor AData[69 - 8] xor AData[69 - 14] xor AData[69 - 16]; + AData[69] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[70 - 3] xor AData[70 - 8] xor AData[70 - 14] xor AData[70 - 16]; + AData[70] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[71 - 3] xor AData[71 - 8] xor AData[71 - 14] xor AData[71 - 16]; + AData[71] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[72 - 3] xor AData[72 - 8] xor AData[72 - 14] xor AData[72 - 16]; + AData[72] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[73 - 3] xor AData[73 - 8] xor AData[73 - 14] xor AData[73 - 16]; + AData[73] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[74 - 3] xor AData[74 - 8] xor AData[74 - 14] xor AData[74 - 16]; + AData[74] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[75 - 3] xor AData[75 - 8] xor AData[75 - 14] xor AData[75 - 16]; + AData[75] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[76 - 3] xor AData[76 - 8] xor AData[76 - 14] xor AData[76 - 16]; + AData[76] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[77 - 3] xor AData[77 - 8] xor AData[77 - 14] xor AData[77 - 16]; + AData[77] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[78 - 3] xor AData[78 - 8] xor AData[78 - 14] xor AData[78 - 16]; + AData[78] := TBits.RotateLeft32(LScheduleTemp, 1); + LScheduleTemp := AData[79 - 3] xor AData[79 - 8] xor AData[79 - 14] xor AData[79 - 16]; + AData[79] := TBits.RotateLeft32(LScheduleTemp, 1); {$ELSE} for LIdx := 16 to 79 do begin - LT := AData[LIdx - 3] xor AData[LIdx - 8] xor AData[LIdx - 14] xor AData + LScheduleTemp := AData[LIdx - 3] xor AData[LIdx - 8] xor AData[LIdx - 14] xor AData [LIdx - 16]; - AData[LIdx] := TBits.RotateLeft32(LT, 1); + AData[LIdx] := TBits.RotateLeft32(LScheduleTemp, 1); end; {$ENDIF USE_UNROLLED_VARIANT} end; diff --git a/HashLib/src/Crypto/HlpSHA2_224.pas b/HashLib/src/Crypto/HlpSHA2_224.pas index 7cae3f2e..f5347f7f 100644 --- a/HashLib/src/Crypto/HlpSHA2_224.pas +++ b/HashLib/src/Crypto/HlpSHA2_224.pas @@ -35,20 +35,20 @@ function TSHA2_224.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA2_224.Create; begin - Inherited Create(28); + inherited Create(28); end; function TSHA2_224.GetResult: THashLibByteArray; begin - System.SetLength(result, 7 * System.SizeOf(UInt32)); - TConverters.be32_copy(PCardinal(FState), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 7 * System.SizeOf(UInt32)); + TConverters.be32_copy(PCardinal(FState), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TSHA2_224.Initialize; @@ -61,7 +61,7 @@ procedure TSHA2_224.Initialize; FState[5] := $68581511; FState[6] := $64F98FA7; FState[7] := $BEFA4FA4; - Inherited Initialize(); + inherited Initialize(); end; end. diff --git a/HashLib/src/Crypto/HlpSHA2_256.pas b/HashLib/src/Crypto/HlpSHA2_256.pas index df0ada73..fadb1f75 100644 --- a/HashLib/src/Crypto/HlpSHA2_256.pas +++ b/HashLib/src/Crypto/HlpSHA2_256.pas @@ -35,20 +35,20 @@ function TSHA2_256.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA2_256.Create; begin - Inherited Create(32); + inherited Create(32); end; function TSHA2_256.GetResult: THashLibByteArray; begin - System.SetLength(result, 8 * System.SizeOf(UInt32)); - TConverters.be32_copy(PCardinal(FState), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 8 * System.SizeOf(UInt32)); + TConverters.be32_copy(PCardinal(FState), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TSHA2_256.Initialize; @@ -61,7 +61,7 @@ procedure TSHA2_256.Initialize; FState[5] := $9B05688C; FState[6] := $1F83D9AB; FState[7] := $5BE0CD19; - Inherited Initialize(); + inherited Initialize(); end; end. diff --git a/HashLib/src/Crypto/HlpSHA2_256Base.pas b/HashLib/src/Crypto/HlpSHA2_256Base.pas index d4f9477c..0c1c6a13 100644 --- a/HashLib/src/Crypto/HlpSHA2_256Base.pas +++ b/HashLib/src/Crypto/HlpSHA2_256Base.pas @@ -49,7 +49,7 @@ implementation constructor TSHA2_256Base.Create(AHashSize: Int32); begin - Inherited Create(AHashSize, 64); + inherited Create(AHashSize, 64); System.SetLength(FState, 8); end; @@ -83,856 +83,856 @@ procedure TSHA2_256Base.Finish; procedure TSHA2_256Base.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - A, B, C, D, E, F, G, H, T, T2: UInt32; + LRegA, LRegB, LRegC, LRegD, LRegE, LRegF, LRegG, LRegH, LT1, LT2: UInt32; {$IFNDEF USE_UNROLLED_VARIANT} - LR: Int32; + LRound: Int32; {$ENDIF USE_UNROLLED_VARIANT} LData: array [0 .. 63] of UInt32; begin TConverters.be32_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - A := FState[0]; - B := FState[1]; - C := FState[2]; - D := FState[3]; - E := FState[4]; - F := FState[5]; - G := FState[6]; - H := FState[7]; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegE := FState[4]; + LRegF := FState[5]; + LRegG := FState[6]; + LRegH := FState[7]; // Step 1 {$IFDEF USE_UNROLLED_VARIANT} - T := LData[14]; - T2 := LData[1]; - LData[16] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[9] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[0]; - - T := LData[15]; - T2 := LData[2]; - LData[17] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[10] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[1]; - - T := LData[16]; - T2 := LData[3]; - LData[18] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[11] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[2]; - - T := LData[17]; - T2 := LData[4]; - LData[19] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[12] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[3]; - - T := LData[18]; - T2 := LData[5]; - LData[20] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[13] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[4]; - - T := LData[19]; - T2 := LData[6]; - LData[21] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[14] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[5]; - - T := LData[20]; - T2 := LData[7]; - LData[22] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[15] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[6]; - - T := LData[21]; - T2 := LData[8]; - LData[23] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[16] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[7]; - - T := LData[22]; - T2 := LData[9]; - LData[24] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[17] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[8]; - - T := LData[23]; - T2 := LData[10]; - LData[25] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[18] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[9]; - - T := LData[24]; - T2 := LData[11]; - LData[26] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[19] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[10]; - - T := LData[25]; - T2 := LData[12]; - LData[27] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[20] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[11]; - - T := LData[26]; - T2 := LData[13]; - LData[28] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[21] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[12]; - - T := LData[27]; - T2 := LData[14]; - LData[29] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[22] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[13]; - - T := LData[28]; - T2 := LData[15]; - LData[30] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[23] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[14]; - - T := LData[29]; - T2 := LData[16]; - LData[31] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[24] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[15]; - - T := LData[30]; - T2 := LData[17]; - LData[32] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[25] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[16]; - - T := LData[31]; - T2 := LData[18]; - LData[33] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[26] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[17]; - - T := LData[32]; - T2 := LData[19]; - LData[34] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[27] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[18]; - - T := LData[33]; - T2 := LData[20]; - LData[35] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[28] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[19]; - - T := LData[34]; - T2 := LData[21]; - LData[36] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[29] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[20]; - - T := LData[35]; - T2 := LData[22]; - LData[37] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[30] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[21]; - - T := LData[36]; - T2 := LData[23]; - LData[38] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[31] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[22]; - - T := LData[37]; - T2 := LData[24]; - LData[39] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[32] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[23]; - - T := LData[38]; - T2 := LData[25]; - LData[40] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[33] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[24]; - - T := LData[39]; - T2 := LData[26]; - LData[41] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[34] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[25]; - - T := LData[40]; - T2 := LData[27]; - LData[42] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[35] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[26]; - - T := LData[41]; - T2 := LData[28]; - LData[43] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[36] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[27]; - - T := LData[42]; - T2 := LData[29]; - LData[44] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[37] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[28]; - - T := LData[43]; - T2 := LData[30]; - LData[45] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[38] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[29]; - - T := LData[44]; - T2 := LData[31]; - LData[46] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[39] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[30]; - - T := LData[45]; - T2 := LData[32]; - LData[47] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[40] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[31]; - - T := LData[46]; - T2 := LData[33]; - LData[48] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[41] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[32]; - - T := LData[47]; - T2 := LData[34]; - LData[49] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[42] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[33]; - - T := LData[48]; - T2 := LData[35]; - LData[50] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[43] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[34]; - - T := LData[49]; - T2 := LData[36]; - LData[51] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[44] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[35]; - - T := LData[50]; - T2 := LData[37]; - LData[52] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[45] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[36]; - - T := LData[51]; - T2 := LData[38]; - LData[53] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[46] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[37]; - - T := LData[52]; - T2 := LData[39]; - LData[54] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[47] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[38]; - - T := LData[53]; - T2 := LData[40]; - LData[55] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[48] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[39]; - - T := LData[54]; - T2 := LData[41]; - LData[56] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[49] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[40]; - - T := LData[55]; - T2 := LData[42]; - LData[57] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[50] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[41]; - - T := LData[56]; - T2 := LData[43]; - LData[58] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[51] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[42]; - - T := LData[57]; - T2 := LData[44]; - LData[59] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[52] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[43]; - - T := LData[58]; - T2 := LData[45]; - LData[60] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[53] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[44]; - - T := LData[59]; - T2 := LData[46]; - LData[61] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[54] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[45]; - - T := LData[60]; - T2 := LData[47]; - LData[62] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[55] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[46]; - - T := LData[61]; - T2 := LData[48]; - LData[63] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[56] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[47]; + LT1 := LData[14]; + LT2 := LData[1]; + LData[16] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[9] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[0]; + + LT1 := LData[15]; + LT2 := LData[2]; + LData[17] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[10] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[1]; + + LT1 := LData[16]; + LT2 := LData[3]; + LData[18] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[11] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[2]; + + LT1 := LData[17]; + LT2 := LData[4]; + LData[19] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[12] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[3]; + + LT1 := LData[18]; + LT2 := LData[5]; + LData[20] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[13] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[4]; + + LT1 := LData[19]; + LT2 := LData[6]; + LData[21] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[14] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[5]; + + LT1 := LData[20]; + LT2 := LData[7]; + LData[22] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[15] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[6]; + + LT1 := LData[21]; + LT2 := LData[8]; + LData[23] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[16] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[7]; + + LT1 := LData[22]; + LT2 := LData[9]; + LData[24] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[17] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[8]; + + LT1 := LData[23]; + LT2 := LData[10]; + LData[25] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[18] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[9]; + + LT1 := LData[24]; + LT2 := LData[11]; + LData[26] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[19] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[10]; + + LT1 := LData[25]; + LT2 := LData[12]; + LData[27] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[20] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[11]; + + LT1 := LData[26]; + LT2 := LData[13]; + LData[28] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[21] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[12]; + + LT1 := LData[27]; + LT2 := LData[14]; + LData[29] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[22] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[13]; + + LT1 := LData[28]; + LT2 := LData[15]; + LData[30] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[23] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[14]; + + LT1 := LData[29]; + LT2 := LData[16]; + LData[31] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[24] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[15]; + + LT1 := LData[30]; + LT2 := LData[17]; + LData[32] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[25] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[16]; + + LT1 := LData[31]; + LT2 := LData[18]; + LData[33] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[26] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[17]; + + LT1 := LData[32]; + LT2 := LData[19]; + LData[34] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[27] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[18]; + + LT1 := LData[33]; + LT2 := LData[20]; + LData[35] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[28] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[19]; + + LT1 := LData[34]; + LT2 := LData[21]; + LData[36] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[29] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[20]; + + LT1 := LData[35]; + LT2 := LData[22]; + LData[37] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[30] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[21]; + + LT1 := LData[36]; + LT2 := LData[23]; + LData[38] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[31] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[22]; + + LT1 := LData[37]; + LT2 := LData[24]; + LData[39] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[32] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[23]; + + LT1 := LData[38]; + LT2 := LData[25]; + LData[40] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[33] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[24]; + + LT1 := LData[39]; + LT2 := LData[26]; + LData[41] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[34] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[25]; + + LT1 := LData[40]; + LT2 := LData[27]; + LData[42] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[35] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[26]; + + LT1 := LData[41]; + LT2 := LData[28]; + LData[43] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[36] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[27]; + + LT1 := LData[42]; + LT2 := LData[29]; + LData[44] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[37] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[28]; + + LT1 := LData[43]; + LT2 := LData[30]; + LData[45] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[38] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[29]; + + LT1 := LData[44]; + LT2 := LData[31]; + LData[46] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[39] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[30]; + + LT1 := LData[45]; + LT2 := LData[32]; + LData[47] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[40] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[31]; + + LT1 := LData[46]; + LT2 := LData[33]; + LData[48] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[41] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[32]; + + LT1 := LData[47]; + LT2 := LData[34]; + LData[49] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[42] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[33]; + + LT1 := LData[48]; + LT2 := LData[35]; + LData[50] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[43] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[34]; + + LT1 := LData[49]; + LT2 := LData[36]; + LData[51] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[44] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[35]; + + LT1 := LData[50]; + LT2 := LData[37]; + LData[52] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[45] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[36]; + + LT1 := LData[51]; + LT2 := LData[38]; + LData[53] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[46] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[37]; + + LT1 := LData[52]; + LT2 := LData[39]; + LData[54] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[47] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[38]; + + LT1 := LData[53]; + LT2 := LData[40]; + LData[55] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[48] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[39]; + + LT1 := LData[54]; + LT2 := LData[41]; + LData[56] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[49] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[40]; + + LT1 := LData[55]; + LT2 := LData[42]; + LData[57] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[50] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[41]; + + LT1 := LData[56]; + LT2 := LData[43]; + LData[58] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[51] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[42]; + + LT1 := LData[57]; + LT2 := LData[44]; + LData[59] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[52] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[43]; + + LT1 := LData[58]; + LT2 := LData[45]; + LData[60] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[53] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[44]; + + LT1 := LData[59]; + LT2 := LData[46]; + LData[61] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[54] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[45]; + + LT1 := LData[60]; + LT2 := LData[47]; + LData[62] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[55] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[46]; + + LT1 := LData[61]; + LT2 := LData[48]; + LData[63] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[56] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[47]; // Step 2 - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $428A2F98 + LData[0]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $71374491 + LData[1]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $B5C0FBCF + LData[2]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $E9B5DBA5 + LData[3]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $3956C25B + LData[4]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $59F111F1 + LData[5]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $923F82A4 + LData[6]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $AB1C5ED5 + LData[7]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $D807AA98 + LData[8]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $12835B01 + LData[9]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $243185BE + LData[10]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $550C7DC3 + LData[11]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $72BE5D74 + LData[12]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $80DEB1FE + LData[13]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $9BDC06A7 + LData[14]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $C19BF174 + LData[15]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $E49B69C1 + LData[16]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $EFBE4786 + LData[17]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $0FC19DC6 + LData[18]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $240CA1CC + LData[19]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $2DE92C6F + LData[20]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $4A7484AA + LData[21]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $5CB0A9DC + LData[22]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $76F988DA + LData[23]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $983E5152 + LData[24]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $A831C66D + LData[25]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $B00327C8 + LData[26]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $BF597FC7 + LData[27]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $C6E00BF3 + LData[28]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $D5A79147 + LData[29]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $06CA6351 + LData[30]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $14292967 + LData[31]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $27B70A85 + LData[32]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $2E1B2138 + LData[33]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $4D2C6DFC + LData[34]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $53380D13 + LData[35]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $650A7354 + LData[36]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $766A0ABB + LData[37]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $81C2C92E + LData[38]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $92722C85 + LData[39]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $A2BFE8A1 + LData[40]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $A81A664B + LData[41]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $C24B8B70 + LData[42]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $C76C51A3 + LData[43]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $D192E819 + LData[44]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $D6990624 + LData[45]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $F40E3585 + LData[46]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $106AA070 + LData[47]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $19A4C116 + LData[48]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $1E376C08 + LData[49]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $2748774C + LData[50]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $34B0BCB5 + LData[51]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $391C0CB3 + LData[52]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $4ED8AA4A + LData[53]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $5B9CCA4F + LData[54]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $682E6FF3 + LData[55]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; - T := H + ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)) + + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; + LT1 := LRegH + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)) + $748F82EE + LData[56]; - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor ((A shr 22) xor (A shl 10))) + ((A and B) xor (A and C) xor (B and C)); - H := T + T2; - D := D + T; - T := G + ((TBits.RotateRight32(D, 6)) xor (TBits.RotateRight32(D, 11)) - xor (TBits.RotateRight32(D, 25))) + ((D and E) xor (not D and F)) + + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor ((LRegA shr 22) xor (LRegA shl 10))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + LRegH := LT1 + LT2; + LRegD := LRegD + LT1; + LT1 := LRegG + ((TBits.RotateRight32(LRegD, 6)) xor (TBits.RotateRight32(LRegD, 11)) + xor (TBits.RotateRight32(LRegD, 25))) + ((LRegD and LRegE) xor (not LRegD and LRegF)) + $78A5636F + LData[57]; - T2 := ((TBits.RotateRight32(H, 2)) xor (TBits.RotateRight32(H, 13)) - xor ((H shr 22) xor (H shl 10))) + ((H and A) xor (H and B) xor (A and B)); - G := T + T2; - C := C + T; - T := F + ((TBits.RotateRight32(C, 6)) xor (TBits.RotateRight32(C, 11)) - xor (TBits.RotateRight32(C, 25))) + ((C and D) xor (not C and E)) + + LT2 := ((TBits.RotateRight32(LRegH, 2)) xor (TBits.RotateRight32(LRegH, 13)) + xor ((LRegH shr 22) xor (LRegH shl 10))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB)); + LRegG := LT1 + LT2; + LRegC := LRegC + LT1; + LT1 := LRegF + ((TBits.RotateRight32(LRegC, 6)) xor (TBits.RotateRight32(LRegC, 11)) + xor (TBits.RotateRight32(LRegC, 25))) + ((LRegC and LRegD) xor (not LRegC and LRegE)) + $84C87814 + LData[58]; - T2 := ((TBits.RotateRight32(G, 2)) xor (TBits.RotateRight32(G, 13)) - xor ((G shr 22) xor (G shl 10))) + ((G and H) xor (G and A) xor (H and A)); - F := T + T2; - B := B + T; - T := E + ((TBits.RotateRight32(B, 6)) xor (TBits.RotateRight32(B, 11)) - xor (TBits.RotateRight32(B, 25))) + ((B and C) xor (not B and D)) + + LT2 := ((TBits.RotateRight32(LRegG, 2)) xor (TBits.RotateRight32(LRegG, 13)) + xor ((LRegG shr 22) xor (LRegG shl 10))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA)); + LRegF := LT1 + LT2; + LRegB := LRegB + LT1; + LT1 := LRegE + ((TBits.RotateRight32(LRegB, 6)) xor (TBits.RotateRight32(LRegB, 11)) + xor (TBits.RotateRight32(LRegB, 25))) + ((LRegB and LRegC) xor (not LRegB and LRegD)) + $8CC70208 + LData[59]; - T2 := ((TBits.RotateRight32(F, 2)) xor (TBits.RotateRight32(F, 13)) - xor ((F shr 22) xor (F shl 10))) + ((F and G) xor (F and H) xor (G and H)); - E := T + T2; - A := A + T; - T := D + ((TBits.RotateRight32(A, 6)) xor (TBits.RotateRight32(A, 11)) - xor (TBits.RotateRight32(A, 25))) + ((A and B) xor (not A and C)) + + LT2 := ((TBits.RotateRight32(LRegF, 2)) xor (TBits.RotateRight32(LRegF, 13)) + xor ((LRegF shr 22) xor (LRegF shl 10))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH)); + LRegE := LT1 + LT2; + LRegA := LRegA + LT1; + LT1 := LRegD + ((TBits.RotateRight32(LRegA, 6)) xor (TBits.RotateRight32(LRegA, 11)) + xor (TBits.RotateRight32(LRegA, 25))) + ((LRegA and LRegB) xor (not LRegA and LRegC)) + $90BEFFFA + LData[60]; - T2 := ((TBits.RotateRight32(E, 2)) xor (TBits.RotateRight32(E, 13)) - xor ((E shr 22) xor (E shl 10))) + ((E and F) xor (E and G) xor (F and G)); - D := T + T2; - H := H + T; - T := C + ((TBits.RotateRight32(H, 6)) xor (TBits.RotateRight32(H, 11)) - xor (TBits.RotateRight32(H, 25))) + ((H and A) xor (not H and B)) + + LT2 := ((TBits.RotateRight32(LRegE, 2)) xor (TBits.RotateRight32(LRegE, 13)) + xor ((LRegE shr 22) xor (LRegE shl 10))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG)); + LRegD := LT1 + LT2; + LRegH := LRegH + LT1; + LT1 := LRegC + ((TBits.RotateRight32(LRegH, 6)) xor (TBits.RotateRight32(LRegH, 11)) + xor (TBits.RotateRight32(LRegH, 25))) + ((LRegH and LRegA) xor (not LRegH and LRegB)) + $A4506CEB + LData[61]; - T2 := ((TBits.RotateRight32(D, 2)) xor (TBits.RotateRight32(D, 13)) - xor ((D shr 22) xor (D shl 10))) + ((D and E) xor (D and F) xor (E and F)); - C := T + T2; - G := G + T; - T := B + ((TBits.RotateRight32(G, 6)) xor (TBits.RotateRight32(G, 11)) - xor (TBits.RotateRight32(G, 25))) + ((G and H) xor (not G and A)) + + LT2 := ((TBits.RotateRight32(LRegD, 2)) xor (TBits.RotateRight32(LRegD, 13)) + xor ((LRegD shr 22) xor (LRegD shl 10))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF)); + LRegC := LT1 + LT2; + LRegG := LRegG + LT1; + LT1 := LRegB + ((TBits.RotateRight32(LRegG, 6)) xor (TBits.RotateRight32(LRegG, 11)) + xor (TBits.RotateRight32(LRegG, 25))) + ((LRegG and LRegH) xor (not LRegG and LRegA)) + $BEF9A3F7 + LData[62]; - T2 := ((TBits.RotateRight32(C, 2)) xor (TBits.RotateRight32(C, 13)) - xor ((C shr 22) xor (C shl 10))) + ((C and D) xor (C and E) xor (D and E)); - B := T + T2; - F := F + T; - T := A + ((TBits.RotateRight32(F, 6)) xor (TBits.RotateRight32(F, 11)) - xor (TBits.RotateRight32(F, 25))) + ((F and G) xor (not F and H)) + + LT2 := ((TBits.RotateRight32(LRegC, 2)) xor (TBits.RotateRight32(LRegC, 13)) + xor ((LRegC shr 22) xor (LRegC shl 10))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE)); + LRegB := LT1 + LT2; + LRegF := LRegF + LT1; + LT1 := LRegA + ((TBits.RotateRight32(LRegF, 6)) xor (TBits.RotateRight32(LRegF, 11)) + xor (TBits.RotateRight32(LRegF, 25))) + ((LRegF and LRegG) xor (not LRegF and LRegH)) + $C67178F2 + LData[63]; - T2 := ((TBits.RotateRight32(B, 2)) xor (TBits.RotateRight32(B, 13)) - xor ((B shr 22) xor (B shl 10))) + ((B and C) xor (B and D) xor (C and D)); - A := T + T2; - E := E + T; + LT2 := ((TBits.RotateRight32(LRegB, 2)) xor (TBits.RotateRight32(LRegB, 13)) + xor ((LRegB shr 22) xor (LRegB shl 10))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD)); + LRegA := LT1 + LT2; + LRegE := LRegE + LT1; {$ELSE} // Step 1 - for LR := 16 to 63 do + for LRound := 16 to 63 do begin - T := LData[LR - 2]; - T2 := LData[LR - 15]; - LData[LR] := ((TBits.RotateRight32(T, 17)) xor (TBits.RotateRight32(T, 19)) - xor (T shr 10)) + LData[LR - 7] + - ((TBits.RotateRight32(T2, 7)) xor (TBits.RotateRight32(T2, 18)) - xor (T2 shr 3)) + LData[LR - 16]; + LT1 := LData[LRound - 2]; + LT2 := LData[LRound - 15]; + LData[LRound] := ((TBits.RotateRight32(LT1, 17)) xor (TBits.RotateRight32(LT1, 19)) + xor (LT1 shr 10)) + LData[LRound - 7] + + ((TBits.RotateRight32(LT2, 7)) xor (TBits.RotateRight32(LT2, 18)) + xor (LT2 shr 3)) + LData[LRound - 16]; end; // Step 2 - for LR := 0 to 63 do + for LRound := 0 to 63 do begin - T := SK[LR] + LData[LR] + H + - ((TBits.RotateRight32(E, 6)) xor (TBits.RotateRight32(E, 11)) - xor (TBits.RotateRight32(E, 25))) + ((E and F) xor (not E and G)); - T2 := ((TBits.RotateRight32(A, 2)) xor (TBits.RotateRight32(A, 13)) - xor (TBits.RotateRight32(A, 22))) + - ((A and B) xor (A and C) xor (B and C)); - - H := G; - G := F; - F := E; - E := D + T; - D := C; - C := B; - B := A; - A := T + T2; + LT1 := SK[LRound] + LData[LRound] + LRegH + + ((TBits.RotateRight32(LRegE, 6)) xor (TBits.RotateRight32(LRegE, 11)) + xor (TBits.RotateRight32(LRegE, 25))) + ((LRegE and LRegF) xor (not LRegE and LRegG)); + LT2 := ((TBits.RotateRight32(LRegA, 2)) xor (TBits.RotateRight32(LRegA, 13)) + xor (TBits.RotateRight32(LRegA, 22))) + + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC)); + + LRegH := LRegG; + LRegG := LRegF; + LRegF := LRegE; + LRegE := LRegD + LT1; + LRegD := LRegC; + LRegC := LRegB; + LRegB := LRegA; + LRegA := LT1 + LT2; end; {$ENDIF USE_UNROLLED_VARIANT} - FState[0] := FState[0] + A; - FState[1] := FState[1] + B; - FState[2] := FState[2] + C; - FState[3] := FState[3] + D; - FState[4] := FState[4] + E; - FState[5] := FState[5] + F; - FState[6] := FState[6] + G; - FState[7] := FState[7] + H; + FState[0] := FState[0] + LRegA; + FState[1] := FState[1] + LRegB; + FState[2] := FState[2] + LRegC; + FState[3] := FState[3] + LRegD; + FState[4] := FState[4] + LRegE; + FState[5] := FState[5] + LRegF; + FState[6] := FState[6] + LRegG; + FState[7] := FState[7] + LRegH; System.FillChar(LData, System.SizeOf(LData), UInt32(0)); end; diff --git a/HashLib/src/Crypto/HlpSHA2_384.pas b/HashLib/src/Crypto/HlpSHA2_384.pas index 3c17f581..50730999 100644 --- a/HashLib/src/Crypto/HlpSHA2_384.pas +++ b/HashLib/src/Crypto/HlpSHA2_384.pas @@ -35,20 +35,20 @@ function TSHA2_384.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA2_384.Create; begin - Inherited Create(48); + inherited Create(48); end; function TSHA2_384.GetResult: THashLibByteArray; begin - System.SetLength(result, 6 * System.SizeOf(UInt64)); - TConverters.be64_copy(PUInt64(FState), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 6 * System.SizeOf(UInt64)); + TConverters.be64_copy(PUInt64(FState), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TSHA2_384.Initialize; @@ -61,7 +61,7 @@ procedure TSHA2_384.Initialize; FState[5] := UInt64($8EB44A8768581511); FState[6] := UInt64($DB0C2E0D64F98FA7); FState[7] := $47B5481DBEFA4FA4; - Inherited Initialize(); + inherited Initialize(); end; end. diff --git a/HashLib/src/Crypto/HlpSHA2_512.pas b/HashLib/src/Crypto/HlpSHA2_512.pas index e1fb5743..ec972766 100644 --- a/HashLib/src/Crypto/HlpSHA2_512.pas +++ b/HashLib/src/Crypto/HlpSHA2_512.pas @@ -35,20 +35,20 @@ function TSHA2_512.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA2_512.Create; begin - Inherited Create(64); + inherited Create(64); end; function TSHA2_512.GetResult: THashLibByteArray; begin - System.SetLength(result, 8 * System.SizeOf(UInt64)); - TConverters.be64_copy(PUInt64(FState), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 8 * System.SizeOf(UInt64)); + TConverters.be64_copy(PUInt64(FState), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TSHA2_512.Initialize; @@ -61,7 +61,7 @@ procedure TSHA2_512.Initialize; FState[5] := UInt64($9B05688C2B3E6C1F); FState[6] := $1F83D9ABFB41BD6B; FState[7] := $5BE0CD19137E2179; - Inherited Initialize(); + inherited Initialize(); end; end. diff --git a/HashLib/src/Crypto/HlpSHA2_512Base.pas b/HashLib/src/Crypto/HlpSHA2_512Base.pas index 334d3ef1..b5ac23f5 100644 --- a/HashLib/src/Crypto/HlpSHA2_512Base.pas +++ b/HashLib/src/Crypto/HlpSHA2_512Base.pas @@ -78,7 +78,7 @@ implementation constructor TSHA2_512Base.Create(AHashSize: Int32); begin - Inherited Create(AHashSize, 128); + inherited Create(AHashSize, 128); System.SetLength(FState, 8); end; @@ -123,9 +123,9 @@ procedure TSHA2_512Base.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var {$IFNDEF USE_UNROLLED_VARIANT} - LIdx, LT: Int32; + LScheduleIdx, LBatchIdx, LSkIndex: Int32; {$ENDIF USE_UNROLLED_VARIANT} - T0, T1, a, b, c, d, e, f, g, h: UInt64; + LT0, LT1, LRegA, LRegB, LRegC, LRegD, LRegE, LRegF, LRegG, LRegH: UInt64; LData: array [0 .. 79] of UInt64; begin TConverters.be64_copy(AData, AIndex, @(LData[0]), 0, ADataLength); @@ -133,1176 +133,1176 @@ procedure TSHA2_512Base.TransformBlock(AData: PByte; ADataLength: Int32; // Step 1 {$IFDEF USE_UNROLLED_VARIANT} - T0 := LData[16 - 15]; - T1 := LData[16 - 2]; - LData[16] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[16 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[0]; - T0 := LData[17 - 15]; - T1 := LData[17 - 2]; - LData[17] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[17 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[17 - 16]; - T0 := LData[18 - 15]; - T1 := LData[18 - 2]; - LData[18] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[18 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[18 - 16]; - T0 := LData[19 - 15]; - T1 := LData[19 - 2]; - LData[19] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[19 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[19 - 16]; - T0 := LData[20 - 15]; - T1 := LData[20 - 2]; - LData[20] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[20 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[20 - 16]; - T0 := LData[21 - 15]; - T1 := LData[21 - 2]; - LData[21] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[21 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[21 - 16]; - T0 := LData[22 - 15]; - T1 := LData[22 - 2]; - LData[22] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[22 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[22 - 16]; - T0 := LData[23 - 15]; - T1 := LData[23 - 2]; - LData[23] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[23 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[23 - 16]; - T0 := LData[24 - 15]; - T1 := LData[24 - 2]; - LData[24] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[24 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[24 - 16]; - T0 := LData[25 - 15]; - T1 := LData[25 - 2]; - LData[25] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[25 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[25 - 16]; - T0 := LData[26 - 15]; - T1 := LData[26 - 2]; - LData[26] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[26 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[26 - 16]; - T0 := LData[27 - 15]; - T1 := LData[27 - 2]; - LData[27] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[27 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[27 - 16]; - T0 := LData[28 - 15]; - T1 := LData[28 - 2]; - LData[28] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[28 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[28 - 16]; - T0 := LData[29 - 15]; - T1 := LData[29 - 2]; - LData[29] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[29 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[29 - 16]; - T0 := LData[30 - 15]; - T1 := LData[30 - 2]; - LData[30] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[30 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[30 - 16]; - T0 := LData[31 - 15]; - T1 := LData[31 - 2]; - LData[31] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[31 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[31 - 16]; - T0 := LData[32 - 15]; - T1 := LData[32 - 2]; - LData[32] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[32 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[32 - 16]; - T0 := LData[33 - 15]; - T1 := LData[33 - 2]; - LData[33] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[33 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[33 - 16]; - T0 := LData[34 - 15]; - T1 := LData[34 - 2]; - LData[34] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[34 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[34 - 16]; - T0 := LData[35 - 15]; - T1 := LData[35 - 2]; - LData[35] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[35 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[35 - 16]; - T0 := LData[36 - 15]; - T1 := LData[36 - 2]; - LData[36] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[36 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[36 - 16]; - T0 := LData[37 - 15]; - T1 := LData[37 - 2]; - LData[37] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[37 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[37 - 16]; - T0 := LData[38 - 15]; - T1 := LData[38 - 2]; - LData[38] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[38 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[38 - 16]; - T0 := LData[39 - 15]; - T1 := LData[39 - 2]; - LData[39] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[39 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[39 - 16]; - T0 := LData[40 - 15]; - T1 := LData[40 - 2]; - LData[40] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[40 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[40 - 16]; - T0 := LData[41 - 15]; - T1 := LData[41 - 2]; - LData[41] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[41 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[41 - 16]; - T0 := LData[42 - 15]; - T1 := LData[42 - 2]; - LData[42] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[42 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[42 - 16]; - T0 := LData[43 - 15]; - T1 := LData[43 - 2]; - LData[43] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[43 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[43 - 16]; - T0 := LData[44 - 15]; - T1 := LData[44 - 2]; - LData[44] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[44 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[44 - 16]; - T0 := LData[45 - 15]; - T1 := LData[45 - 2]; - LData[45] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[45 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[45 - 16]; - T0 := LData[46 - 15]; - T1 := LData[46 - 2]; - LData[46] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[46 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[46 - 16]; - T0 := LData[47 - 15]; - T1 := LData[47 - 2]; - LData[47] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[47 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[47 - 16]; - T0 := LData[48 - 15]; - T1 := LData[48 - 2]; - LData[48] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[48 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[48 - 16]; - T0 := LData[49 - 15]; - T1 := LData[49 - 2]; - LData[49] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[49 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[49 - 16]; - T0 := LData[50 - 15]; - T1 := LData[50 - 2]; - LData[50] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[50 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[50 - 16]; - T0 := LData[51 - 15]; - T1 := LData[51 - 2]; - LData[51] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[51 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[51 - 16]; - T0 := LData[52 - 15]; - T1 := LData[52 - 2]; - LData[52] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[52 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[52 - 16]; - T0 := LData[53 - 15]; - T1 := LData[53 - 2]; - LData[53] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[53 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[53 - 16]; - T0 := LData[54 - 15]; - T1 := LData[54 - 2]; - LData[54] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[54 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[54 - 16]; - T0 := LData[55 - 15]; - T1 := LData[55 - 2]; - LData[55] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[55 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[55 - 16]; - T0 := LData[56 - 15]; - T1 := LData[56 - 2]; - LData[56] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[56 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[56 - 16]; - T0 := LData[57 - 15]; - T1 := LData[57 - 2]; - LData[57] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[57 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[57 - 16]; - T0 := LData[58 - 15]; - T1 := LData[58 - 2]; - LData[58] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[58 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[58 - 16]; - T0 := LData[59 - 15]; - T1 := LData[59 - 2]; - LData[59] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[59 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[59 - 16]; - T0 := LData[60 - 15]; - T1 := LData[60 - 2]; - LData[60] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[60 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[60 - 16]; - T0 := LData[61 - 15]; - T1 := LData[61 - 2]; - LData[61] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[61 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[61 - 16]; - T0 := LData[62 - 15]; - T1 := LData[62 - 2]; - LData[62] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[62 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[62 - 16]; - T0 := LData[63 - 15]; - T1 := LData[63 - 2]; - LData[63] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[63 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[63 - 16]; - T0 := LData[64 - 15]; - T1 := LData[64 - 2]; - LData[64] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[64 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[64 - 16]; - T0 := LData[65 - 15]; - T1 := LData[65 - 2]; - LData[65] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[65 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[65 - 16]; - T0 := LData[66 - 15]; - T1 := LData[66 - 2]; - LData[66] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[66 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[66 - 16]; - T0 := LData[67 - 15]; - T1 := LData[67 - 2]; - LData[67] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[67 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[67 - 16]; - T0 := LData[68 - 15]; - T1 := LData[68 - 2]; - LData[68] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[68 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[68 - 16]; - T0 := LData[69 - 15]; - T1 := LData[69 - 2]; - LData[69] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[69 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[69 - 16]; - T0 := LData[70 - 15]; - T1 := LData[70 - 2]; - LData[70] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[70 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[70 - 16]; - T0 := LData[71 - 15]; - T1 := LData[71 - 2]; - LData[71] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[71 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[71 - 16]; - T0 := LData[72 - 15]; - T1 := LData[72 - 2]; - LData[72] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[72 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[72 - 16]; - T0 := LData[73 - 15]; - T1 := LData[73 - 2]; - LData[73] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[73 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[73 - 16]; - T0 := LData[74 - 15]; - T1 := LData[74 - 2]; - LData[74] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[74 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[74 - 16]; - T0 := LData[75 - 15]; - T1 := LData[75 - 2]; - LData[75] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[75 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[75 - 16]; - T0 := LData[76 - 15]; - T1 := LData[76 - 2]; - LData[76] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[76 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[76 - 16]; - T0 := LData[77 - 15]; - T1 := LData[77 - 2]; - LData[77] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[77 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[77 - 16]; - T0 := LData[78 - 15]; - T1 := LData[78 - 2]; - LData[78] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[78 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[78 - 16]; - T0 := LData[79 - 15]; - T1 := LData[79 - 2]; - LData[79] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[79 - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[79 - 16]; - - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - e := FState[4]; - f := FState[5]; - g := FState[6]; - h := FState[7]; + LT0 := LData[16 - 15]; + LT1 := LData[16 - 2]; + LData[16] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[16 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[0]; + LT0 := LData[17 - 15]; + LT1 := LData[17 - 2]; + LData[17] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[17 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[17 - 16]; + LT0 := LData[18 - 15]; + LT1 := LData[18 - 2]; + LData[18] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[18 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[18 - 16]; + LT0 := LData[19 - 15]; + LT1 := LData[19 - 2]; + LData[19] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[19 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[19 - 16]; + LT0 := LData[20 - 15]; + LT1 := LData[20 - 2]; + LData[20] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[20 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[20 - 16]; + LT0 := LData[21 - 15]; + LT1 := LData[21 - 2]; + LData[21] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[21 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[21 - 16]; + LT0 := LData[22 - 15]; + LT1 := LData[22 - 2]; + LData[22] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[22 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[22 - 16]; + LT0 := LData[23 - 15]; + LT1 := LData[23 - 2]; + LData[23] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[23 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[23 - 16]; + LT0 := LData[24 - 15]; + LT1 := LData[24 - 2]; + LData[24] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[24 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[24 - 16]; + LT0 := LData[25 - 15]; + LT1 := LData[25 - 2]; + LData[25] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[25 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[25 - 16]; + LT0 := LData[26 - 15]; + LT1 := LData[26 - 2]; + LData[26] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[26 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[26 - 16]; + LT0 := LData[27 - 15]; + LT1 := LData[27 - 2]; + LData[27] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[27 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[27 - 16]; + LT0 := LData[28 - 15]; + LT1 := LData[28 - 2]; + LData[28] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[28 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[28 - 16]; + LT0 := LData[29 - 15]; + LT1 := LData[29 - 2]; + LData[29] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[29 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[29 - 16]; + LT0 := LData[30 - 15]; + LT1 := LData[30 - 2]; + LData[30] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[30 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[30 - 16]; + LT0 := LData[31 - 15]; + LT1 := LData[31 - 2]; + LData[31] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[31 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[31 - 16]; + LT0 := LData[32 - 15]; + LT1 := LData[32 - 2]; + LData[32] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[32 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[32 - 16]; + LT0 := LData[33 - 15]; + LT1 := LData[33 - 2]; + LData[33] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[33 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[33 - 16]; + LT0 := LData[34 - 15]; + LT1 := LData[34 - 2]; + LData[34] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[34 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[34 - 16]; + LT0 := LData[35 - 15]; + LT1 := LData[35 - 2]; + LData[35] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[35 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[35 - 16]; + LT0 := LData[36 - 15]; + LT1 := LData[36 - 2]; + LData[36] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[36 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[36 - 16]; + LT0 := LData[37 - 15]; + LT1 := LData[37 - 2]; + LData[37] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[37 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[37 - 16]; + LT0 := LData[38 - 15]; + LT1 := LData[38 - 2]; + LData[38] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[38 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[38 - 16]; + LT0 := LData[39 - 15]; + LT1 := LData[39 - 2]; + LData[39] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[39 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[39 - 16]; + LT0 := LData[40 - 15]; + LT1 := LData[40 - 2]; + LData[40] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[40 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[40 - 16]; + LT0 := LData[41 - 15]; + LT1 := LData[41 - 2]; + LData[41] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[41 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[41 - 16]; + LT0 := LData[42 - 15]; + LT1 := LData[42 - 2]; + LData[42] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[42 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[42 - 16]; + LT0 := LData[43 - 15]; + LT1 := LData[43 - 2]; + LData[43] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[43 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[43 - 16]; + LT0 := LData[44 - 15]; + LT1 := LData[44 - 2]; + LData[44] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[44 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[44 - 16]; + LT0 := LData[45 - 15]; + LT1 := LData[45 - 2]; + LData[45] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[45 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[45 - 16]; + LT0 := LData[46 - 15]; + LT1 := LData[46 - 2]; + LData[46] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[46 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[46 - 16]; + LT0 := LData[47 - 15]; + LT1 := LData[47 - 2]; + LData[47] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[47 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[47 - 16]; + LT0 := LData[48 - 15]; + LT1 := LData[48 - 2]; + LData[48] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[48 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[48 - 16]; + LT0 := LData[49 - 15]; + LT1 := LData[49 - 2]; + LData[49] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[49 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[49 - 16]; + LT0 := LData[50 - 15]; + LT1 := LData[50 - 2]; + LData[50] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[50 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[50 - 16]; + LT0 := LData[51 - 15]; + LT1 := LData[51 - 2]; + LData[51] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[51 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[51 - 16]; + LT0 := LData[52 - 15]; + LT1 := LData[52 - 2]; + LData[52] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[52 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[52 - 16]; + LT0 := LData[53 - 15]; + LT1 := LData[53 - 2]; + LData[53] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[53 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[53 - 16]; + LT0 := LData[54 - 15]; + LT1 := LData[54 - 2]; + LData[54] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[54 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[54 - 16]; + LT0 := LData[55 - 15]; + LT1 := LData[55 - 2]; + LData[55] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[55 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[55 - 16]; + LT0 := LData[56 - 15]; + LT1 := LData[56 - 2]; + LData[56] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[56 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[56 - 16]; + LT0 := LData[57 - 15]; + LT1 := LData[57 - 2]; + LData[57] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[57 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[57 - 16]; + LT0 := LData[58 - 15]; + LT1 := LData[58 - 2]; + LData[58] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[58 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[58 - 16]; + LT0 := LData[59 - 15]; + LT1 := LData[59 - 2]; + LData[59] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[59 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[59 - 16]; + LT0 := LData[60 - 15]; + LT1 := LData[60 - 2]; + LData[60] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[60 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[60 - 16]; + LT0 := LData[61 - 15]; + LT1 := LData[61 - 2]; + LData[61] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[61 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[61 - 16]; + LT0 := LData[62 - 15]; + LT1 := LData[62 - 2]; + LData[62] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[62 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[62 - 16]; + LT0 := LData[63 - 15]; + LT1 := LData[63 - 2]; + LData[63] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[63 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[63 - 16]; + LT0 := LData[64 - 15]; + LT1 := LData[64 - 2]; + LData[64] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[64 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[64 - 16]; + LT0 := LData[65 - 15]; + LT1 := LData[65 - 2]; + LData[65] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[65 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[65 - 16]; + LT0 := LData[66 - 15]; + LT1 := LData[66 - 2]; + LData[66] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[66 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[66 - 16]; + LT0 := LData[67 - 15]; + LT1 := LData[67 - 2]; + LData[67] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[67 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[67 - 16]; + LT0 := LData[68 - 15]; + LT1 := LData[68 - 2]; + LData[68] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[68 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[68 - 16]; + LT0 := LData[69 - 15]; + LT1 := LData[69 - 2]; + LData[69] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[69 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[69 - 16]; + LT0 := LData[70 - 15]; + LT1 := LData[70 - 2]; + LData[70] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[70 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[70 - 16]; + LT0 := LData[71 - 15]; + LT1 := LData[71 - 2]; + LData[71] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[71 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[71 - 16]; + LT0 := LData[72 - 15]; + LT1 := LData[72 - 2]; + LData[72] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[72 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[72 - 16]; + LT0 := LData[73 - 15]; + LT1 := LData[73 - 2]; + LData[73] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[73 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[73 - 16]; + LT0 := LData[74 - 15]; + LT1 := LData[74 - 2]; + LData[74] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[74 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[74 - 16]; + LT0 := LData[75 - 15]; + LT1 := LData[75 - 2]; + LData[75] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[75 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[75 - 16]; + LT0 := LData[76 - 15]; + LT1 := LData[76 - 2]; + LData[76] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[76 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[76 - 16]; + LT0 := LData[77 - 15]; + LT1 := LData[77 - 2]; + LData[77] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[77 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[77 - 16]; + LT0 := LData[78 - 15]; + LT1 := LData[78 - 2]; + LData[78] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[78 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[78 - 16]; + LT0 := LData[79 - 15]; + LT1 := LData[79 - 2]; + LData[79] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[79 - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[79 - 16]; + + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegE := FState[4]; + LRegF := FState[5]; + LRegG := FState[6]; + LRegH := FState[7]; // Step 2 // R0 - h := h + (UInt64($428A2F98D728AE22) + LData[0] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($428A2F98D728AE22) + LData[0] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($7137449123EF65CD) + LData[1] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($7137449123EF65CD) + LData[1] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($B5C0FBCFEC4D3B2F) + LData[2] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($B5C0FBCFEC4D3B2F) + LData[2] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($E9B5DBA58189DBBC) + LData[3] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($E9B5DBA58189DBBC) + LData[3] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($3956C25BF348B538) + LData[4] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($3956C25BF348B538) + LData[4] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($59F111F1B605D019) + LData[5] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($59F111F1B605D019) + LData[5] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($923F82A4AF194F9B) + LData[6] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($923F82A4AF194F9B) + LData[6] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($AB1C5ED5DA6D8118) + LData[7] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($AB1C5ED5DA6D8118) + LData[7] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R1 - h := h + (UInt64($D807AA98A3030242) + LData[8] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($D807AA98A3030242) + LData[8] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($12835B0145706FBE) + LData[9] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($12835B0145706FBE) + LData[9] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($243185BE4EE4B28C) + LData[10] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($243185BE4EE4B28C) + LData[10] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($550C7DC3D5FFB4E2) + LData[11] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($550C7DC3D5FFB4E2) + LData[11] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($72BE5D74F27B896F) + LData[12] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($72BE5D74F27B896F) + LData[12] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($80DEB1FE3B1696B1) + LData[13] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($80DEB1FE3B1696B1) + LData[13] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($9BDC06A725C71235) + LData[14] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($9BDC06A725C71235) + LData[14] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($C19BF174CF692694) + LData[15] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($C19BF174CF692694) + LData[15] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R2 - h := h + (UInt64($E49B69C19EF14AD2) + LData[16] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($E49B69C19EF14AD2) + LData[16] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($EFBE4786384F25E3) + LData[17] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($EFBE4786384F25E3) + LData[17] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($0FC19DC68B8CD5B5) + LData[18] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($0FC19DC68B8CD5B5) + LData[18] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($240CA1CC77AC9C65) + LData[19] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($240CA1CC77AC9C65) + LData[19] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($2DE92C6F592B0275) + LData[20] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($2DE92C6F592B0275) + LData[20] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($4A7484AA6EA6E483) + LData[21] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($4A7484AA6EA6E483) + LData[21] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($5CB0A9DCBD41FBD4) + LData[22] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($5CB0A9DCBD41FBD4) + LData[22] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($76F988DA831153B5) + LData[23] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($76F988DA831153B5) + LData[23] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R3 - h := h + (UInt64($983E5152EE66DFAB) + LData[24] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($983E5152EE66DFAB) + LData[24] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($A831C66D2DB43210) + LData[25] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($A831C66D2DB43210) + LData[25] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($B00327C898FB213F) + LData[26] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($B00327C898FB213F) + LData[26] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($BF597FC7BEEF0EE4) + LData[27] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($BF597FC7BEEF0EE4) + LData[27] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($C6E00BF33DA88FC2) + LData[28] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($C6E00BF33DA88FC2) + LData[28] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($D5A79147930AA725) + LData[29] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($D5A79147930AA725) + LData[29] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($06CA6351E003826F) + LData[30] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($06CA6351E003826F) + LData[30] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($142929670A0E6E70) + LData[31] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($142929670A0E6E70) + LData[31] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R4 - h := h + (UInt64($27B70A8546D22FFC) + LData[32] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($27B70A8546D22FFC) + LData[32] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($2E1B21385C26C926) + LData[33] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($2E1B21385C26C926) + LData[33] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($4D2C6DFC5AC42AED) + LData[34] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($4D2C6DFC5AC42AED) + LData[34] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($53380D139D95B3DF) + LData[35] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($53380D139D95B3DF) + LData[35] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($650A73548BAF63DE) + LData[36] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($650A73548BAF63DE) + LData[36] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($766A0ABB3C77B2A8) + LData[37] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($766A0ABB3C77B2A8) + LData[37] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($81C2C92E47EDAEE6) + LData[38] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($81C2C92E47EDAEE6) + LData[38] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($92722C851482353B) + LData[39] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($92722C851482353B) + LData[39] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R5 - h := h + (UInt64($A2BFE8A14CF10364) + LData[40] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($A2BFE8A14CF10364) + LData[40] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($A81A664BBC423001) + LData[41] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($A81A664BBC423001) + LData[41] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($C24B8B70D0F89791) + LData[42] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($C24B8B70D0F89791) + LData[42] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($C76C51A30654BE30) + LData[43] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($C76C51A30654BE30) + LData[43] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($D192E819D6EF5218) + LData[44] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($D192E819D6EF5218) + LData[44] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($D69906245565A910) + LData[45] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($D69906245565A910) + LData[45] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($F40E35855771202A) + LData[46] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($F40E35855771202A) + LData[46] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($106AA07032BBD1B8) + LData[47] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($106AA07032BBD1B8) + LData[47] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R6 - h := h + (UInt64($19A4C116B8D2D0C8) + LData[48] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($19A4C116B8D2D0C8) + LData[48] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($1E376C085141AB53) + LData[49] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($1E376C085141AB53) + LData[49] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($2748774CDF8EEB99) + LData[50] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($2748774CDF8EEB99) + LData[50] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($34B0BCB5E19B48A8) + LData[51] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($34B0BCB5E19B48A8) + LData[51] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($391C0CB3C5C95A63) + LData[52] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($391C0CB3C5C95A63) + LData[52] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($4ED8AA4AE3418ACB) + LData[53] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($4ED8AA4AE3418ACB) + LData[53] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($5B9CCA4F7763E373) + LData[54] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($5B9CCA4F7763E373) + LData[54] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($682E6FF3D6B2B8A3) + LData[55] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($682E6FF3D6B2B8A3) + LData[55] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R7 - h := h + (UInt64($748F82EE5DEFB2FC) + LData[56] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($748F82EE5DEFB2FC) + LData[56] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($78A5636F43172F60) + LData[57] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($78A5636F43172F60) + LData[57] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($84C87814A1F0AB72) + LData[58] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($84C87814A1F0AB72) + LData[58] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($8CC702081A6439EC) + LData[59] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($8CC702081A6439EC) + LData[59] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($90BEFFFA23631E28) + LData[60] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($90BEFFFA23631E28) + LData[60] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($A4506CEBDE82BDE9) + LData[61] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($A4506CEBDE82BDE9) + LData[61] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($BEF9A3F7B2C67915) + LData[62] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($BEF9A3F7B2C67915) + LData[62] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($C67178F2E372532B) + LData[63] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($C67178F2E372532B) + LData[63] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R8 - h := h + (UInt64($CA273ECEEA26619C) + LData[64] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($CA273ECEEA26619C) + LData[64] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($D186B8C721C0C207) + LData[65] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($D186B8C721C0C207) + LData[65] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($EADA7DD6CDE0EB1E) + LData[66] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($EADA7DD6CDE0EB1E) + LData[66] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($F57D4F7FEE6ED178) + LData[67] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($F57D4F7FEE6ED178) + LData[67] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($06F067AA72176FBA) + LData[68] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($06F067AA72176FBA) + LData[68] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($0A637DC5A2C898A6) + LData[69] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($0A637DC5A2C898A6) + LData[69] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($113F9804BEF90DAE) + LData[70] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($113F9804BEF90DAE) + LData[70] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($1B710B35131C471B) + LData[71] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($1B710B35131C471B) + LData[71] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); // R9 - h := h + (UInt64($28DB77F523047D84) + LData[72] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); + LRegH := LRegH + (UInt64($28DB77F523047D84) + LData[72] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) xor (b and c))); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) xor (LRegB and LRegC))); - g := g + (UInt64($32CAAB7B40C72493) + LData[73] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); + LRegG := LRegG + (UInt64($32CAAB7B40C72493) + LData[73] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) xor (a and b))); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) xor (LRegA and LRegB))); - f := f + (UInt64($3C9EBE0A15C9BEBC) + LData[74] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); + LRegF := LRegF + (UInt64($3C9EBE0A15C9BEBC) + LData[74] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) xor (h and a))); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) xor (LRegH and LRegA))); - e := e + (UInt64($431D67C49C100D4C) + LData[75] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); + LRegE := LRegE + (UInt64($431D67C49C100D4C) + LData[75] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) xor (g and h))); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) xor (LRegG and LRegH))); - d := d + (UInt64($4CC5D4BECB3E42B6) + LData[76] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); + LRegD := LRegD + (UInt64($4CC5D4BECB3E42B6) + LData[76] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) xor (f and g))); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) xor (LRegF and LRegG))); - c := c + (UInt64($597F299CFC657E2A) + LData[77] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); + LRegC := LRegC + (UInt64($597F299CFC657E2A) + LData[77] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) xor (e and f))); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) xor (LRegE and LRegF))); - b := b + (UInt64($5FCB6FAB3AD6FAEC) + LData[78] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); + LRegB := LRegB + (UInt64($5FCB6FAB3AD6FAEC) + LData[78] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) xor (d and e))); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) xor (LRegD and LRegE))); - a := a + (UInt64($6C44198C4A475817) + LData[79] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); + LRegA := LRegA + (UInt64($6C44198C4A475817) + LData[79] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) xor (c and d))); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) xor (LRegC and LRegD))); {$ELSE} - a := FState[0]; - b := FState[1]; - c := FState[2]; - d := FState[3]; - e := FState[4]; - f := FState[5]; - g := FState[6]; - h := FState[7]; + LRegA := FState[0]; + LRegB := FState[1]; + LRegC := FState[2]; + LRegD := FState[3]; + LRegE := FState[4]; + LRegF := FState[5]; + LRegG := FState[6]; + LRegH := FState[7]; // Step 1 - for LIdx := 16 to 79 do + for LScheduleIdx := 16 to 79 do begin - T0 := LData[LIdx - 15]; - T1 := LData[LIdx - 2]; - LData[LIdx] := ((TBits.RotateLeft64(T1, 45)) xor (TBits.RotateLeft64(T1, 3)) - xor (T1 shr 6)) + LData[LIdx - 7] + - ((TBits.RotateLeft64(T0, 63)) xor (TBits.RotateLeft64(T0, 56)) - xor (T0 shr 7)) + LData[LIdx - 16]; + LT0 := LData[LScheduleIdx - 15]; + LT1 := LData[LScheduleIdx - 2]; + LData[LScheduleIdx] := ((TBits.RotateLeft64(LT1, 45)) xor (TBits.RotateLeft64(LT1, 3)) + xor (LT1 shr 6)) + LData[LScheduleIdx - 7] + + ((TBits.RotateLeft64(LT0, 63)) xor (TBits.RotateLeft64(LT0, 56)) + xor (LT0 shr 7)) + LData[LScheduleIdx - 16]; end; // Step 2 - LT := 0; - LIdx := 0; + LSkIndex := 0; + LBatchIdx := 0; - while LIdx <= 9 do + while LBatchIdx <= 9 do begin - h := h + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(e, 50)) - xor (TBits.RotateLeft64(e, 46)) xor (TBits.RotateLeft64(e, 23))) + - ((e and f) xor (not e and g))); - System.Inc(LT); - d := d + h; - h := h + (((TBits.RotateLeft64(a, 36)) xor (TBits.RotateLeft64(a, 30)) - xor (TBits.RotateLeft64(a, 25))) + ((a and b) xor (a and c) - xor (b and c))); - - g := g + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(d, 50)) - xor (TBits.RotateLeft64(d, 46)) xor (TBits.RotateLeft64(d, 23))) + - ((d and e) xor (not d and f))); - System.Inc(LT); - c := c + g; - g := g + (((TBits.RotateLeft64(h, 36)) xor (TBits.RotateLeft64(h, 30)) - xor (TBits.RotateLeft64(h, 25))) + ((h and a) xor (h and b) - xor (a and b))); - - f := f + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(c, 50)) - xor (TBits.RotateLeft64(c, 46)) xor (TBits.RotateLeft64(c, 23))) + - ((c and d) xor (not c and e))); - System.Inc(LT); - b := b + f; - f := f + (((TBits.RotateLeft64(g, 36)) xor (TBits.RotateLeft64(g, 30)) - xor (TBits.RotateLeft64(g, 25))) + ((g and h) xor (g and a) - xor (h and a))); - - e := e + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(b, 50)) - xor (TBits.RotateLeft64(b, 46)) xor (TBits.RotateLeft64(b, 23))) + - ((b and c) xor (not b and d))); - System.Inc(LT); - a := a + e; - e := e + (((TBits.RotateLeft64(f, 36)) xor (TBits.RotateLeft64(f, 30)) - xor (TBits.RotateLeft64(f, 25))) + ((f and g) xor (f and h) - xor (g and h))); - - d := d + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(a, 50)) - xor (TBits.RotateLeft64(a, 46)) xor (TBits.RotateLeft64(a, 23))) + - ((a and b) xor (not a and c))); - System.Inc(LT); - h := h + d; - d := d + (((TBits.RotateLeft64(e, 36)) xor (TBits.RotateLeft64(e, 30)) - xor (TBits.RotateLeft64(e, 25))) + ((e and f) xor (e and g) - xor (f and g))); - - c := c + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(h, 50)) - xor (TBits.RotateLeft64(h, 46)) xor (TBits.RotateLeft64(h, 23))) + - ((h and a) xor (not h and b))); - System.Inc(LT); - g := g + c; - c := c + (((TBits.RotateLeft64(d, 36)) xor (TBits.RotateLeft64(d, 30)) - xor (TBits.RotateLeft64(d, 25))) + ((d and e) xor (d and f) - xor (e and f))); - - b := b + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(g, 50)) - xor (TBits.RotateLeft64(g, 46)) xor (TBits.RotateLeft64(g, 23))) + - ((g and h) xor (not g and a))); - System.Inc(LT); - f := f + b; - b := b + (((TBits.RotateLeft64(c, 36)) xor (TBits.RotateLeft64(c, 30)) - xor (TBits.RotateLeft64(c, 25))) + ((c and d) xor (c and e) - xor (d and e))); - - a := a + (SK[LT] + LData[LT] + ((TBits.RotateLeft64(f, 50)) - xor (TBits.RotateLeft64(f, 46)) xor (TBits.RotateLeft64(f, 23))) + - ((f and g) xor (not f and h))); - System.Inc(LT); - e := e + a; - a := a + (((TBits.RotateLeft64(b, 36)) xor (TBits.RotateLeft64(b, 30)) - xor (TBits.RotateLeft64(b, 25))) + ((b and c) xor (b and d) - xor (c and d))); - - System.Inc(LIdx); + LRegH := LRegH + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegE, 50)) + xor (TBits.RotateLeft64(LRegE, 46)) xor (TBits.RotateLeft64(LRegE, 23))) + + ((LRegE and LRegF) xor (not LRegE and LRegG))); + System.Inc(LSkIndex); + LRegD := LRegD + LRegH; + LRegH := LRegH + (((TBits.RotateLeft64(LRegA, 36)) xor (TBits.RotateLeft64(LRegA, 30)) + xor (TBits.RotateLeft64(LRegA, 25))) + ((LRegA and LRegB) xor (LRegA and LRegC) + xor (LRegB and LRegC))); + + LRegG := LRegG + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegD, 50)) + xor (TBits.RotateLeft64(LRegD, 46)) xor (TBits.RotateLeft64(LRegD, 23))) + + ((LRegD and LRegE) xor (not LRegD and LRegF))); + System.Inc(LSkIndex); + LRegC := LRegC + LRegG; + LRegG := LRegG + (((TBits.RotateLeft64(LRegH, 36)) xor (TBits.RotateLeft64(LRegH, 30)) + xor (TBits.RotateLeft64(LRegH, 25))) + ((LRegH and LRegA) xor (LRegH and LRegB) + xor (LRegA and LRegB))); + + LRegF := LRegF + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegC, 50)) + xor (TBits.RotateLeft64(LRegC, 46)) xor (TBits.RotateLeft64(LRegC, 23))) + + ((LRegC and LRegD) xor (not LRegC and LRegE))); + System.Inc(LSkIndex); + LRegB := LRegB + LRegF; + LRegF := LRegF + (((TBits.RotateLeft64(LRegG, 36)) xor (TBits.RotateLeft64(LRegG, 30)) + xor (TBits.RotateLeft64(LRegG, 25))) + ((LRegG and LRegH) xor (LRegG and LRegA) + xor (LRegH and LRegA))); + + LRegE := LRegE + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegB, 50)) + xor (TBits.RotateLeft64(LRegB, 46)) xor (TBits.RotateLeft64(LRegB, 23))) + + ((LRegB and LRegC) xor (not LRegB and LRegD))); + System.Inc(LSkIndex); + LRegA := LRegA + LRegE; + LRegE := LRegE + (((TBits.RotateLeft64(LRegF, 36)) xor (TBits.RotateLeft64(LRegF, 30)) + xor (TBits.RotateLeft64(LRegF, 25))) + ((LRegF and LRegG) xor (LRegF and LRegH) + xor (LRegG and LRegH))); + + LRegD := LRegD + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegA, 50)) + xor (TBits.RotateLeft64(LRegA, 46)) xor (TBits.RotateLeft64(LRegA, 23))) + + ((LRegA and LRegB) xor (not LRegA and LRegC))); + System.Inc(LSkIndex); + LRegH := LRegH + LRegD; + LRegD := LRegD + (((TBits.RotateLeft64(LRegE, 36)) xor (TBits.RotateLeft64(LRegE, 30)) + xor (TBits.RotateLeft64(LRegE, 25))) + ((LRegE and LRegF) xor (LRegE and LRegG) + xor (LRegF and LRegG))); + + LRegC := LRegC + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegH, 50)) + xor (TBits.RotateLeft64(LRegH, 46)) xor (TBits.RotateLeft64(LRegH, 23))) + + ((LRegH and LRegA) xor (not LRegH and LRegB))); + System.Inc(LSkIndex); + LRegG := LRegG + LRegC; + LRegC := LRegC + (((TBits.RotateLeft64(LRegD, 36)) xor (TBits.RotateLeft64(LRegD, 30)) + xor (TBits.RotateLeft64(LRegD, 25))) + ((LRegD and LRegE) xor (LRegD and LRegF) + xor (LRegE and LRegF))); + + LRegB := LRegB + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegG, 50)) + xor (TBits.RotateLeft64(LRegG, 46)) xor (TBits.RotateLeft64(LRegG, 23))) + + ((LRegG and LRegH) xor (not LRegG and LRegA))); + System.Inc(LSkIndex); + LRegF := LRegF + LRegB; + LRegB := LRegB + (((TBits.RotateLeft64(LRegC, 36)) xor (TBits.RotateLeft64(LRegC, 30)) + xor (TBits.RotateLeft64(LRegC, 25))) + ((LRegC and LRegD) xor (LRegC and LRegE) + xor (LRegD and LRegE))); + + LRegA := LRegA + (SK[LSkIndex] + LData[LSkIndex] + ((TBits.RotateLeft64(LRegF, 50)) + xor (TBits.RotateLeft64(LRegF, 46)) xor (TBits.RotateLeft64(LRegF, 23))) + + ((LRegF and LRegG) xor (not LRegF and LRegH))); + System.Inc(LSkIndex); + LRegE := LRegE + LRegA; + LRegA := LRegA + (((TBits.RotateLeft64(LRegB, 36)) xor (TBits.RotateLeft64(LRegB, 30)) + xor (TBits.RotateLeft64(LRegB, 25))) + ((LRegB and LRegC) xor (LRegB and LRegD) + xor (LRegC and LRegD))); + + System.Inc(LBatchIdx); end; {$ENDIF USE_UNROLLED_VARIANT} - FState[0] := FState[0] + a; - FState[1] := FState[1] + b; - FState[2] := FState[2] + c; - FState[3] := FState[3] + d; - FState[4] := FState[4] + e; - FState[5] := FState[5] + f; - FState[6] := FState[6] + g; - FState[7] := FState[7] + h; + FState[0] := FState[0] + LRegA; + FState[1] := FState[1] + LRegB; + FState[2] := FState[2] + LRegC; + FState[3] := FState[3] + LRegD; + FState[4] := FState[4] + LRegE; + FState[5] := FState[5] + LRegF; + FState[6] := FState[6] + LRegG; + FState[7] := FState[7] + LRegH; System.FillChar(LData, System.SizeOf(LData), UInt64(0)); end; diff --git a/HashLib/src/Crypto/HlpSHA2_512_224.pas b/HashLib/src/Crypto/HlpSHA2_512_224.pas index f9348af5..1456aaa5 100644 --- a/HashLib/src/Crypto/HlpSHA2_512_224.pas +++ b/HashLib/src/Crypto/HlpSHA2_512_224.pas @@ -35,21 +35,21 @@ function TSHA2_512_224.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA2_512_224.Create; begin - Inherited Create(28); + inherited Create(28); end; function TSHA2_512_224.GetResult: THashLibByteArray; begin - System.SetLength(result, 4 * System.SizeOf(UInt64)); - TConverters.be64_copy(PUInt64(FState), 0, PByte(result), 0, - System.Length(result)); - System.SetLength(result, HashSize * System.SizeOf(Byte)); + System.SetLength(Result, 4 * System.SizeOf(UInt64)); + TConverters.be64_copy(PUInt64(FState), 0, PByte(Result), 0, + System.Length(Result)); + System.SetLength(Result, HashSize * System.SizeOf(Byte)); end; procedure TSHA2_512_224.Initialize; @@ -62,7 +62,7 @@ procedure TSHA2_512_224.Initialize; FState[5] := $77E36F7304C48942; FState[6] := $3F9D85A86A1D36C8; FState[7] := $1112E6AD91D692A1; - Inherited Initialize(); + inherited Initialize(); end; end. diff --git a/HashLib/src/Crypto/HlpSHA2_512_256.pas b/HashLib/src/Crypto/HlpSHA2_512_256.pas index a899f14f..f51ca367 100644 --- a/HashLib/src/Crypto/HlpSHA2_512_256.pas +++ b/HashLib/src/Crypto/HlpSHA2_512_256.pas @@ -35,20 +35,20 @@ function TSHA2_512_256.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSHA2_512_256.Create; begin - Inherited Create(32); + inherited Create(32); end; function TSHA2_512_256.GetResult: THashLibByteArray; begin - System.SetLength(result, 4 * System.SizeOf(UInt64)); - TConverters.be64_copy(PUInt64(FState), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, 4 * System.SizeOf(UInt64)); + TConverters.be64_copy(PUInt64(FState), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TSHA2_512_256.Initialize; @@ -61,7 +61,7 @@ procedure TSHA2_512_256.Initialize; FState[5] := UInt64($BE5E1E2553863992); FState[6] := $2B0199FC2C85B8AA; FState[7] := $0EB72DDC81C52CA2; - Inherited Initialize(); + inherited Initialize(); end; end. diff --git a/HashLib/src/Crypto/HlpSHA3.pas b/HashLib/src/Crypto/HlpSHA3.pas index a0ac80ab..d25e1fdf 100644 --- a/HashLib/src/Crypto/HlpSHA3.pas +++ b/HashLib/src/Crypto/HlpSHA3.pas @@ -224,21 +224,21 @@ TCShake = class abstract(TShake) /// /// the HashSize of the underlying Shake function /// - /// - /// the function name string, note this is reserved for use by NIST. + /// + /// the function name string (N in SP 800-185), reserved for use by NIST. /// Avoid using if not required /// - /// - /// the customization string - available for local use + /// + /// the customization string (S in SP 800-185), available for local use /// - constructor Create(AHashSize: THashSize; const N, S: THashLibByteArray); + constructor Create(AHashSize: THashSize; const AN, &AS: THashLibByteArray); public procedure Initialize(); override; class function RightEncode(AInput: UInt64): THashLibByteArray; static; - class function BytePad(const AInput: THashLibByteArray; AW: Int32) + class function BytePad(const AInput: THashLibByteArray; AWidthInBytes: Int32) : THashLibByteArray; static; class function EncodeString(const AInput: THashLibByteArray) : THashLibByteArray; static; @@ -249,7 +249,7 @@ TCShake_128 = class sealed(TCShake) public - constructor Create(const N, S: THashLibByteArray); + constructor Create(const AN, &AS: THashLibByteArray); function Clone(): IHash; override; end; @@ -258,7 +258,7 @@ TCShake_256 = class sealed(TCShake) public - constructor Create(const N, S: THashLibByteArray); + constructor Create(const AN, &AS: THashLibByteArray); function Clone(): IHash; override; end; @@ -271,6 +271,7 @@ TKMACNotBuildInAdapter = class abstract(THash, IKMAC, IKMACNotBuildIn, FHash: IHash; FKey: THashLibByteArray; + function HashInstanceAsXof: IXOF; function GetName: String; override; function GetKey(): THashLibByteArray; @@ -386,7 +387,7 @@ function TSHA3.GetHashMode(): TSHA3.THashMode; constructor TSHA3.Create(AHashSize: THashSize); begin - Inherited Create(Int32(AHashSize), 200 - (Int32(AHashSize) * 2)); + inherited Create(Int32(AHashSize), 200 - (Int32(AHashSize) * 2)); System.SetLength(FState, 25); end; @@ -420,12 +421,12 @@ function TSHA3.GetResult: THashLibByteArray; procedure TSHA3.Initialize; begin TArrayUtils.ZeroFill(FState); - Inherited Initialize(); + inherited Initialize(); end; procedure TSHA3.KeccakF1600_StatePermute; var - Da, De, Di, &Do, Du: UInt64; + LDa, LDe, LDi, LDo, LDu: UInt64; {$IFDEF USE_UNROLLED_VARIANT} Aba, Abe, Abi, Abo, Abu, Aga, Age, Agi, Ago, Agu, Aka, Ake, Aki, Ako, Aku, Ama, Ame, Ami, Amo, Amu, Asa, Ase, Asi, Aso, Asu, BCa, BCe, BCi, BCo, BCu, @@ -433,9 +434,9 @@ procedure TSHA3.KeccakF1600_StatePermute; Ema, Eme, Emi, Emo, Emu, Esa, Ese, Esi, Eso, Esu: UInt64; LRound: Int32; {$ELSE} - Ca, Ce, Ci, Co, Cu: UInt64; + LColA, LColE, LColI, LColO, LColU: UInt64; LTemp: array [0 .. 24] of UInt64; - j: Int32; + LRound: Int32; {$ENDIF USE_UNROLLED_VARIANT} begin {$IFDEF USE_UNROLLED_VARIANT} @@ -477,21 +478,21 @@ procedure TSHA3.KeccakF1600_StatePermute; BCu := Abu xor Agu xor Aku xor Amu xor Asu; // thetaRhoPiChiIotaPrepareTheta(LRound , A, E) - Da := BCu xor TBits.RotateLeft64(BCe, 1); - De := BCa xor TBits.RotateLeft64(BCi, 1); - Di := BCe xor TBits.RotateLeft64(BCo, 1); - &Do := BCi xor TBits.RotateLeft64(BCu, 1); - Du := BCo xor TBits.RotateLeft64(BCa, 1); + LDa := BCu xor TBits.RotateLeft64(BCe, 1); + LDe := BCa xor TBits.RotateLeft64(BCi, 1); + LDi := BCe xor TBits.RotateLeft64(BCo, 1); + LDo := BCi xor TBits.RotateLeft64(BCu, 1); + LDu := BCo xor TBits.RotateLeft64(BCa, 1); - Aba := Aba xor Da; + Aba := Aba xor LDa; BCa := Aba; - Age := Age xor De; + Age := Age xor LDe; BCe := TBits.RotateLeft64(Age, 44); - Aki := Aki xor Di; + Aki := Aki xor LDi; BCi := TBits.RotateLeft64(Aki, 43); - Amo := Amo xor &Do; + Amo := Amo xor LDo; BCo := TBits.RotateLeft64(Amo, 21); - Asu := Asu xor Du; + Asu := Asu xor LDu; BCu := TBits.RotateLeft64(Asu, 14); Eba := BCa xor ((not BCe) and BCi); Eba := Eba xor UInt64(RC[LRound]); @@ -500,15 +501,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Ebo := BCo xor ((not BCu) and BCa); Ebu := BCu xor ((not BCa) and BCe); - Abo := Abo xor &Do; + Abo := Abo xor LDo; BCa := TBits.RotateLeft64(Abo, 28); - Agu := Agu xor Du; + Agu := Agu xor LDu; BCe := TBits.RotateLeft64(Agu, 20); - Aka := Aka xor Da; + Aka := Aka xor LDa; BCi := TBits.RotateLeft64(Aka, 3); - Ame := Ame xor De; + Ame := Ame xor LDe; BCo := TBits.RotateLeft64(Ame, 45); - Asi := Asi xor Di; + Asi := Asi xor LDi; BCu := TBits.RotateLeft64(Asi, 61); Ega := BCa xor ((not BCe) and BCi); Ege := BCe xor ((not BCi) and BCo); @@ -516,15 +517,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Ego := BCo xor ((not BCu) and BCa); Egu := BCu xor ((not BCa) and BCe); - Abe := Abe xor De; + Abe := Abe xor LDe; BCa := TBits.RotateLeft64(Abe, 1); - Agi := Agi xor Di; + Agi := Agi xor LDi; BCe := TBits.RotateLeft64(Agi, 6); - Ako := Ako xor &Do; + Ako := Ako xor LDo; BCi := TBits.RotateLeft64(Ako, 25); - Amu := Amu xor Du; + Amu := Amu xor LDu; BCo := TBits.RotateLeft64(Amu, 8); - Asa := Asa xor Da; + Asa := Asa xor LDa; BCu := TBits.RotateLeft64(Asa, 18); Eka := BCa xor ((not BCe) and BCi); Eke := BCe xor ((not BCi) and BCo); @@ -532,15 +533,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Eko := BCo xor ((not BCu) and BCa); Eku := BCu xor ((not BCa) and BCe); - Abu := Abu xor Du; + Abu := Abu xor LDu; BCa := TBits.RotateLeft64(Abu, 27); - Aga := Aga xor Da; + Aga := Aga xor LDa; BCe := TBits.RotateLeft64(Aga, 36); - Ake := Ake xor De; + Ake := Ake xor LDe; BCi := TBits.RotateLeft64(Ake, 10); - Ami := Ami xor Di; + Ami := Ami xor LDi; BCo := TBits.RotateLeft64(Ami, 15); - Aso := Aso xor &Do; + Aso := Aso xor LDo; BCu := TBits.RotateLeft64(Aso, 56); Ema := BCa xor ((not BCe) and BCi); Eme := BCe xor ((not BCi) and BCo); @@ -548,15 +549,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Emo := BCo xor ((not BCu) and BCa); Emu := BCu xor ((not BCa) and BCe); - Abi := Abi xor Di; + Abi := Abi xor LDi; BCa := TBits.RotateLeft64(Abi, 62); - Ago := Ago xor &Do; + Ago := Ago xor LDo; BCe := TBits.RotateLeft64(Ago, 55); - Aku := Aku xor Du; + Aku := Aku xor LDu; BCi := TBits.RotateLeft64(Aku, 39); - Ama := Ama xor Da; + Ama := Ama xor LDa; BCo := TBits.RotateLeft64(Ama, 41); - Ase := Ase xor De; + Ase := Ase xor LDe; BCu := TBits.RotateLeft64(Ase, 2); Esa := BCa xor ((not BCe) and BCi); Ese := BCe xor ((not BCi) and BCo); @@ -572,21 +573,21 @@ procedure TSHA3.KeccakF1600_StatePermute; BCu := Ebu xor Egu xor Eku xor Emu xor Esu; // thetaRhoPiChiIotaPrepareTheta(LRound+1, E, A) - Da := BCu xor TBits.RotateLeft64(BCe, 1); - De := BCa xor TBits.RotateLeft64(BCi, 1); - Di := BCe xor TBits.RotateLeft64(BCo, 1); - &Do := BCi xor TBits.RotateLeft64(BCu, 1); - Du := BCo xor TBits.RotateLeft64(BCa, 1); + LDa := BCu xor TBits.RotateLeft64(BCe, 1); + LDe := BCa xor TBits.RotateLeft64(BCi, 1); + LDi := BCe xor TBits.RotateLeft64(BCo, 1); + LDo := BCi xor TBits.RotateLeft64(BCu, 1); + LDu := BCo xor TBits.RotateLeft64(BCa, 1); - Eba := Eba xor Da; + Eba := Eba xor LDa; BCa := Eba; - Ege := Ege xor De; + Ege := Ege xor LDe; BCe := TBits.RotateLeft64(Ege, 44); - Eki := Eki xor Di; + Eki := Eki xor LDi; BCi := TBits.RotateLeft64(Eki, 43); - Emo := Emo xor &Do; + Emo := Emo xor LDo; BCo := TBits.RotateLeft64(Emo, 21); - Esu := Esu xor Du; + Esu := Esu xor LDu; BCu := TBits.RotateLeft64(Esu, 14); Aba := BCa xor ((not BCe) and BCi); Aba := Aba xor UInt64(RC[LRound + 1]); @@ -595,15 +596,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Abo := BCo xor ((not BCu) and BCa); Abu := BCu xor ((not BCa) and BCe); - Ebo := Ebo xor &Do; + Ebo := Ebo xor LDo; BCa := TBits.RotateLeft64(Ebo, 28); - Egu := Egu xor Du; + Egu := Egu xor LDu; BCe := TBits.RotateLeft64(Egu, 20); - Eka := Eka xor Da; + Eka := Eka xor LDa; BCi := TBits.RotateLeft64(Eka, 3); - Eme := Eme xor De; + Eme := Eme xor LDe; BCo := TBits.RotateLeft64(Eme, 45); - Esi := Esi xor Di; + Esi := Esi xor LDi; BCu := TBits.RotateLeft64(Esi, 61); Aga := BCa xor ((not BCe) and BCi); Age := BCe xor ((not BCi) and BCo); @@ -611,15 +612,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Ago := BCo xor ((not BCu) and BCa); Agu := BCu xor ((not BCa) and BCe); - Ebe := Ebe xor De; + Ebe := Ebe xor LDe; BCa := TBits.RotateLeft64(Ebe, 1); - Egi := Egi xor Di; + Egi := Egi xor LDi; BCe := TBits.RotateLeft64(Egi, 6); - Eko := Eko xor &Do; + Eko := Eko xor LDo; BCi := TBits.RotateLeft64(Eko, 25); - Emu := Emu xor Du; + Emu := Emu xor LDu; BCo := TBits.RotateLeft64(Emu, 8); - Esa := Esa xor Da; + Esa := Esa xor LDa; BCu := TBits.RotateLeft64(Esa, 18); Aka := BCa xor ((not BCe) and BCi); Ake := BCe xor ((not BCi) and BCo); @@ -627,15 +628,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Ako := BCo xor ((not BCu) and BCa); Aku := BCu xor ((not BCa) and BCe); - Ebu := Ebu xor Du; + Ebu := Ebu xor LDu; BCa := TBits.RotateLeft64(Ebu, 27); - Ega := Ega xor Da; + Ega := Ega xor LDa; BCe := TBits.RotateLeft64(Ega, 36); - Eke := Eke xor De; + Eke := Eke xor LDe; BCi := TBits.RotateLeft64(Eke, 10); - Emi := Emi xor Di; + Emi := Emi xor LDi; BCo := TBits.RotateLeft64(Emi, 15); - Eso := Eso xor &Do; + Eso := Eso xor LDo; BCu := TBits.RotateLeft64(Eso, 56); Ama := BCa xor ((not BCe) and BCi); Ame := BCe xor ((not BCi) and BCo); @@ -643,15 +644,15 @@ procedure TSHA3.KeccakF1600_StatePermute; Amo := BCo xor ((not BCu) and BCa); Amu := BCu xor ((not BCa) and BCe); - Ebi := Ebi xor Di; + Ebi := Ebi xor LDi; BCa := TBits.RotateLeft64(Ebi, 62); - Ego := Ego xor &Do; + Ego := Ego xor LDo; BCe := TBits.RotateLeft64(Ego, 55); - Eku := Eku xor Du; + Eku := Eku xor LDu; BCi := TBits.RotateLeft64(Eku, 39); - Ema := Ema xor Da; + Ema := Ema xor LDa; BCo := TBits.RotateLeft64(Ema, 41); - Ese := Ese xor De; + Ese := Ese xor LDe; BCu := TBits.RotateLeft64(Ese, 2); Asa := BCa xor ((not BCe) and BCi); Ase := BCe xor ((not BCi) and BCo); @@ -690,48 +691,48 @@ procedure TSHA3.KeccakF1600_StatePermute; FState[24] := Asu; {$ELSE} - for j := 0 to 23 do + for LRound := 0 to 23 do begin - Ca := FState[00] xor FState[05] xor FState[10] xor FState[15] + LColA := FState[00] xor FState[05] xor FState[10] xor FState[15] xor FState[20]; - Ce := FState[01] xor FState[06] xor FState[11] xor FState[16] + LColE := FState[01] xor FState[06] xor FState[11] xor FState[16] xor FState[21]; - Ci := FState[02] xor FState[07] xor FState[12] xor FState[17] + LColI := FState[02] xor FState[07] xor FState[12] xor FState[17] xor FState[22]; - Co := FState[03] xor FState[08] xor FState[13] xor FState[18] + LColO := FState[03] xor FState[08] xor FState[13] xor FState[18] xor FState[23]; - Cu := FState[04] xor FState[09] xor FState[14] xor FState[19] + LColU := FState[04] xor FState[09] xor FState[14] xor FState[19] xor FState[24]; - Da := TBits.RotateLeft64(Ca, 1) xor Co; - De := TBits.RotateLeft64(Ce, 1) xor Cu; - Di := TBits.RotateLeft64(Ci, 1) xor Ca; - &Do := TBits.RotateLeft64(Co, 1) xor Ce; - Du := TBits.RotateLeft64(Cu, 1) xor Ci; - LTemp[00] := FState[00] xor De; - LTemp[01] := TBits.RotateLeft64(FState[06] xor Di, 44); - LTemp[02] := TBits.RotateLeft64(FState[12] xor &Do, 43); - LTemp[03] := TBits.RotateLeft64(FState[18] xor Du, 21); - LTemp[04] := TBits.RotateLeft64(FState[24] xor Da, 14); - LTemp[05] := TBits.RotateLeft64(FState[03] xor Du, 28); - LTemp[06] := TBits.RotateLeft64(FState[09] xor Da, 20); - LTemp[07] := TBits.RotateLeft64(FState[10] xor De, 3); - LTemp[08] := TBits.RotateLeft64(FState[16] xor Di, 45); - LTemp[09] := TBits.RotateLeft64(FState[22] xor &Do, 61); - LTemp[10] := TBits.RotateLeft64(FState[01] xor Di, 1); - LTemp[11] := TBits.RotateLeft64(FState[07] xor &Do, 6); - LTemp[12] := TBits.RotateLeft64(FState[13] xor Du, 25); - LTemp[13] := TBits.RotateLeft64(FState[19] xor Da, 8); - LTemp[14] := TBits.RotateLeft64(FState[20] xor De, 18); - LTemp[15] := TBits.RotateLeft64(FState[04] xor Da, 27); - LTemp[16] := TBits.RotateLeft64(FState[05] xor De, 36); - LTemp[17] := TBits.RotateLeft64(FState[11] xor Di, 10); - LTemp[18] := TBits.RotateLeft64(FState[17] xor &Do, 15); - LTemp[19] := TBits.RotateLeft64(FState[23] xor Du, 56); - LTemp[20] := TBits.RotateLeft64(FState[02] xor &Do, 62); - LTemp[21] := TBits.RotateLeft64(FState[08] xor Du, 55); - LTemp[22] := TBits.RotateLeft64(FState[14] xor Da, 39); - LTemp[23] := TBits.RotateLeft64(FState[15] xor De, 41); - LTemp[24] := TBits.RotateLeft64(FState[21] xor Di, 2); + LDa := TBits.RotateLeft64(LColA, 1) xor LColO; + LDe := TBits.RotateLeft64(LColE, 1) xor LColU; + LDi := TBits.RotateLeft64(LColI, 1) xor LColA; + LDo := TBits.RotateLeft64(LColO, 1) xor LColE; + LDu := TBits.RotateLeft64(LColU, 1) xor LColI; + LTemp[00] := FState[00] xor LDe; + LTemp[01] := TBits.RotateLeft64(FState[06] xor LDi, 44); + LTemp[02] := TBits.RotateLeft64(FState[12] xor LDo, 43); + LTemp[03] := TBits.RotateLeft64(FState[18] xor LDu, 21); + LTemp[04] := TBits.RotateLeft64(FState[24] xor LDa, 14); + LTemp[05] := TBits.RotateLeft64(FState[03] xor LDu, 28); + LTemp[06] := TBits.RotateLeft64(FState[09] xor LDa, 20); + LTemp[07] := TBits.RotateLeft64(FState[10] xor LDe, 3); + LTemp[08] := TBits.RotateLeft64(FState[16] xor LDi, 45); + LTemp[09] := TBits.RotateLeft64(FState[22] xor LDo, 61); + LTemp[10] := TBits.RotateLeft64(FState[01] xor LDi, 1); + LTemp[11] := TBits.RotateLeft64(FState[07] xor LDo, 6); + LTemp[12] := TBits.RotateLeft64(FState[13] xor LDu, 25); + LTemp[13] := TBits.RotateLeft64(FState[19] xor LDa, 8); + LTemp[14] := TBits.RotateLeft64(FState[20] xor LDe, 18); + LTemp[15] := TBits.RotateLeft64(FState[04] xor LDa, 27); + LTemp[16] := TBits.RotateLeft64(FState[05] xor LDe, 36); + LTemp[17] := TBits.RotateLeft64(FState[11] xor LDi, 10); + LTemp[18] := TBits.RotateLeft64(FState[17] xor LDo, 15); + LTemp[19] := TBits.RotateLeft64(FState[23] xor LDu, 56); + LTemp[20] := TBits.RotateLeft64(FState[02] xor LDo, 62); + LTemp[21] := TBits.RotateLeft64(FState[08] xor LDu, 55); + LTemp[22] := TBits.RotateLeft64(FState[14] xor LDa, 39); + LTemp[23] := TBits.RotateLeft64(FState[15] xor LDe, 41); + LTemp[24] := TBits.RotateLeft64(FState[21] xor LDi, 2); FState[00] := LTemp[00] xor ((not LTemp[01]) and LTemp[02]); FState[01] := LTemp[01] xor ((not LTemp[02]) and LTemp[03]); FState[02] := LTemp[02] xor ((not LTemp[03]) and LTemp[04]); @@ -757,7 +758,7 @@ procedure TSHA3.KeccakF1600_StatePermute; FState[22] := LTemp[22] xor ((not LTemp[23]) and LTemp[24]); FState[23] := LTemp[23] xor ((not LTemp[24]) and LTemp[20]); FState[24] := LTemp[24] xor ((not LTemp[20]) and LTemp[21]); - FState[00] := FState[00] xor RC[j]; + FState[00] := FState[00] xor RC[LRound]; end; System.FillChar(LTemp, System.SizeOf(LTemp), UInt64(0)); @@ -767,15 +768,15 @@ procedure TSHA3.KeccakF1600_StatePermute; procedure TSHA3.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var LData: array [0 .. 20] of UInt64; - LJdx, LBlockCount: Int32; + LInnerIdx, LBlockCount: Int32; begin TConverters.le64_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - LJdx := 0; + LInnerIdx := 0; LBlockCount := BlockSize shr 3; - while LJdx < LBlockCount do + while LInnerIdx < LBlockCount do begin - FState[LJdx] := FState[LJdx] xor LData[LJdx]; - System.Inc(LJdx); + FState[LInnerIdx] := FState[LInnerIdx] xor LData[LInnerIdx]; + System.Inc(LInnerIdx); end; KeccakF1600_StatePermute(); @@ -792,13 +793,13 @@ function TSHA3_224.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TSHA3_224.Create; begin - Inherited Create(THashSize.hsHashSize224); + inherited Create(THashSize.hsHashSize224); end; { TSHA3_256 } @@ -811,13 +812,13 @@ function TSHA3_256.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TSHA3_256.Create; begin - Inherited Create(THashSize.hsHashSize256); + inherited Create(THashSize.hsHashSize256); end; { TSHA3_384 } @@ -830,13 +831,13 @@ function TSHA3_384.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TSHA3_384.Create; begin - Inherited Create(THashSize.hsHashSize384); + inherited Create(THashSize.hsHashSize384); end; { TSHA3_512 } @@ -849,13 +850,13 @@ function TSHA3_512.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TSHA3_512.Create; begin - Inherited Create(THashSize.hsHashSize512); + inherited Create(THashSize.hsHashSize512); end; { TKeccak_224 } @@ -868,13 +869,13 @@ function TKeccak_224.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TKeccak_224.Create; begin - Inherited Create(THashSize.hsHashSize224); + inherited Create(THashSize.hsHashSize224); end; { TKeccak_256 } @@ -887,13 +888,13 @@ function TKeccak_256.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TKeccak_256.Create; begin - Inherited Create(THashSize.hsHashSize256); + inherited Create(THashSize.hsHashSize256); end; { TKeccak_288 } @@ -906,13 +907,13 @@ function TKeccak_288.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TKeccak_288.Create; begin - Inherited Create(THashSize.hsHashSize288); + inherited Create(THashSize.hsHashSize288); end; { TKeccak_384 } @@ -925,13 +926,13 @@ function TKeccak_384.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TKeccak_384.Create; begin - Inherited Create(THashSize.hsHashSize384); + inherited Create(THashSize.hsHashSize384); end; { TKeccak_512 } @@ -944,13 +945,13 @@ function TKeccak_512.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TKeccak_512.Create; begin - Inherited Create(THashSize.hsHashSize512); + inherited Create(THashSize.hsHashSize512); end; { TShake } @@ -965,7 +966,7 @@ function TShake.SetXOFSizeInBitsInternal(AXofSizeInBits: UInt64): IXOF; LXofSizeInBytes: UInt64; begin LXofSizeInBytes := AXofSizeInBits shr 3; - If (((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1)) then + if (((AXofSizeInBits and $7) <> 0) or (LXofSizeInBytes < 1)) then begin raise EArgumentInvalidHashLibException.CreateRes(@SInvalidXOFSize); end; @@ -985,7 +986,7 @@ procedure TShake.SetXOFSizeInBits(AXofSizeInBits: UInt64); constructor TShake.Create(AHashSize: THashSize); begin - Inherited Create(AHashSize); + inherited Create(AHashSize); FFinalized := False; System.SetLength(FShakeBuffer, 8); end; @@ -1102,8 +1103,8 @@ function TShake_128.Clone(): IHash; LXof: IXOF; begin // Xof Cloning - LXof := (TShake_128.Create() as IXOF); - LXof.XOFSizeInBits := (Self as IXOF).XOFSizeInBits; + LXof := TShake_128.Create(); + LXof.XOFSizeInBits := Self.XOFSizeInBits; // Shake_128 Cloning LHashInstance := LXof as TShake_128; @@ -1117,13 +1118,13 @@ function TShake_128.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TShake_128.Create; begin - Inherited Create(THashSize.hsHashSize128); + inherited Create(THashSize.hsHashSize128); end; { TShake_256 } @@ -1134,8 +1135,8 @@ function TShake_256.Clone(): IHash; LXof: IXOF; begin // Xof Cloning - LXof := (TShake_256.Create() as IXOF); - LXof.XOFSizeInBits := (Self as IXOF).XOFSizeInBits; + LXof := TShake_256.Create(); + LXof.XOFSizeInBits := Self.XOFSizeInBits; // Shake_256 Cloning LHashInstance := LXof as TShake_256; @@ -1149,13 +1150,13 @@ function TShake_256.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TShake_256.Create; begin - Inherited Create(THashSize.hsHashSize256); + inherited Create(THashSize.hsHashSize256); end; { TCShake } @@ -1174,60 +1175,60 @@ function TCShake.GetHashMode(): TSHA3.THashMode; class function TCShake.LeftEncode(AInput: UInt64): THashLibByteArray; var - LN: Byte; - LV: UInt64; + LLengthByteCount: Byte; + LScanValue: UInt64; LIdx: Int32; begin - LN := 1; - LV := AInput; - LV := LV shr 8; + LLengthByteCount := 1; + LScanValue := AInput; + LScanValue := LScanValue shr 8; - while (LV <> 0) do + while (LScanValue <> 0) do begin - System.Inc(LN); - LV := LV shr 8; + System.Inc(LLengthByteCount); + LScanValue := LScanValue shr 8; end; - System.SetLength(Result, LN + 1); - Result[0] := LN; - for LIdx := 1 to LN do + System.SetLength(Result, LLengthByteCount + 1); + Result[0] := LLengthByteCount; + for LIdx := 1 to LLengthByteCount do begin - Result[LIdx] := Byte(AInput shr (8 * (LN - LIdx))); + Result[LIdx] := Byte(AInput shr (8 * (LLengthByteCount - LIdx))); end; end; class function TCShake.RightEncode(AInput: UInt64): THashLibByteArray; var - LN: Byte; - LV: UInt64; + LLengthByteCount: Byte; + LScanValue: UInt64; LIdx: Int32; begin - LN := 1; - LV := AInput; - LV := LV shr 8; + LLengthByteCount := 1; + LScanValue := AInput; + LScanValue := LScanValue shr 8; - while (LV <> 0) do + while (LScanValue <> 0) do begin - System.Inc(LN); - LV := LV shr 8; + System.Inc(LLengthByteCount); + LScanValue := LScanValue shr 8; end; - System.SetLength(Result, LN + 1); - Result[LN] := LN; - for LIdx := 1 to LN do + System.SetLength(Result, LLengthByteCount + 1); + Result[LLengthByteCount] := LLengthByteCount; + for LIdx := 1 to LLengthByteCount do begin - Result[LIdx - 1] := Byte(AInput shr (8 * (LN - LIdx))); + Result[LIdx - 1] := Byte(AInput shr (8 * (LLengthByteCount - LIdx))); end; end; -class function TCShake.BytePad(const AInput: THashLibByteArray; AW: Int32) - : THashLibByteArray; +class function TCShake.BytePad(const AInput: THashLibByteArray; + AWidthInBytes: Int32): THashLibByteArray; var LBuffer: THashLibByteArray; LPadLength: Int32; begin - LBuffer := TArrayUtils.Concatenate(LeftEncode(UInt64(AW)), AInput); - LPadLength := AW - (System.Length(LBuffer) mod AW); + LBuffer := TArrayUtils.Concatenate(LeftEncode(UInt64(AWidthInBytes)), AInput); + LPadLength := AWidthInBytes - (System.Length(LBuffer) mod AWidthInBytes); System.SetLength(Result, LPadLength); Result := TArrayUtils.Concatenate(LBuffer, Result); end; @@ -1244,28 +1245,29 @@ class function TCShake.EncodeString(const AInput: THashLibByteArray) ), AInput); end; -constructor TCShake.Create(AHashSize: THashSize; const N, S: THashLibByteArray); +constructor TCShake.Create(AHashSize: THashSize; const AN, &AS + : THashLibByteArray); begin - Inherited Create(AHashSize); + inherited Create(AHashSize); - FN := N; - FS := S; + FN := AN; + FS := &AS; if (System.Length(FN) = 0) and (System.Length(FS) = 0) then begin - FInitBlock := Nil; + FInitBlock := nil; end else begin - FInitBlock := TArrayUtils.Concatenate(EncodeString(N), EncodeString(S)); + FInitBlock := TArrayUtils.Concatenate(EncodeString(AN), EncodeString(&AS)); end; end; procedure TCShake.Initialize; begin - Inherited Initialize(); + inherited Initialize(); - if FInitBlock <> Nil then + if FInitBlock <> nil then begin TransformBytes(BytePad(FInitBlock, BlockSize)); end; @@ -1279,8 +1281,8 @@ function TCShake_128.Clone(): IHash; LXof: IXOF; begin // Xof Cloning - LXof := TCShake_128.Create(System.Copy(FN), System.Copy(FS)) as IXOF; - LXof.XOFSizeInBits := (Self as IXOF).XOFSizeInBits; + LXof := TCShake_128.Create(System.Copy(FN), System.Copy(FS)); + LXof.XOFSizeInBits := Self.XOFSizeInBits; // CShake_128 Cloning LHashInstance := LXof as TCShake_128; @@ -1296,13 +1298,13 @@ function TCShake_128.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; -constructor TCShake_128.Create(const N, S: THashLibByteArray); +constructor TCShake_128.Create(const AN, &AS: THashLibByteArray); begin - Inherited Create(THashSize.hsHashSize128, N, S); + inherited Create(THashSize.hsHashSize128, AN, &AS); end; { TCShake_256 } @@ -1313,8 +1315,8 @@ function TCShake_256.Clone(): IHash; LXof: IXOF; begin // Xof Cloning - LXof := TCShake_256.Create(System.Copy(FN), System.Copy(FS)) as IXOF; - LXof.XOFSizeInBits := (Self as IXOF).XOFSizeInBits; + LXof := TCShake_256.Create(System.Copy(FN), System.Copy(FS)); + LXof.XOFSizeInBits := Self.XOFSizeInBits; // CShake_256 Cloning LHashInstance := LXof as TCShake_256; @@ -1330,17 +1332,27 @@ function TCShake_256.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; -constructor TCShake_256.Create(const N, S: THashLibByteArray); +constructor TCShake_256.Create(const AN, &AS: THashLibByteArray); begin - Inherited Create(THashSize.hsHashSize256, N, S); + inherited Create(THashSize.hsHashSize256, AN, &AS); end; { TKMACNotBuildInAdapter } +function TKMACNotBuildInAdapter.HashInstanceAsXof: IXOF; +var + LXof: IXOF; +begin + if not Supports(FHash, IXOF, LXof) then + raise EInvalidOperationHashLibException.Create( + 'Internal error: KMAC hash must implement IXOF'); + Result := LXof; +end; + procedure TKMACNotBuildInAdapter.Clear(); begin TArrayUtils.ZeroFill(FKey); @@ -1348,7 +1360,7 @@ procedure TKMACNotBuildInAdapter.Clear(); constructor TKMACNotBuildInAdapter.Create(AHashSize: Int32); begin - Inherited Create(AHashSize, 200 - (AHashSize * 2)); + inherited Create(AHashSize, 200 - (AHashSize * 2)); end; destructor TKMACNotBuildInAdapter.Destroy; @@ -1359,17 +1371,20 @@ destructor TKMACNotBuildInAdapter.Destroy; procedure TKMACNotBuildInAdapter.DoOutput(const ADestination: THashLibByteArray; ADestinationOffset, AOutputLength: UInt64); +var + LXof: IXOF; begin + LXof := HashInstanceAsXof; if Supports(Self, IXOF) then begin TransformBytes(TCShake.RightEncode(0)); end else begin - TransformBytes(TCShake.RightEncode((FHash as IXOF).XOFSizeInBits)); + TransformBytes(TCShake.RightEncode(LXof.XOFSizeInBits)); end; - (FHash as IXOF).DoOutput(ADestination, ADestinationOffset, AOutputLength); + LXof.DoOutput(ADestination, ADestinationOffset, AOutputLength); end; function TKMACNotBuildInAdapter.GetKey: THashLibByteArray; @@ -1390,9 +1405,9 @@ procedure TKMACNotBuildInAdapter.Initialize; procedure TKMACNotBuildInAdapter.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin - FKey := Nil; + FKey := nil; end else begin @@ -1410,7 +1425,7 @@ function TKMACNotBuildInAdapter.GetResult: THashLibByteArray; var LXofSizeInBytes: UInt64; begin - LXofSizeInBytes := (FHash as IXOF).XOFSizeInBits shr 3; + LXofSizeInBytes := HashInstanceAsXof.XOFSizeInBits shr 3; System.SetLength(Result, LXofSizeInBytes); DoOutput(Result, 0, LXofSizeInBytes); end; @@ -1421,8 +1436,7 @@ function TKMACNotBuildInAdapter.TransformFinal: IHashResult; begin LBuffer := GetResult(); {$IFDEF DEBUG} - System.Assert(UInt64(System.Length(LBuffer)) - = ((FHash as IXOF).XOFSizeInBits shr 3)); + System.Assert(UInt64(System.Length(LBuffer)) = (HashInstanceAsXof.XOFSizeInBits shr 3)); {$ENDIF DEBUG} Initialize(); Result := THashResult.Create(LBuffer); @@ -1435,8 +1449,8 @@ function TKMAC128.Clone(): IHash; LHashInstance: TKMAC128; begin LHashInstance := TKMAC128.Create(FHash.Clone(), FKey, - (FHash as IXOF).XOFSizeInBits); - Result := LHashInstance as IHash; + HashInstanceAsXof.XOFSizeInBits); + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -1453,35 +1467,34 @@ constructor TKMAC128.Create(const AHash: IHash; inherited Create(Int32(THashSize.hsHashSize128)); SetKey(AKMACKey); FHash := AHash; - (FHash as IXOF).XOFSizeInBits := AOutputLengthInBits; + HashInstanceAsXof.XOFSizeInBits := AOutputLengthInBits; end; class function TKMAC128.CreateKMAC128(const AKMACKey, ACustomization : THashLibByteArray; AOutputLengthInBits: UInt64): IKMAC; begin - Result := TKMAC128.Create(AKMACKey, ACustomization, - AOutputLengthInBits) as IKMAC; + Result := TKMAC128.Create(AKMACKey, ACustomization, AOutputLengthInBits); end; { TKMAC128XOF } function TKMAC128XOF.SetXOFSizeInBitsInternal(AXofSizeInBits: UInt64): IXOF; var - AXofSizeInBytes: UInt64; + LXofSizeInBytes: UInt64; begin - AXofSizeInBytes := AXofSizeInBits shr 3; - If (((AXofSizeInBytes and $7) <> 0) or (AXofSizeInBytes < 1)) then + LXofSizeInBytes := AXofSizeInBits shr 3; + if (((LXofSizeInBytes and $7) <> 0) or (LXofSizeInBytes < 1)) then begin raise EArgumentInvalidHashLibException.CreateRes(@SInvalidXOFSize); end; - (FHash as IXOF).XOFSizeInBits := AXofSizeInBits; + HashInstanceAsXof.XOFSizeInBits := AXofSizeInBits; Result := Self; end; function TKMAC128XOF.GetXOFSizeInBits: UInt64; begin - Result := (FHash as IXOF).XOFSizeInBits; + Result := HashInstanceAsXof.XOFSizeInBits; end; procedure TKMAC128XOF.SetXOFSizeInBits(AXofSizeInBits: UInt64); @@ -1495,9 +1508,9 @@ function TKMAC128XOF.Clone(): IHash; LXof: IXOF; begin LHashInstance := TKMAC128XOF.Create(FHash.Clone(), FKey); - LXof := LHashInstance as IXOF; + LXof := LHashInstance; LXof.XOFSizeInBits := XOFSizeInBits; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -1521,9 +1534,9 @@ class function TKMAC128XOF.CreateKMAC128XOF(const AKMACKey, ACustomization var LXof: IXOF; begin - LXof := (TKMAC128XOF.Create(AKMACKey, ACustomization) as IKMAC) as IXOF; + LXof := TKMAC128XOF.Create(AKMACKey, ACustomization); LXof.XOFSizeInBits := AXofSizeInBits; - Result := (LXof as IHash) as IKMAC; + Result := LXof as IKMAC; end; { TKMAC256 } @@ -1533,8 +1546,8 @@ function TKMAC256.Clone(): IHash; LHashInstance: TKMAC256; begin LHashInstance := TKMAC256.Create(FHash.Clone(), FKey, - (FHash as IXOF).XOFSizeInBits); - Result := LHashInstance as IHash; + HashInstanceAsXof.XOFSizeInBits); + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -1551,35 +1564,34 @@ constructor TKMAC256.Create(const AHash: IHash; inherited Create(Int32(THashSize.hsHashSize256)); SetKey(AKMACKey); FHash := AHash; - (FHash as IXOF).XOFSizeInBits := AOutputLengthInBits; + HashInstanceAsXof.XOFSizeInBits := AOutputLengthInBits; end; class function TKMAC256.CreateKMAC256(const AKMACKey, ACustomization : THashLibByteArray; AOutputLengthInBits: UInt64): IKMAC; begin - Result := TKMAC256.Create(AKMACKey, ACustomization, - AOutputLengthInBits) as IKMAC; + Result := TKMAC256.Create(AKMACKey, ACustomization, AOutputLengthInBits); end; { TKMAC256XOF } function TKMAC256XOF.SetXOFSizeInBitsInternal(AXofSizeInBits: UInt64): IXOF; var - AXofSizeInBytes: UInt64; + LXofSizeInBytes: UInt64; begin - AXofSizeInBytes := AXofSizeInBits shr 3; - If (((AXofSizeInBytes and $7) <> 0) or (AXofSizeInBytes < 1)) then + LXofSizeInBytes := AXofSizeInBits shr 3; + if (((LXofSizeInBytes and $7) <> 0) or (LXofSizeInBytes < 1)) then begin raise EArgumentInvalidHashLibException.CreateRes(@SInvalidXOFSize); end; - (FHash as IXOF).XOFSizeInBits := AXofSizeInBits; + HashInstanceAsXof.XOFSizeInBits := AXofSizeInBits; Result := Self; end; function TKMAC256XOF.GetXOFSizeInBits: UInt64; begin - Result := (FHash as IXOF).XOFSizeInBits; + Result := HashInstanceAsXof.XOFSizeInBits; end; procedure TKMAC256XOF.SetXOFSizeInBits(AXofSizeInBits: UInt64); @@ -1593,9 +1605,9 @@ function TKMAC256XOF.Clone(): IHash; LXof: IXOF; begin LHashInstance := TKMAC256XOF.Create(FHash.Clone(), FKey); - LXof := LHashInstance as IXOF; + LXof := LHashInstance; LXof.XOFSizeInBits := XOFSizeInBits; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; @@ -1619,9 +1631,9 @@ class function TKMAC256XOF.CreateKMAC256XOF(const AKMACKey, ACustomization var LXof: IXOF; begin - LXof := (TKMAC256XOF.Create(AKMACKey, ACustomization) as IKMAC) as IXOF; + LXof := TKMAC256XOF.Create(AKMACKey, ACustomization); LXof.XOFSizeInBits := AXofSizeInBits; - Result := (LXof as IHash) as IKMAC; + Result := LXof as IKMAC; end; { TKeccak } diff --git a/HashLib/src/Crypto/HlpSnefru.pas b/HashLib/src/Crypto/HlpSnefru.pas index 9056a6f3..ca69309d 100644 --- a/HashLib/src/Crypto/HlpSnefru.pas +++ b/HashLib/src/Crypto/HlpSnefru.pas @@ -32,7 +32,7 @@ TSnefru = class sealed(TBlockHash, ICryptoNotBuildIn, ITransformBlock) FSecurityLevel: Int32; const - SShifts: array [0 .. 3] of Int32 = (16, 8, 16, 24); + Shifts: array [0 .. 3] of Int32 = (16, 8, 16, 24); class var @@ -89,13 +89,13 @@ function TSnefru.Clone(): IHash; LHashInstance.FState := System.Copy(FState); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TSnefru.Create(ASecurityLevel: Int32; AHashSize: THashSize); begin - Inherited Create(Int32(AHashSize), 64 - (Int32(AHashSize))); + inherited Create(Int32(AHashSize), 64 - (Int32(AHashSize))); FSecurityLevel := Int32(ASecurityLevel); System.SetLength(FState, HashSize shr 2); end; @@ -143,14 +143,14 @@ function TSnefru.GetResult: THashLibByteArray; procedure TSnefru.Initialize; begin TArrayUtils.ZeroFill(FState); - Inherited Initialize(); + inherited Initialize(); end; procedure TSnefru.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var LSBox0, LSBox1: THashLibUInt32Array; - LIdx, LJdx, LKdx, LShift: Int32; + LIdx, LInnerIdx, LWordIdx, LShift: Int32; LWork: array [0 .. 15] of UInt32; LPtrWork: PCardinal; begin @@ -168,8 +168,8 @@ procedure TSnefru.TransformBlock(AData: PByte; ADataLength: Int32; LSBox0 := FSBoxes[LIdx * 2 + 0]; LSBox1 := FSBoxes[LIdx * 2 + 1]; - LJdx := 0; - while LJdx < 4 do + LInnerIdx := 0; + while LInnerIdx < 4 do begin LWork[15] := LWork[15] xor LSBox0[Byte(LWork[0])]; LWork[1] := LWork[1] xor LSBox0[Byte(LWork[0])]; @@ -204,17 +204,17 @@ procedure TSnefru.TransformBlock(AData: PByte; ADataLength: Int32; LWork[14] := LWork[14] xor LSBox1[Byte(LWork[15])]; LWork[0] := LWork[0] xor LSBox1[Byte(LWork[15])]; - LShift := SShifts[LJdx]; + LShift := Shifts[LInnerIdx]; - LKdx := 0; + LWordIdx := 0; - while LKdx < 16 do + while LWordIdx < 16 do begin - LWork[LKdx] := TBits.RotateRight32(LWork[LKdx], LShift); - System.Inc(LKdx); + LWork[LWordIdx] := TBits.RotateRight32(LWork[LWordIdx], LShift); + System.Inc(LWordIdx); end; - System.Inc(LJdx); + System.Inc(LInnerIdx); end; System.Inc(LIdx); diff --git a/HashLib/src/Crypto/HlpTiger.pas b/HashLib/src/Crypto/HlpTiger.pas index 2175e1ea..6b108502 100644 --- a/HashLib/src/Crypto/HlpTiger.pas +++ b/HashLib/src/Crypto/HlpTiger.pas @@ -640,7 +640,7 @@ function TTiger.GetHashRound(AHashRound: Int32): THashRounds; constructor TTiger.Create(AHashSize: Int32; ARounds: THashRounds); begin - Inherited Create(AHashSize, 64); + inherited Create(AHashSize, 64); System.SetLength(FHash, 3); FRounds := Int32(ARounds); end; @@ -691,77 +691,77 @@ procedure TTiger.Initialize; FHash[0] := $0123456789ABCDEF; FHash[1] := UInt64($FEDCBA9876543210); FHash[2] := UInt64($F096A5B4C3B2E187); - Inherited Initialize(); + inherited Initialize(); end; procedure TTiger.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - LA, LB, LC, LTempA: UInt64; + LRegA, LRegB, LRegC, LShuffleTemp: UInt64; LRounds: Int32; LData: array [0 .. 7] of UInt64; begin TConverters.le64_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - LA := FHash[0]; - LB := FHash[1]; - LC := FHash[2]; - - LC := LC xor LData[0]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 5; - - LA := LA xor LData[1]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 5; - - LB := LB xor LData[2]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 5; - - LC := LC xor LData[3]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 5; - - LA := LA xor LData[4]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 5; - - LB := LB xor LData[5]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 5; - - LC := LC xor LData[6]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 5; - - LA := LA xor LData[7]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 5; + LRegA := FHash[0]; + LRegB := FHash[1]; + LRegC := FHash[2]; + + LRegC := LRegC xor LData[0]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 5; + + LRegA := LRegA xor LData[1]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 5; + + LRegB := LRegB xor LData[2]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 5; + + LRegC := LRegC xor LData[3]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 5; + + LRegA := LRegA xor LData[4]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 5; + + LRegB := LRegB xor LData[5]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 5; + + LRegC := LRegC xor LData[6]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 5; + + LRegA := LRegA xor LData[7]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 5; LData[0] := LData[0] - (LData[7] xor C1); LData[1] := LData[1] xor LData[0]; @@ -780,61 +780,61 @@ procedure TTiger.TransformBlock(AData: PByte; ADataLength: Int32; LData[6] := LData[6] + LData[5]; LData[7] := LData[7] - (LData[6] xor C2); - LB := LB xor LData[0]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 7; - - LC := LC xor LData[1]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 7; - - LA := LA xor LData[2]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 7; - - LB := LB xor LData[3]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 7; - - LC := LC xor LData[4]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 7; - - LA := LA xor LData[5]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 7; - - LB := LB xor LData[6]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 7; - - LC := LC xor LData[7]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 7; + LRegB := LRegB xor LData[0]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 7; + + LRegC := LRegC xor LData[1]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 7; + + LRegA := LRegA xor LData[2]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 7; + + LRegB := LRegB xor LData[3]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 7; + + LRegC := LRegC xor LData[4]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 7; + + LRegA := LRegA xor LData[5]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 7; + + LRegB := LRegB xor LData[6]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 7; + + LRegC := LRegC xor LData[7]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 7; LData[0] := LData[0] - (LData[7] xor C1); LData[1] := LData[1] xor LData[0]; @@ -853,61 +853,61 @@ procedure TTiger.TransformBlock(AData: PByte; ADataLength: Int32; LData[6] := LData[6] + LData[5]; LData[7] := LData[7] - (LData[6] xor C2); - LA := LA xor LData[0]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[1]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[2]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[3]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[4]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[5]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[6]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[7]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; + LRegA := LRegA xor LData[0]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[1]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[2]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[3]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[4]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[5]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[6]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[7]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; LRounds := 3; while LRounds < FRounds do @@ -929,73 +929,73 @@ procedure TTiger.TransformBlock(AData: PByte; ADataLength: Int32; LData[6] := LData[6] + LData[5]; LData[7] := LData[7] - (LData[6] xor C2); - LC := LC xor LData[0]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[1]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[2]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[3]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[4]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[5]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[6]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[7]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LTempA := LA; - LA := LC; - LC := LB; - LB := LTempA; + LRegC := LRegC xor LData[0]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[1]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[2]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[3]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[4]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[5]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[6]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[7]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LShuffleTemp := LRegA; + LRegA := LRegC; + LRegC := LRegB; + LRegB := LShuffleTemp; System.Inc(LRounds); end; - FHash[0] := FHash[0] xor LA; - FHash[1] := LB - FHash[1]; - FHash[2] := FHash[2] + LC; + FHash[0] := FHash[0] xor LRegA; + FHash[1] := LRegB - FHash[1]; + FHash[2] := FHash[2] + LRegC; System.FillChar(LData, System.SizeOf(LData), UInt64(0)); end; @@ -1010,23 +1010,23 @@ function TTiger_128.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger_128.CreateRound3; begin - Inherited Create(16, THashRounds.hrRounds3); + inherited Create(16, THashRounds.hrRounds3); end; constructor TTiger_128.CreateRound4; begin - Inherited Create(16, THashRounds.hrRounds4); + inherited Create(16, THashRounds.hrRounds4); end; constructor TTiger_128.CreateRound5; begin - Inherited Create(16, THashRounds.hrRounds5); + inherited Create(16, THashRounds.hrRounds5); end; { TTiger_160 } @@ -1039,23 +1039,23 @@ function TTiger_160.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger_160.CreateRound3; begin - Inherited Create(20, THashRounds.hrRounds3); + inherited Create(20, THashRounds.hrRounds3); end; constructor TTiger_160.CreateRound4; begin - Inherited Create(20, THashRounds.hrRounds4); + inherited Create(20, THashRounds.hrRounds4); end; constructor TTiger_160.CreateRound5; begin - Inherited Create(20, THashRounds.hrRounds5); + inherited Create(20, THashRounds.hrRounds5); end; { TTiger_192 } @@ -1068,23 +1068,23 @@ function TTiger_192.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger_192.CreateRound3; begin - Inherited Create(24, THashRounds.hrRounds3); + inherited Create(24, THashRounds.hrRounds3); end; constructor TTiger_192.CreateRound4; begin - Inherited Create(24, THashRounds.hrRounds4); + inherited Create(24, THashRounds.hrRounds4); end; constructor TTiger_192.CreateRound5; begin - Inherited Create(24, THashRounds.hrRounds5); + inherited Create(24, THashRounds.hrRounds5); end; { TTiger_Base } @@ -1097,13 +1097,13 @@ function TTiger_Base.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger_Base.Create(AHashSize: Int32; ARounds: THashRounds); begin - Inherited Create(AHashSize, ARounds); + inherited Create(AHashSize, ARounds); end; end. diff --git a/HashLib/src/Crypto/HlpTiger2.pas b/HashLib/src/Crypto/HlpTiger2.pas index 2fce99a0..002fa70b 100644 --- a/HashLib/src/Crypto/HlpTiger2.pas +++ b/HashLib/src/Crypto/HlpTiger2.pas @@ -640,7 +640,7 @@ function TTiger2.GetHashRound(AHashRound: Int32): THashRounds; constructor TTiger2.Create(AHashSize: Int32; ARounds: THashRounds); begin - Inherited Create(AHashSize, 64); + inherited Create(AHashSize, 64); System.SetLength(FHash, 3); FRounds := Int32(ARounds); end; @@ -691,77 +691,77 @@ procedure TTiger2.Initialize; FHash[0] := $0123456789ABCDEF; FHash[1] := UInt64($FEDCBA9876543210); FHash[2] := UInt64($F096A5B4C3B2E187); - Inherited Initialize(); + inherited Initialize(); end; procedure TTiger2.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - LA, LB, LC, LTempA: UInt64; + LRegA, LRegB, LRegC, LShuffleTemp: UInt64; LRounds: Int32; LData: array [0 .. 7] of UInt64; begin TConverters.le64_copy(AData, AIndex, @(LData[0]), 0, ADataLength); - LA := FHash[0]; - LB := FHash[1]; - LC := FHash[2]; - - LC := LC xor LData[0]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 5; - - LA := LA xor LData[1]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 5; - - LB := LB xor LData[2]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 5; - - LC := LC xor LData[3]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 5; - - LA := LA xor LData[4]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 5; - - LB := LB xor LData[5]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 5; - - LC := LC xor LData[6]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 5; - - LA := LA xor LData[7]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 5; + LRegA := FHash[0]; + LRegB := FHash[1]; + LRegC := FHash[2]; + + LRegC := LRegC xor LData[0]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 5; + + LRegA := LRegA xor LData[1]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 5; + + LRegB := LRegB xor LData[2]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 5; + + LRegC := LRegC xor LData[3]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 5; + + LRegA := LRegA xor LData[4]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 5; + + LRegB := LRegB xor LData[5]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 5; + + LRegC := LRegC xor LData[6]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 5; + + LRegA := LRegA xor LData[7]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 5; LData[0] := LData[0] - (LData[7] xor C1); LData[1] := LData[1] xor LData[0]; @@ -780,61 +780,61 @@ procedure TTiger2.TransformBlock(AData: PByte; ADataLength: Int32; LData[6] := LData[6] + LData[5]; LData[7] := LData[7] - (LData[6] xor C2); - LB := LB xor LData[0]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 7; - - LC := LC xor LData[1]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 7; - - LA := LA xor LData[2]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 7; - - LB := LB xor LData[3]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 7; - - LC := LC xor LData[4]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 7; - - LA := LA xor LData[5]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 7; - - LB := LB xor LData[6]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 7; - - LC := LC xor LData[7]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 7; + LRegB := LRegB xor LData[0]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 7; + + LRegC := LRegC xor LData[1]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 7; + + LRegA := LRegA xor LData[2]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 7; + + LRegB := LRegB xor LData[3]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 7; + + LRegC := LRegC xor LData[4]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 7; + + LRegA := LRegA xor LData[5]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 7; + + LRegB := LRegB xor LData[6]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 7; + + LRegC := LRegC xor LData[7]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 7; LData[0] := LData[0] - (LData[7] xor C1); LData[1] := LData[1] xor LData[0]; @@ -853,61 +853,61 @@ procedure TTiger2.TransformBlock(AData: PByte; ADataLength: Int32; LData[6] := LData[6] + LData[5]; LData[7] := LData[7] - (LData[6] xor C2); - LA := LA xor LData[0]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[1]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[2]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[3]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[4]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[5]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[6]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[7]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; + LRegA := LRegA xor LData[0]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[1]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[2]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[3]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[4]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[5]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[6]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[7]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; LRounds := 3; while LRounds < FRounds do @@ -929,73 +929,73 @@ procedure TTiger2.TransformBlock(AData: PByte; ADataLength: Int32; LData[6] := LData[6] + LData[5]; LData[7] := LData[7] - (LData[6] xor C2); - LC := LC xor LData[0]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[1]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[2]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[3]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[4]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LB := LB xor LData[5]; - LC := LC - (ST1[Byte(LB)] xor ST2[Byte(LB shr 16)] xor ST3[Byte(LB shr 32) - ] xor ST4[Byte(LB shr 48)]); - LA := LA + (ST4[Byte(LB shr 8)] xor ST3[Byte(LB shr 24) - ] xor ST2[Byte(LB shr 40)] xor ST1[Byte(LB shr 56)]); - LA := LA * 9; - - LC := LC xor LData[6]; - LA := LA - (ST1[Byte(LC)] xor ST2[Byte(LC shr 16)] xor ST3[Byte(LC shr 32) - ] xor ST4[Byte(LC shr 48)]); - LB := LB + (ST4[Byte(LC shr 8) and $FF] xor ST3[Byte(LC shr 24) - ] xor ST2[Byte(LC shr 40)] xor ST1[Byte(LC shr 56)]); - LB := LB * 9; - - LA := LA xor LData[7]; - LB := LB - (ST1[Byte(LA)] xor ST2[Byte(LA shr 16)] xor ST3[Byte(LA shr 32) - ] xor ST4[Byte(LA shr 48)]); - LC := LC + (ST4[Byte(LA shr 8)] xor ST3[Byte(LA shr 24) - ] xor ST2[Byte(LA shr 40)] xor ST1[Byte(LA shr 56)]); - LC := LC * 9; - - LTempA := LA; - LA := LC; - LC := LB; - LB := LTempA; + LRegC := LRegC xor LData[0]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[1]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[2]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[3]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[4]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LRegB := LRegB xor LData[5]; + LRegC := LRegC - (ST1[Byte(LRegB)] xor ST2[Byte(LRegB shr 16)] xor ST3[Byte(LRegB shr 32) + ] xor ST4[Byte(LRegB shr 48)]); + LRegA := LRegA + (ST4[Byte(LRegB shr 8)] xor ST3[Byte(LRegB shr 24) + ] xor ST2[Byte(LRegB shr 40)] xor ST1[Byte(LRegB shr 56)]); + LRegA := LRegA * 9; + + LRegC := LRegC xor LData[6]; + LRegA := LRegA - (ST1[Byte(LRegC)] xor ST2[Byte(LRegC shr 16)] xor ST3[Byte(LRegC shr 32) + ] xor ST4[Byte(LRegC shr 48)]); + LRegB := LRegB + (ST4[Byte(LRegC shr 8) and $FF] xor ST3[Byte(LRegC shr 24) + ] xor ST2[Byte(LRegC shr 40)] xor ST1[Byte(LRegC shr 56)]); + LRegB := LRegB * 9; + + LRegA := LRegA xor LData[7]; + LRegB := LRegB - (ST1[Byte(LRegA)] xor ST2[Byte(LRegA shr 16)] xor ST3[Byte(LRegA shr 32) + ] xor ST4[Byte(LRegA shr 48)]); + LRegC := LRegC + (ST4[Byte(LRegA shr 8)] xor ST3[Byte(LRegA shr 24) + ] xor ST2[Byte(LRegA shr 40)] xor ST1[Byte(LRegA shr 56)]); + LRegC := LRegC * 9; + + LShuffleTemp := LRegA; + LRegA := LRegC; + LRegC := LRegB; + LRegB := LShuffleTemp; System.Inc(LRounds); end; - FHash[0] := FHash[0] xor LA; - FHash[1] := LB - FHash[1]; - FHash[2] := FHash[2] + LC; + FHash[0] := FHash[0] xor LRegA; + FHash[1] := LRegB - FHash[1]; + FHash[2] := FHash[2] + LRegC; System.FillChar(LData, System.SizeOf(LData), UInt64(0)); end; @@ -1010,23 +1010,23 @@ function TTiger2_128.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger2_128.CreateRound3; begin - Inherited Create(16, THashRounds.hrRounds3); + inherited Create(16, THashRounds.hrRounds3); end; constructor TTiger2_128.CreateRound4; begin - Inherited Create(16, THashRounds.hrRounds4); + inherited Create(16, THashRounds.hrRounds4); end; constructor TTiger2_128.CreateRound5; begin - Inherited Create(16, THashRounds.hrRounds5); + inherited Create(16, THashRounds.hrRounds5); end; { TTiger2_160 } @@ -1039,23 +1039,23 @@ function TTiger2_160.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger2_160.CreateRound3; begin - Inherited Create(20, THashRounds.hrRounds3); + inherited Create(20, THashRounds.hrRounds3); end; constructor TTiger2_160.CreateRound4; begin - Inherited Create(20, THashRounds.hrRounds4); + inherited Create(20, THashRounds.hrRounds4); end; constructor TTiger2_160.CreateRound5; begin - Inherited Create(20, THashRounds.hrRounds5); + inherited Create(20, THashRounds.hrRounds5); end; { TTiger2_192 } @@ -1068,23 +1068,23 @@ function TTiger2_192.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger2_192.CreateRound3; begin - Inherited Create(24, THashRounds.hrRounds3); + inherited Create(24, THashRounds.hrRounds3); end; constructor TTiger2_192.CreateRound4; begin - Inherited Create(24, THashRounds.hrRounds4); + inherited Create(24, THashRounds.hrRounds4); end; constructor TTiger2_192.CreateRound5; begin - Inherited Create(24, THashRounds.hrRounds5); + inherited Create(24, THashRounds.hrRounds5); end; { TTiger2_Base } @@ -1097,13 +1097,13 @@ function TTiger2_Base.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TTiger2_Base.Create(AHashSize: Int32; ARounds: THashRounds); begin - Inherited Create(AHashSize, ARounds); + inherited Create(AHashSize, ARounds); end; end. diff --git a/HashLib/src/Crypto/HlpWhirlPool.pas b/HashLib/src/Crypto/HlpWhirlPool.pas index ec857adf..1b128c01 100644 --- a/HashLib/src/Crypto/HlpWhirlPool.pas +++ b/HashLib/src/Crypto/HlpWhirlPool.pas @@ -51,8 +51,8 @@ TWhirlPool = class sealed(TBlockHash, ICryptoNotBuildIn, ITransformBlock) {$ENDREGION} class constructor WhirlPool; - class function PackIntoUInt64(b7, b6, b5, b4, b3, b2, b1, b0: UInt32) - : UInt64; static; inline; + class function PackIntoUInt64(AByte7, AByte6, AByte5, AByte4, AByte3, + AByte2, AByte1, AByte0: UInt32): UInt64; static; inline; class function MaskWithReductionPolynomial(AInput: UInt32): UInt32; static; inline; @@ -81,13 +81,13 @@ function TWhirlPool.Clone(): IHash; LHashInstance.FHash := System.Copy(FHash); LHashInstance.FBuffer := FBuffer.Clone(); LHashInstance.FProcessedBytesCount := FProcessedBytesCount; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TWhirlPool.Create; begin - Inherited Create(64, 64); + inherited Create(64, 64); System.SetLength(FHash, 8); end; @@ -122,15 +122,15 @@ procedure TWhirlPool.Finish; function TWhirlPool.GetResult: THashLibByteArray; begin - System.SetLength(result, System.Length(FHash) * System.SizeOf(UInt64)); - TConverters.be64_copy(PUInt64(FHash), 0, PByte(result), 0, - System.Length(result)); + System.SetLength(Result, System.Length(FHash) * System.SizeOf(UInt64)); + TConverters.be64_copy(PUInt64(FHash), 0, PByte(Result), 0, + System.Length(Result)); end; procedure TWhirlPool.Initialize; begin TArrayUtils.ZeroFill(FHash); - Inherited Initialize(); + inherited Initialize(); end; class function TWhirlPool.MaskWithReductionPolynomial(AInput: UInt32): UInt32; @@ -139,21 +139,22 @@ class function TWhirlPool.MaskWithReductionPolynomial(AInput: UInt32): UInt32; begin AInput := AInput xor REDUCTION_POLYNOMIAL; end; - result := AInput; + Result := AInput; end; -class function TWhirlPool.PackIntoUInt64(b7, b6, b5, b4, b3, b2, b1, - b0: UInt32): UInt64; +class function TWhirlPool.PackIntoUInt64(AByte7, AByte6, AByte5, AByte4, + AByte3, AByte2, AByte1, AByte0: UInt32): UInt64; begin - result := (UInt64(b7) shl 56) xor (UInt64(b6) shl 48) xor (UInt64(b5) shl 40) - xor (UInt64(b4) shl 32) xor (UInt64(b3) shl 24) xor (UInt64(b2) shl 16) - xor (UInt64(b1) shl 8) xor b0; + Result := (UInt64(AByte7) shl 56) xor (UInt64(AByte6) shl 48) + xor (UInt64(AByte5) shl 40) xor (UInt64(AByte4) shl 32) + xor (UInt64(AByte3) shl 24) xor (UInt64(AByte2) shl 16) + xor (UInt64(AByte1) shl 8) xor AByte0; end; procedure TWhirlPool.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32); var - LData, LK, LM, LTemp: array [0 .. 7] of UInt64; + LData, LKeyState, LMixState, LTemp: array [0 .. 7] of UInt64; LIdx, LRound: Int32; begin TConverters.be64_copy(AData, AIndex, @(LData[0]), 0, ADataLength); @@ -161,8 +162,8 @@ procedure TWhirlPool.TransformBlock(AData: PByte; ADataLength: Int32; LIdx := 0; while LIdx < 8 do begin - LK[LIdx] := FHash[LIdx]; - LTemp[LIdx] := LData[LIdx] xor LK[LIdx]; + LKeyState[LIdx] := FHash[LIdx]; + LTemp[LIdx] := LData[LIdx] xor LKeyState[LIdx]; System.Inc(LIdx); end; @@ -174,42 +175,42 @@ procedure TWhirlPool.TransformBlock(AData: PByte; ADataLength: Int32; while LIdx < 8 do begin - LM[LIdx] := 0; - LM[LIdx] := LM[LIdx] xor (FSC0[Byte(LK[(LIdx - 0) and 7] shr 56)]); - LM[LIdx] := LM[LIdx] xor (FSC1[Byte(LK[(LIdx - 1) and 7] shr 48)]); - LM[LIdx] := LM[LIdx] xor (FSC2[Byte(LK[(LIdx - 2) and 7] shr 40)]); - LM[LIdx] := LM[LIdx] xor (FSC3[Byte(LK[(LIdx - 3) and 7] shr 32)]); - LM[LIdx] := LM[LIdx] xor (FSC4[Byte(LK[(LIdx - 4) and 7] shr 24)]); - LM[LIdx] := LM[LIdx] xor (FSC5[Byte(LK[(LIdx - 5) and 7] shr 16)]); - LM[LIdx] := LM[LIdx] xor (FSC6[Byte(LK[(LIdx - 6) and 7] shr 8)]); - LM[LIdx] := LM[LIdx] xor (FSC7[Byte(LK[(LIdx - 7) and 7])]); + LMixState[LIdx] := 0; + LMixState[LIdx] := LMixState[LIdx] xor (FSC0[Byte(LKeyState[(LIdx - 0) and 7] shr 56)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC1[Byte(LKeyState[(LIdx - 1) and 7] shr 48)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC2[Byte(LKeyState[(LIdx - 2) and 7] shr 40)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC3[Byte(LKeyState[(LIdx - 3) and 7] shr 32)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC4[Byte(LKeyState[(LIdx - 4) and 7] shr 24)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC5[Byte(LKeyState[(LIdx - 5) and 7] shr 16)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC6[Byte(LKeyState[(LIdx - 6) and 7] shr 8)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC7[Byte(LKeyState[(LIdx - 7) and 7])]); System.Inc(LIdx); end; - System.Move(LM[0], LK[0], 8 * System.SizeOf(UInt64)); + System.Move(LMixState[0], LKeyState[0], 8 * System.SizeOf(UInt64)); - LK[0] := LK[0] xor FSRC[LRound]; + LKeyState[0] := LKeyState[0] xor FSRC[LRound]; LIdx := 0; while LIdx < 8 do begin - LM[LIdx] := LK[LIdx]; + LMixState[LIdx] := LKeyState[LIdx]; - LM[LIdx] := LM[LIdx] xor (FSC0[Byte(LTemp[(LIdx - 0) and 7] shr 56)]); - LM[LIdx] := LM[LIdx] xor (FSC1[Byte(LTemp[(LIdx - 1) and 7] shr 48)]); - LM[LIdx] := LM[LIdx] xor (FSC2[Byte(LTemp[(LIdx - 2) and 7] shr 40)]); - LM[LIdx] := LM[LIdx] xor (FSC3[Byte(LTemp[(LIdx - 3) and 7] shr 32)]); - LM[LIdx] := LM[LIdx] xor (FSC4[Byte(LTemp[(LIdx - 4) and 7] shr 24)]); - LM[LIdx] := LM[LIdx] xor (FSC5[Byte(LTemp[(LIdx - 5) and 7] shr 16)]); - LM[LIdx] := LM[LIdx] xor (FSC6[Byte(LTemp[(LIdx - 6) and 7] shr 8)]); - LM[LIdx] := LM[LIdx] xor (FSC7[Byte(LTemp[(LIdx - 7) and 7])]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC0[Byte(LTemp[(LIdx - 0) and 7] shr 56)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC1[Byte(LTemp[(LIdx - 1) and 7] shr 48)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC2[Byte(LTemp[(LIdx - 2) and 7] shr 40)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC3[Byte(LTemp[(LIdx - 3) and 7] shr 32)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC4[Byte(LTemp[(LIdx - 4) and 7] shr 24)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC5[Byte(LTemp[(LIdx - 5) and 7] shr 16)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC6[Byte(LTemp[(LIdx - 6) and 7] shr 8)]); + LMixState[LIdx] := LMixState[LIdx] xor (FSC7[Byte(LTemp[(LIdx - 7) and 7])]); System.Inc(LIdx); end; - System.Move(LM[0], LTemp[0], System.Length(LTemp) * System.SizeOf(UInt64)); + System.Move(LMixState[0], LTemp[0], System.Length(LTemp) * System.SizeOf(UInt64)); System.Inc(LRound); end; @@ -228,8 +229,8 @@ procedure TWhirlPool.TransformBlock(AData: PByte; ADataLength: Int32; class constructor TWhirlPool.WhirlPool; var - LIdx, LR: Int32; - v1, v2, v4, v5, v8, v9: UInt32; + LIdx, LRound: Int32; + LVal1, LVal2, LVal4, LVal5, LVal8, LVal9: UInt32; begin System.SetLength(FSC0, 256); System.SetLength(FSC1, 256); @@ -245,33 +246,41 @@ procedure TWhirlPool.TransformBlock(AData: PByte; ADataLength: Int32; LIdx := 0; while LIdx < 256 do begin - v1 := SSBOX[LIdx]; - v2 := MaskWithReductionPolynomial(v1 shl 1); - v4 := MaskWithReductionPolynomial(v2 shl 1); - v5 := v4 xor v1; - v8 := MaskWithReductionPolynomial(v4 shl 1); - v9 := v8 xor v1; - - FSC0[LIdx] := PackIntoUInt64(v1, v1, v4, v1, v8, v5, v2, v9); - FSC1[LIdx] := PackIntoUInt64(v9, v1, v1, v4, v1, v8, v5, v2); - FSC2[LIdx] := PackIntoUInt64(v2, v9, v1, v1, v4, v1, v8, v5); - FSC3[LIdx] := PackIntoUInt64(v5, v2, v9, v1, v1, v4, v1, v8); - FSC4[LIdx] := PackIntoUInt64(v8, v5, v2, v9, v1, v1, v4, v1); - FSC5[LIdx] := PackIntoUInt64(v1, v8, v5, v2, v9, v1, v1, v4); - FSC6[LIdx] := PackIntoUInt64(v4, v1, v8, v5, v2, v9, v1, v1); - FSC7[LIdx] := PackIntoUInt64(v1, v4, v1, v8, v5, v2, v9, v1); + LVal1 := SSBOX[LIdx]; + LVal2 := MaskWithReductionPolynomial(LVal1 shl 1); + LVal4 := MaskWithReductionPolynomial(LVal2 shl 1); + LVal5 := LVal4 xor LVal1; + LVal8 := MaskWithReductionPolynomial(LVal4 shl 1); + LVal9 := LVal8 xor LVal1; + + FSC0[LIdx] := PackIntoUInt64(LVal1, LVal1, LVal4, LVal1, LVal8, LVal5, + LVal2, LVal9); + FSC1[LIdx] := PackIntoUInt64(LVal9, LVal1, LVal1, LVal4, LVal1, LVal8, + LVal5, LVal2); + FSC2[LIdx] := PackIntoUInt64(LVal2, LVal9, LVal1, LVal1, LVal4, LVal1, + LVal8, LVal5); + FSC3[LIdx] := PackIntoUInt64(LVal5, LVal2, LVal9, LVal1, LVal1, LVal4, + LVal1, LVal8); + FSC4[LIdx] := PackIntoUInt64(LVal8, LVal5, LVal2, LVal9, LVal1, LVal1, + LVal4, LVal1); + FSC5[LIdx] := PackIntoUInt64(LVal1, LVal8, LVal5, LVal2, LVal9, LVal1, + LVal1, LVal4); + FSC6[LIdx] := PackIntoUInt64(LVal4, LVal1, LVal8, LVal5, LVal2, LVal9, + LVal1, LVal1); + FSC7[LIdx] := PackIntoUInt64(LVal1, LVal4, LVal1, LVal8, LVal5, LVal2, + LVal9, LVal1); System.Inc(LIdx); end; FSRC[0] := 0; - LR := 1; + LRound := 1; - while LR <= ROUNDS do + while LRound <= ROUNDS do begin - LIdx := 8 * (LR - 1); - FSRC[LR] := (FSC0[LIdx] and $FF00000000000000) + LIdx := 8 * (LRound - 1); + FSRC[LRound] := (FSC0[LIdx] and $FF00000000000000) xor (FSC1[LIdx + 1] and $00FF000000000000) xor (FSC2[LIdx + 2] and $0000FF0000000000) xor (FSC3[LIdx + 3] and $000000FF00000000) @@ -280,7 +289,7 @@ procedure TWhirlPool.TransformBlock(AData: PByte; ADataLength: Int32; xor (FSC6[LIdx + 6] and $000000000000FF00) xor (FSC7[LIdx + 7] and $00000000000000FF); - System.Inc(LR); + System.Inc(LRound); end; end; diff --git a/HashLib/src/Hash128/HlpMurmurHash3_x64_128.pas b/HashLib/src/Hash128/HlpMurmurHash3_x64_128.pas index a71e434b..9689d950 100644 --- a/HashLib/src/Hash128/HlpMurmurHash3_x64_128.pas +++ b/HashLib/src/Hash128/HlpMurmurHash3_x64_128.pas @@ -114,13 +114,13 @@ function TMurmurHash3_x64_128.Clone(): IHash; LHashInstance.FKey := FKey; LHashInstance.FIdx := FIdx; LHashInstance.FBuffer := System.Copy(FBuffer); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TMurmurHash3_x64_128.Create; begin - Inherited Create(16, 16); + inherited Create(16, 16); FKey := CKEY; System.SetLength(FBuffer, 16); end; @@ -362,12 +362,12 @@ procedure TMurmurHash3_x64_128.Finish; function TMurmurHash3_x64_128.GetKey: THashLibByteArray; begin - result := TConverters.ReadUInt32AsBytesLE(FKey); + Result := TConverters.ReadUInt32AsBytesLE(FKey); end; function TMurmurHash3_x64_128.GetKeyLength: Int32; begin - result := 4; + Result := 4; end; procedure TMurmurHash3_x64_128.Initialize; @@ -381,7 +381,7 @@ procedure TMurmurHash3_x64_128.Initialize; procedure TMurmurHash3_x64_128.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin FKey := CKEY; end @@ -497,7 +497,7 @@ function TMurmurHash3_x64_128.TransformFinal: IHashResult; TConverters.ReadUInt64AsBytesBE(FH1, LBufferBytes, 0); TConverters.ReadUInt64AsBytesBE(FH2, LBufferBytes, 8); - result := THashResult.Create(LBufferBytes); + Result := THashResult.Create(LBufferBytes); Initialize(); end; diff --git a/HashLib/src/Hash128/HlpMurmurHash3_x86_128.pas b/HashLib/src/Hash128/HlpMurmurHash3_x86_128.pas index d4749bf1..236f2ed1 100644 --- a/HashLib/src/Hash128/HlpMurmurHash3_x86_128.pas +++ b/HashLib/src/Hash128/HlpMurmurHash3_x86_128.pas @@ -145,13 +145,13 @@ function TMurmurHash3_x86_128.Clone(): IHash; LHashInstance.FTotalLength := FTotalLength; LHashInstance.FIdx := FIdx; LHashInstance.FBuffer := System.Copy(FBuffer); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TMurmurHash3_x86_128.Create; begin - Inherited Create(16, 16); + inherited Create(16, 16); FKey := CKEY; System.SetLength(FBuffer, 16); end; @@ -421,12 +421,12 @@ procedure TMurmurHash3_x86_128.Finish; function TMurmurHash3_x86_128.GetKey: THashLibByteArray; begin - result := TConverters.ReadUInt32AsBytesLE(FKey); + Result := TConverters.ReadUInt32AsBytesLE(FKey); end; function TMurmurHash3_x86_128.GetKeyLength: Int32; begin - result := 4; + Result := 4; end; procedure TMurmurHash3_x86_128.Initialize; @@ -442,7 +442,7 @@ procedure TMurmurHash3_x86_128.Initialize; procedure TMurmurHash3_x86_128.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin FKey := CKEY; end @@ -591,7 +591,7 @@ function TMurmurHash3_x86_128.TransformFinal: IHashResult; TConverters.ReadUInt32AsBytesBE(FH3, LBufferBytes, 8); TConverters.ReadUInt32AsBytesBE(FH4, LBufferBytes, 12); - result := THashResult.Create(LBufferBytes); + Result := THashResult.Create(LBufferBytes); Initialize(); end; diff --git a/HashLib/src/Hash128/HlpSipHash128.pas b/HashLib/src/Hash128/HlpSipHash128.pas index 9febd12e..793ec694 100644 --- a/HashLib/src/Hash128/HlpSipHash128.pas +++ b/HashLib/src/Hash128/HlpSipHash128.pas @@ -52,14 +52,14 @@ function TSipHash128_2_4.Clone: IHash; LHashInstance.FFinalizationRounds := FFinalizationRounds; LHashInstance.FIdx := FIdx; LHashInstance.FBuffer := System.Copy(FBuffer); - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TSipHash128_2_4.Create(ACompressionRounds, AFinalizationRounds: Int32); begin - Inherited Create(16, 8); + inherited Create(16, 8); FCompressionRounds := ACompressionRounds; FFinalizationRounds := AFinalizationRounds; end; diff --git a/HashLib/src/Hash32/HlpAP.pas b/HashLib/src/Hash32/HlpAP.pas index 7cb24e89..7284e3fd 100644 --- a/HashLib/src/Hash32/HlpAP.pas +++ b/HashLib/src/Hash32/HlpAP.pas @@ -40,13 +40,13 @@ function TAP.Clone(): IHash; LHashInstance := TAP.Create(); LHashInstance.FHash := FHash; LHashInstance.FIndex := FIndex; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TAP.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TAP.Initialize; @@ -87,7 +87,7 @@ procedure TAP.TransformBytes(const AData: THashLibByteArray; function TAP.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpBKDR.pas b/HashLib/src/Hash32/HlpBKDR.pas index b427d2aa..5017452b 100644 --- a/HashLib/src/Hash32/HlpBKDR.pas +++ b/HashLib/src/Hash32/HlpBKDR.pas @@ -20,7 +20,7 @@ TBKDR = class sealed(THash, IHash32, ITransformBlock) FHash: UInt32; const - SEED = Int32(131); + Seed = Int32(131); public constructor Create(); @@ -41,13 +41,13 @@ function TBKDR.Clone(): IHash; begin LHashInstance := TBKDR.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TBKDR.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TBKDR.Initialize; @@ -68,7 +68,7 @@ procedure TBKDR.TransformBytes(const AData: THashLibByteArray; LIdx := AIndex; while ALength > 0 do begin - FHash := (FHash * UInt32(SEED)) + AData[LIdx]; + FHash := (FHash * UInt32(Seed)) + AData[LIdx]; System.Inc(LIdx); System.Dec(ALength); end; @@ -76,7 +76,7 @@ procedure TBKDR.TransformBytes(const AData: THashLibByteArray; function TBKDR.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpBernstein.pas b/HashLib/src/Hash32/HlpBernstein.pas index 739e5e2f..541e4a94 100644 --- a/HashLib/src/Hash32/HlpBernstein.pas +++ b/HashLib/src/Hash32/HlpBernstein.pas @@ -37,13 +37,13 @@ function TBernstein.Clone(): IHash; begin LHashInstance := TBernstein.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TBernstein.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TBernstein.Initialize; @@ -72,7 +72,7 @@ procedure TBernstein.TransformBytes(const AData: THashLibByteArray; function TBernstein.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpBernstein1.pas b/HashLib/src/Hash32/HlpBernstein1.pas index 60083f9e..d94d0c43 100644 --- a/HashLib/src/Hash32/HlpBernstein1.pas +++ b/HashLib/src/Hash32/HlpBernstein1.pas @@ -37,13 +37,13 @@ function TBernstein1.Clone(): IHash; begin LHashInstance := TBernstein1.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TBernstein1.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TBernstein1.Initialize; @@ -72,7 +72,7 @@ procedure TBernstein1.TransformBytes(const AData: THashLibByteArray; function TBernstein1.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpDEK.pas b/HashLib/src/Hash32/HlpDEK.pas index 6b7d4c26..969fc01e 100644 --- a/HashLib/src/Hash32/HlpDEK.pas +++ b/HashLib/src/Hash32/HlpDEK.pas @@ -32,7 +32,7 @@ implementation constructor TDEK.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; function TDEK.Clone(): IHash; @@ -42,8 +42,8 @@ function TDEK.Clone(): IHash; LHashInstance := TDEK.Create(); FBuffer.Position := 0; LHashInstance.FBuffer.CopyFrom(FBuffer, FBuffer.Size); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; function TDEK.ComputeAggregatedBytes(const AData: THashLibByteArray) @@ -57,7 +57,7 @@ function TDEK.ComputeAggregatedBytes(const AData: THashLibByteArray) begin LHash := TBits.RotateLeft32(LHash, 5) xor AData[LIdx]; end; - result := THashResult.Create(LHash); + Result := THashResult.Create(LHash); end; end. diff --git a/HashLib/src/Hash32/HlpDJB.pas b/HashLib/src/Hash32/HlpDJB.pas index c365ae8a..1d2ab530 100644 --- a/HashLib/src/Hash32/HlpDJB.pas +++ b/HashLib/src/Hash32/HlpDJB.pas @@ -37,13 +37,13 @@ function TDJB.Clone(): IHash; begin LHashInstance := TDJB.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TDJB.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TDJB.Initialize; @@ -72,7 +72,7 @@ procedure TDJB.TransformBytes(const AData: THashLibByteArray; function TDJB.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpELF.pas b/HashLib/src/Hash32/HlpELF.pas index a0b84bf1..256d3abc 100644 --- a/HashLib/src/Hash32/HlpELF.pas +++ b/HashLib/src/Hash32/HlpELF.pas @@ -37,13 +37,13 @@ function TELF.Clone(): IHash; begin LHashInstance := TELF.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TELF.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TELF.Initialize; @@ -55,7 +55,7 @@ procedure TELF.TransformBytes(const AData: THashLibByteArray; AIndex, ALength: Int32); var LIdx: Int32; - LG: UInt32; + LHighNibble: UInt32; begin {$IFDEF DEBUG} System.Assert(AIndex >= 0); @@ -66,14 +66,14 @@ procedure TELF.TransformBytes(const AData: THashLibByteArray; while ALength > 0 do begin FHash := (FHash shl 4) + AData[LIdx]; - LG := FHash and $F0000000; + LHighNibble := FHash and $F0000000; - if (LG <> 0) then + if (LHighNibble <> 0) then begin - FHash := FHash xor (LG shr 24); + FHash := FHash xor (LHighNibble shr 24); end; - FHash := FHash and (not LG); + FHash := FHash and (not LHighNibble); System.Inc(LIdx); System.Dec(ALength); end; @@ -81,7 +81,7 @@ procedure TELF.TransformBytes(const AData: THashLibByteArray; function TELF.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpFNV.pas b/HashLib/src/Hash32/HlpFNV.pas index d3caf8bd..0e8b06bb 100644 --- a/HashLib/src/Hash32/HlpFNV.pas +++ b/HashLib/src/Hash32/HlpFNV.pas @@ -37,13 +37,13 @@ function TFNV.Clone(): IHash; begin LHashInstance := TFNV.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TFNV.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TFNV.Initialize; @@ -72,7 +72,7 @@ procedure TFNV.TransformBytes(const AData: THashLibByteArray; function TFNV.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpFNV1a.pas b/HashLib/src/Hash32/HlpFNV1a.pas index 4e258590..fb5d48ea 100644 --- a/HashLib/src/Hash32/HlpFNV1a.pas +++ b/HashLib/src/Hash32/HlpFNV1a.pas @@ -37,13 +37,13 @@ function TFNV1a.Clone(): IHash; begin LHashInstance := TFNV1a.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TFNV1a.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TFNV1a.Initialize; @@ -72,7 +72,7 @@ procedure TFNV1a.TransformBytes(const AData: THashLibByteArray; function TFNV1a.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpJS.pas b/HashLib/src/Hash32/HlpJS.pas index 8cc0bde6..17aef20d 100644 --- a/HashLib/src/Hash32/HlpJS.pas +++ b/HashLib/src/Hash32/HlpJS.pas @@ -37,13 +37,13 @@ function TJS.Clone(): IHash; begin LHashInstance := TJS.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TJS.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TJS.Initialize; @@ -72,7 +72,7 @@ procedure TJS.TransformBytes(const AData: THashLibByteArray; function TJS.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpJenkins3.pas b/HashLib/src/Hash32/HlpJenkins3.pas index 56e7d54d..0f750c7d 100644 --- a/HashLib/src/Hash32/HlpJenkins3.pas +++ b/HashLib/src/Hash32/HlpJenkins3.pas @@ -35,7 +35,7 @@ implementation constructor TJenkins3.Create(AInitialValue: Int32); begin - Inherited Create(4, 12); + inherited Create(4, 12); FInitialValue := AInitialValue; end; @@ -47,80 +47,80 @@ function TJenkins3.Clone(): IHash; FBuffer.Position := 0; LHashInstance.FInitialValue := FInitialValue; LHashInstance.FBuffer.CopyFrom(FBuffer, FBuffer.Size); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; function TJenkins3.ComputeAggregatedBytes(const AData: THashLibByteArray) : IHashResult; var - LLength, LCurrentIndex, I1, I2, I3, I4: Int32; - LA, LB, LC: UInt32; + LLength, LCurrentIndex, LI1, LI2, LI3, LI4: Int32; + LRegA, LRegB, LRegC: UInt32; begin LLength := System.length(AData); - LA := UInt32($DEADBEEF) + UInt32(LLength) + UInt32(FInitialValue); - LB := LA; - LC := LB; + LRegA := UInt32($DEADBEEF) + UInt32(LLength) + UInt32(FInitialValue); + LRegB := LRegA; + LRegC := LRegB; if (LLength = 0) then begin - result := THashResult.Create(LC); + Result := THashResult.Create(LRegC); Exit; end; LCurrentIndex := 0; while (LLength > 12) do begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LB := LB + UInt32(I1 or I2 or I3 or I4); + LRegB := LRegB + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LC := LC + UInt32(I1 or I2 or I3 or I4); - - LA := LA - LC; - LA := LA xor TBits.RotateLeft32(LC, 4); - LC := LC + LB; - LB := LB - LA; - LB := LB xor TBits.RotateLeft32(LA, 6); - LA := LA + LC; - LC := LC - LB; - LC := LC xor TBits.RotateLeft32(LB, 8); - LB := LB + LA; - LA := LA - LC; - LA := LA xor TBits.RotateLeft32(LC, 16); - LC := LC + LB; - LB := LB - LA; - LB := LB xor TBits.RotateLeft32(LA, 19); - LA := LA + LC; - LC := LC - LB; - LC := LC xor TBits.RotateLeft32(LB, 4); - LB := LB + LA; + LRegC := LRegC + UInt32(LI1 or LI2 or LI3 or LI4); + + LRegA := LRegA - LRegC; + LRegA := LRegA xor TBits.RotateLeft32(LRegC, 4); + LRegC := LRegC + LRegB; + LRegB := LRegB - LRegA; + LRegB := LRegB xor TBits.RotateLeft32(LRegA, 6); + LRegA := LRegA + LRegC; + LRegC := LRegC - LRegB; + LRegC := LRegC xor TBits.RotateLeft32(LRegB, 8); + LRegB := LRegB + LRegA; + LRegA := LRegA - LRegC; + LRegA := LRegA xor TBits.RotateLeft32(LRegC, 16); + LRegC := LRegC + LRegB; + LRegB := LRegB - LRegA; + LRegB := LRegB xor TBits.RotateLeft32(LRegA, 19); + LRegA := LRegA + LRegC; + LRegC := LRegC - LRegB; + LRegC := LRegC xor TBits.RotateLeft32(LRegB, 4); + LRegB := LRegB + LRegA; System.Dec(LLength, 12); end; @@ -128,273 +128,273 @@ function TJenkins3.ComputeAggregatedBytes(const AData: THashLibByteArray) case LLength of 12: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LB := LB + UInt32(I1 or I2 or I3 or I4); + LRegB := LRegB + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; - LC := LC + UInt32(I1 or I2 or I3 or I4); + LRegC := LRegC + UInt32(LI1 or LI2 or LI3 or LI4); end; 11: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LB := LB + UInt32(I1 or I2 or I3 or I4); + LRegB := LRegB + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; - LC := LC + UInt32(I1 or I2 or I3); + LRegC := LRegC + UInt32(LI1 or LI2 or LI3); end; 10: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LB := LB + UInt32(I1 or I2 or I3 or I4); + LRegB := LRegB + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; - LC := LC + UInt32(I1 or I2); + LRegC := LRegC + UInt32(LI1 or LI2); end; 9: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LB := LB + UInt32(I1 or I2 or I3 or I4); + LRegB := LRegB + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; - LC := LC + UInt32(I1); + LRegC := LRegC + UInt32(LI1); end; 8: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; - LB := LB + UInt32(I1 or I2 or I3 or I4); + LRegB := LRegB + UInt32(LI1 or LI2 or LI3 or LI4); end; 7: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; - LB := LB + UInt32(I1 or I2 or I3); + LRegB := LRegB + UInt32(LI1 or LI2 or LI3); end; 6: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; - LB := LB + UInt32(I1 or I2); + LRegB := LRegB + UInt32(LI1 or LI2); end; 5: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; System.Inc(LCurrentIndex); - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; - LB := LB + UInt32(I1); + LRegB := LRegB + UInt32(LI1); end; 4: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; System.Inc(LCurrentIndex); - I4 := AData[LCurrentIndex] shl 24; + LI4 := AData[LCurrentIndex] shl 24; - LA := LA + UInt32(I1 or I2 or I3 or I4); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3 or LI4); end; 3: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - I3 := AData[LCurrentIndex] shl 16; + LI3 := AData[LCurrentIndex] shl 16; - LA := LA + UInt32(I1 or I2 or I3); + LRegA := LRegA + UInt32(LI1 or LI2 or LI3); end; 2: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; - LA := LA + UInt32(I1 or I2); + LRegA := LRegA + UInt32(LI1 or LI2); end; 1: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; - LA := LA + UInt32(I1); + LRegA := LRegA + UInt32(LI1); end; end; - LC := LC xor LB; - LC := LC - TBits.RotateLeft32(LB, 14); - LA := LA xor LC; - LA := LA - TBits.RotateLeft32(LC, 11); - LB := LB xor LA; - LB := LB - TBits.RotateLeft32(LA, 25); - LC := LC xor LB; - LC := LC - TBits.RotateLeft32(LB, 16); - LA := LA xor LC; - LA := LA - TBits.RotateLeft32(LC, 4); - LB := LB xor LA; - LB := LB - TBits.RotateLeft32(LA, 14); - LC := LC xor LB; - LC := LC - TBits.RotateLeft32(LB, 24); - - result := THashResult.Create(LC); + LRegC := LRegC xor LRegB; + LRegC := LRegC - TBits.RotateLeft32(LRegB, 14); + LRegA := LRegA xor LRegC; + LRegA := LRegA - TBits.RotateLeft32(LRegC, 11); + LRegB := LRegB xor LRegA; + LRegB := LRegB - TBits.RotateLeft32(LRegA, 25); + LRegC := LRegC xor LRegB; + LRegC := LRegC - TBits.RotateLeft32(LRegB, 16); + LRegA := LRegA xor LRegC; + LRegA := LRegA - TBits.RotateLeft32(LRegC, 4); + LRegB := LRegB xor LRegA; + LRegB := LRegB - TBits.RotateLeft32(LRegA, 14); + LRegC := LRegC xor LRegB; + LRegC := LRegC - TBits.RotateLeft32(LRegB, 24); + + Result := THashResult.Create(LRegC); end; end. diff --git a/HashLib/src/Hash32/HlpMurmur2.pas b/HashLib/src/Hash32/HlpMurmur2.pas index 1cb0ae9e..85a4deef 100644 --- a/HashLib/src/Hash32/HlpMurmur2.pas +++ b/HashLib/src/Hash32/HlpMurmur2.pas @@ -27,8 +27,8 @@ TMurmur2 = class sealed(TMultipleTransformNonBlock, IHash32, IHashWithKey, const CKEY = UInt32($0); - M = UInt32($5BD1E995); - R = Int32(24); + CMul = UInt32($5BD1E995); + CShift = Int32(24); function GetKeyLength(): Int32; function GetKey: THashLibByteArray; inline; @@ -53,18 +53,18 @@ implementation constructor TMurmur2.Create; begin - Inherited Create(4, 4); + inherited Create(4, 4); FKey := CKEY; end; function TMurmur2.GetKey: THashLibByteArray; begin - result := TConverters.ReadUInt32AsBytesLE(FKey); + Result := TConverters.ReadUInt32AsBytesLE(FKey); end; procedure TMurmur2.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin FKey := CKEY; end @@ -81,7 +81,7 @@ procedure TMurmur2.SetKey(const AValue: THashLibByteArray); function TMurmur2.GetKeyLength: Int32; begin - result := 4; + Result := 4; end; procedure TMurmur2.Initialize; @@ -99,15 +99,15 @@ function TMurmur2.Clone(): IHash; LHashInstance.FWorkingKey := FWorkingKey; FBuffer.Position := 0; LHashInstance.FBuffer.CopyFrom(FBuffer, FBuffer.Size); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; function TMurmur2.ComputeAggregatedBytes(const AData: THashLibByteArray) : IHashResult; var LLength, LCurrentIndex, LNBlocks, LIdx: Int32; - LBlock, LH: UInt32; + LBlock, LHashAcc: UInt32; LPtrData: PByte; LPtrDataCardinal: PCardinal; begin @@ -116,11 +116,11 @@ function TMurmur2.ComputeAggregatedBytes(const AData: THashLibByteArray) if (LLength = 0) then begin - result := THashResult.Create(Int32(0)); + Result := THashResult.Create(Int32(0)); Exit; end; - LH := FWorkingKey xor UInt32(LLength); + LHashAcc := FWorkingKey xor UInt32(LLength); LCurrentIndex := 0; LIdx := 0; @@ -131,12 +131,12 @@ function TMurmur2.ComputeAggregatedBytes(const AData: THashLibByteArray) begin LBlock := TConverters.ReadPCardinalAsUInt32LE(LPtrDataCardinal + LIdx); - LBlock := LBlock * M; - LBlock := LBlock xor (LBlock shr R); - LBlock := LBlock * M; + LBlock := LBlock * CMul; + LBlock := LBlock xor (LBlock shr CShift); + LBlock := LBlock * CMul; - LH := LH * M; - LH := LH xor LBlock; + LHashAcc := LHashAcc * CMul; + LHashAcc := LHashAcc xor LBlock; System.Inc(LIdx); System.Inc(LCurrentIndex, 4); @@ -146,38 +146,38 @@ function TMurmur2.ComputeAggregatedBytes(const AData: THashLibByteArray) case LLength of 3: begin - LH := LH xor (AData[LCurrentIndex + 2] shl 16); + LHashAcc := LHashAcc xor (AData[LCurrentIndex + 2] shl 16); - LH := LH xor (AData[LCurrentIndex + 1] shl 8); + LHashAcc := LHashAcc xor (AData[LCurrentIndex + 1] shl 8); - LH := LH xor (AData[LCurrentIndex]); + LHashAcc := LHashAcc xor (AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc * CMul; end; 2: begin - LH := LH xor (AData[LCurrentIndex + 1] shl 8); + LHashAcc := LHashAcc xor (AData[LCurrentIndex + 1] shl 8); - LH := LH xor (AData[LCurrentIndex]); + LHashAcc := LHashAcc xor (AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc * CMul; end; 1: begin - LH := LH xor (AData[LCurrentIndex]); + LHashAcc := LHashAcc xor (AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc * CMul; end; end; - LH := LH xor (LH shr 13); + LHashAcc := LHashAcc xor (LHashAcc shr 13); - LH := LH * M; - LH := LH xor (LH shr 15); + LHashAcc := LHashAcc * CMul; + LHashAcc := LHashAcc xor (LHashAcc shr 15); - result := THashResult.Create(Int32(LH)); + Result := THashResult.Create(Int32(LHashAcc)); end; end. diff --git a/HashLib/src/Hash32/HlpMurmurHash3_x86_32.pas b/HashLib/src/Hash32/HlpMurmurHash3_x86_32.pas index 2c4f4115..0413c9c9 100644 --- a/HashLib/src/Hash32/HlpMurmurHash3_x86_32.pas +++ b/HashLib/src/Hash32/HlpMurmurHash3_x86_32.pas @@ -24,7 +24,7 @@ TMurmurHash3_x86_32 = class sealed(THash, IHash32, IHashWithKey, strict private var - FKey, FH, FTotalLength: UInt32; + FKey, FHashValue, FTotalLength: UInt32; FIdx: Int32; FBuffer: THashLibByteArray; @@ -66,17 +66,17 @@ function TMurmurHash3_x86_32.Clone(): IHash; begin LHashInstance := TMurmurHash3_x86_32.Create(); LHashInstance.FKey := FKey; - LHashInstance.FH := FH; + LHashInstance.FHashValue := FHashValue; LHashInstance.FTotalLength := FTotalLength; LHashInstance.FIdx := FIdx; LHashInstance.FBuffer := System.Copy(FBuffer); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TMurmurHash3_x86_32.Create; begin - Inherited Create(4, 4); + inherited Create(4, 4); FKey := CKEY; System.SetLength(FBuffer, 4); end; @@ -102,7 +102,7 @@ procedure TMurmurHash3_x86_32.Finish; LFinalBlock := LFinalBlock * C1; LFinalBlock := TBits.RotateLeft32(LFinalBlock, 15); LFinalBlock := LFinalBlock * C2; - FH := FH xor LFinalBlock; + FHashValue := FHashValue xor LFinalBlock; end; 2: @@ -113,7 +113,7 @@ procedure TMurmurHash3_x86_32.Finish; LFinalBlock := LFinalBlock * C1; LFinalBlock := TBits.RotateLeft32(LFinalBlock, 15); LFinalBlock := LFinalBlock * C2; - FH := FH xor LFinalBlock; + FHashValue := FHashValue xor LFinalBlock; end; 1: @@ -123,7 +123,7 @@ procedure TMurmurHash3_x86_32.Finish; LFinalBlock := LFinalBlock * C1; LFinalBlock := TBits.RotateLeft32(LFinalBlock, 15); LFinalBlock := LFinalBlock * C2; - FH := FH xor LFinalBlock; + FHashValue := FHashValue xor LFinalBlock; end; end; @@ -131,13 +131,13 @@ procedure TMurmurHash3_x86_32.Finish; // finalization - FH := FH xor FTotalLength; + FHashValue := FHashValue xor FTotalLength; - FH := FH xor (FH shr 16); - FH := FH * C4; - FH := FH xor (FH shr 13); - FH := FH * C5; - FH := FH xor (FH shr 16); + FHashValue := FHashValue xor (FHashValue shr 16); + FHashValue := FHashValue * C4; + FHashValue := FHashValue xor (FHashValue shr 13); + FHashValue := FHashValue * C5; + FHashValue := FHashValue xor (FHashValue shr 16); end; procedure TMurmurHash3_x86_32.ByteUpdate(AByte: Byte); @@ -156,9 +156,9 @@ procedure TMurmurHash3_x86_32.ByteUpdate(AByte: Byte); LBlock := TBits.RotateLeft32(LBlock, 15); LBlock := LBlock * C2; - FH := FH xor LBlock; - FH := TBits.RotateLeft32(FH, 13); - FH := (FH * 5) + C3; + FHashValue := FHashValue xor LBlock; + FHashValue := TBits.RotateLeft32(FHashValue, 13); + FHashValue := (FHashValue * 5) + C3; FIdx := 0; end; @@ -166,12 +166,12 @@ procedure TMurmurHash3_x86_32.ByteUpdate(AByte: Byte); function TMurmurHash3_x86_32.GetKey: THashLibByteArray; begin - result := TConverters.ReadUInt32AsBytesLE(FKey); + Result := TConverters.ReadUInt32AsBytesLE(FKey); end; procedure TMurmurHash3_x86_32.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin FKey := CKEY; end @@ -188,12 +188,12 @@ procedure TMurmurHash3_x86_32.SetKey(const AValue: THashLibByteArray); function TMurmurHash3_x86_32.GetKeyLength: Int32; begin - result := 4; + Result := 4; end; procedure TMurmurHash3_x86_32.Initialize; begin - FH := FKey; + FHashValue := FKey; FTotalLength := 0; FIdx := 0; end; @@ -202,7 +202,7 @@ procedure TMurmurHash3_x86_32.TransformBytes(const AData: THashLibByteArray; AIndex, ALength: Int32); var LLength, LNBlocks, LIdx, LOffset: Int32; - LBlock, LH: UInt32; + LBlock, LHashAcc: UInt32; LPtrData, LPtrBuffer: PByte; LPtrDataCardinal: PCardinal; begin @@ -250,9 +250,9 @@ procedure TMurmurHash3_x86_32.TransformBytes(const AData: THashLibByteArray; LBlock := TBits.RotateLeft32(LBlock, 15); LBlock := LBlock * C2; - FH := FH xor LBlock; - FH := TBits.RotateLeft32(FH, 13); - FH := (FH * 5) + C3; + FHashValue := FHashValue xor LBlock; + FHashValue := TBits.RotateLeft32(FHashValue, 13); + FHashValue := (FHashValue * 5) + C3; FIdx := 0; end; @@ -266,7 +266,7 @@ procedure TMurmurHash3_x86_32.TransformBytes(const AData: THashLibByteArray; // body - LH := FH; + LHashAcc := FHashValue; LPtrDataCardinal := PCardinal(LPtrData + AIndex); while LIdx < LNBlocks do begin @@ -276,14 +276,14 @@ procedure TMurmurHash3_x86_32.TransformBytes(const AData: THashLibByteArray; LBlock := TBits.RotateLeft32(LBlock, 15); LBlock := LBlock * C2; - LH := LH xor LBlock; - LH := TBits.RotateLeft32(LH, 13); - LH := (LH * 5) + C3; + LHashAcc := LHashAcc xor LBlock; + LHashAcc := TBits.RotateLeft32(LHashAcc, 13); + LHashAcc := (LHashAcc * 5) + C3; System.Inc(LIdx); end; - FH := LH; + FHashValue := LHashAcc; // save pending end bytes LOffset := AIndex + (LIdx * 4); @@ -301,9 +301,9 @@ function TMurmurHash3_x86_32.TransformFinal: IHashResult; Finish(); System.SetLength(LBufferBytes, HashSize); - TConverters.ReadUInt32AsBytesBE(FH, LBufferBytes, 0); + TConverters.ReadUInt32AsBytesBE(FHashValue, LBufferBytes, 0); - result := THashResult.Create(LBufferBytes); + Result := THashResult.Create(LBufferBytes); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpOneAtTime.pas b/HashLib/src/Hash32/HlpOneAtTime.pas index 1052819a..1acc222f 100644 --- a/HashLib/src/Hash32/HlpOneAtTime.pas +++ b/HashLib/src/Hash32/HlpOneAtTime.pas @@ -37,13 +37,13 @@ function TOneAtTime.Clone(): IHash; begin LHashInstance := TOneAtTime.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TOneAtTime.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TOneAtTime.Initialize; @@ -78,7 +78,7 @@ function TOneAtTime.TransformFinal: IHashResult; FHash := FHash xor (FHash shr 11); FHash := FHash + (FHash shl 15); - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpPJW.pas b/HashLib/src/Hash32/HlpPJW.pas index b3ae4ab3..9d92f982 100644 --- a/HashLib/src/Hash32/HlpPJW.pas +++ b/HashLib/src/Hash32/HlpPJW.pas @@ -44,13 +44,13 @@ function TPJW.Clone(): IHash; begin LHashInstance := TPJW.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TPJW.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TPJW.Initialize; @@ -85,7 +85,7 @@ procedure TPJW.TransformBytes(const AData: THashLibByteArray; function TPJW.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpRS.pas b/HashLib/src/Hash32/HlpRS.pas index 07176faa..3eabc174 100644 --- a/HashLib/src/Hash32/HlpRS.pas +++ b/HashLib/src/Hash32/HlpRS.pas @@ -16,10 +16,10 @@ interface TRS = class sealed(THash, IHash32, ITransformBlock) strict private var - FHash, FA: UInt32; + FHash, FMultiplier: UInt32; const - B = UInt32(378551); + CMul = UInt32(378551); public constructor Create(); @@ -40,20 +40,20 @@ function TRS.Clone(): IHash; begin LHashInstance := TRS.Create(); LHashInstance.FHash := FHash; - LHashInstance.FA := FA; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + LHashInstance.FMultiplier := FMultiplier; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRS.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TRS.Initialize; begin FHash := 0; - FA := 63689; + FMultiplier := 63689; end; procedure TRS.TransformBytes(const AData: THashLibByteArray; @@ -69,8 +69,8 @@ procedure TRS.TransformBytes(const AData: THashLibByteArray; LIdx := AIndex; while ALength > 0 do begin - FHash := (FHash * FA) + AData[LIdx]; - FA := FA * B; + FHash := (FHash * FMultiplier) + AData[LIdx]; + FMultiplier := FMultiplier * CMul; System.Inc(LIdx); System.Dec(ALength); end; @@ -79,7 +79,7 @@ procedure TRS.TransformBytes(const AData: THashLibByteArray; function TRS.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpRotating.pas b/HashLib/src/Hash32/HlpRotating.pas index a4107356..82d6298e 100644 --- a/HashLib/src/Hash32/HlpRotating.pas +++ b/HashLib/src/Hash32/HlpRotating.pas @@ -38,13 +38,13 @@ function TRotating.Clone(): IHash; begin LHashInstance := TRotating.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TRotating.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TRotating.Initialize; @@ -73,7 +73,7 @@ procedure TRotating.TransformBytes(const AData: THashLibByteArray; function TRotating.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpSDBM.pas b/HashLib/src/Hash32/HlpSDBM.pas index b7622a1c..d045083b 100644 --- a/HashLib/src/Hash32/HlpSDBM.pas +++ b/HashLib/src/Hash32/HlpSDBM.pas @@ -37,13 +37,13 @@ function TSDBM.Clone(): IHash; begin LHashInstance := TSDBM.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TSDBM.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TSDBM.Initialize; @@ -73,7 +73,7 @@ procedure TSDBM.TransformBytes(const AData: THashLibByteArray; function TSDBM.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpShiftAndXor.pas b/HashLib/src/Hash32/HlpShiftAndXor.pas index dcd76c27..38f8ff8e 100644 --- a/HashLib/src/Hash32/HlpShiftAndXor.pas +++ b/HashLib/src/Hash32/HlpShiftAndXor.pas @@ -37,13 +37,13 @@ function TShiftAndXor.Clone(): IHash; begin LHashInstance := TShiftAndXor.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TShiftAndXor.Create; begin - Inherited Create(4, 1); + inherited Create(4, 1); end; procedure TShiftAndXor.Initialize; @@ -72,7 +72,7 @@ procedure TShiftAndXor.TransformBytes(const AData: THashLibByteArray; function TShiftAndXor.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash32/HlpSuperFast.pas b/HashLib/src/Hash32/HlpSuperFast.pas index 29b7b9c6..7399964b 100644 --- a/HashLib/src/Hash32/HlpSuperFast.pas +++ b/HashLib/src/Hash32/HlpSuperFast.pas @@ -32,7 +32,7 @@ implementation constructor TSuperFast.Create; begin - Inherited Create(4, 4); + inherited Create(4, 4); end; function TSuperFast.Clone(): IHash; @@ -42,21 +42,21 @@ function TSuperFast.Clone(): IHash; LHashInstance := TSuperFast.Create(); FBuffer.Position := 0; LHashInstance.FBuffer.CopyFrom(FBuffer, FBuffer.Size); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; function TSuperFast.ComputeAggregatedBytes(const AData: THashLibByteArray) : IHashResult; var - LHash, LTemp, U1: UInt32; - LLength, LCurrentIndex, I1, I2: Int32; + LHash, LTemp, LU1: UInt32; + LLength, LCurrentIndex, LI1, LI2: Int32; begin LLength := System.length(AData); if (LLength = 0) then begin - result := THashResult.Create(Int32(0)); + Result := THashResult.Create(Int32(0)); Exit; end; @@ -66,14 +66,14 @@ function TSuperFast.ComputeAggregatedBytes(const AData: THashLibByteArray) while (LLength >= 4) do begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex] shl 8; + LI2 := AData[LCurrentIndex] shl 8; System.Inc(LCurrentIndex); - LHash := UInt16(LHash + UInt32(I1 or I2)); - U1 := UInt32(AData[LCurrentIndex]); + LHash := UInt16(LHash + UInt32(LI1 or LI2)); + LU1 := UInt32(AData[LCurrentIndex]); System.Inc(LCurrentIndex); - LTemp := UInt32((Byte(U1) or AData[LCurrentIndex] shl 8) shl 11) xor LHash; + LTemp := UInt32((Byte(LU1) or AData[LCurrentIndex] shl 8) shl 11) xor LHash; System.Inc(LCurrentIndex); LHash := (LHash shl 16) xor LTemp; LHash := LHash + (LHash shr 11); @@ -84,11 +84,11 @@ function TSuperFast.ComputeAggregatedBytes(const AData: THashLibByteArray) case LLength of 3: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex]; + LI2 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - LHash := LHash + UInt16(I1 or I2 shl 8); + LHash := LHash + UInt16(LI1 or LI2 shl 8); LHash := LHash xor (LHash shl 16); LHash := LHash xor (UInt32(AData[LCurrentIndex]) shl 18); LHash := LHash + (LHash shr 11); @@ -96,19 +96,19 @@ function TSuperFast.ComputeAggregatedBytes(const AData: THashLibByteArray) 2: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; System.Inc(LCurrentIndex); - I2 := AData[LCurrentIndex]; - LHash := LHash + UInt16(I1 or I2 shl 8); + LI2 := AData[LCurrentIndex]; + LHash := LHash + UInt16(LI1 or LI2 shl 8); LHash := LHash xor (LHash shl 11); LHash := LHash + (LHash shr 17); end; 1: begin - I1 := AData[LCurrentIndex]; + LI1 := AData[LCurrentIndex]; - LHash := LHash + UInt32(I1); + LHash := LHash + UInt32(LI1); LHash := LHash xor (LHash shl 10); LHash := LHash + (LHash shr 1); end; @@ -122,7 +122,7 @@ function TSuperFast.ComputeAggregatedBytes(const AData: THashLibByteArray) LHash := LHash xor (LHash shl 25); LHash := LHash + (LHash shr 6); - result := THashResult.Create(LHash); + Result := THashResult.Create(LHash); end; end. diff --git a/HashLib/src/Hash32/HlpXXHash32.pas b/HashLib/src/Hash32/HlpXXHash32.pas index 52612b0f..a4e0f276 100644 --- a/HashLib/src/Hash32/HlpXXHash32.pas +++ b/HashLib/src/Hash32/HlpXXHash32.pas @@ -28,11 +28,11 @@ TXXHash32 = class sealed(THash, IHash32, IHashWithKey, ITransformBlock) const CKEY = UInt32(0); - PRIME32_1 = UInt32(2654435761); - PRIME32_2 = UInt32(2246822519); + Prime32_1 = UInt32(2654435761); + Prime32_2 = UInt32(2246822519); PRIME32_3 = UInt32(3266489917); - PRIME32_4 = UInt32(668265263); - PRIME32_5 = UInt32(374761393); + Prime32_4 = UInt32(668265263); + Prime32_5 = UInt32(374761393); function GetKeyLength(): Int32; function GetKey: THashLibByteArray; inline; @@ -74,14 +74,14 @@ implementation function TXXHash32.TXXH_State.Clone(): TXXH_State; begin - result := Default (TXXH_State); - result.FTotalLength := FTotalLength; - result.FMemorySize := FMemorySize; - result.FV1 := FV1; - result.FV2 := FV2; - result.FV3 := FV3; - result.FV4 := FV4; - result.FMemory := System.Copy(FMemory); + Result := Default(TXXH_State); + Result.FTotalLength := FTotalLength; + Result.FMemorySize := FMemorySize; + Result.FV1 := FV1; + Result.FV2 := FV2; + Result.FV3 := FV3; + Result.FV4 := FV4; + Result.FMemory := System.Copy(FMemory); end; { TXXHash32 } @@ -94,41 +94,41 @@ function TXXHash32.Clone(): IHash; LHashInstance.FKey := FKey; LHashInstance.FHash := FHash; LHashInstance.FState := FState.Clone(); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TXXHash32.Create; begin - Inherited Create(4, 16); + inherited Create(4, 16); FKey := CKEY; System.SetLength(FState.FMemory, 16); end; function TXXHash32.GetKey: THashLibByteArray; begin - result := TConverters.ReadUInt32AsBytesLE(FKey); + Result := TConverters.ReadUInt32AsBytesLE(FKey); end; function TXXHash32.GetKeyLength: Int32; begin - result := 4; + Result := 4; end; procedure TXXHash32.Initialize; begin FHash := 0; - FState.FV1 := FKey + PRIME32_1 + PRIME32_2; - FState.FV2 := FKey + PRIME32_2; + FState.FV1 := FKey + Prime32_1 + Prime32_2; + FState.FV2 := FKey + Prime32_2; FState.FV3 := FKey + 0; - FState.FV4 := FKey - PRIME32_1; + FState.FV4 := FKey - Prime32_1; FState.FTotalLength := 0; FState.FMemorySize := 0; end; procedure TXXHash32.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin FKey := CKEY; end @@ -178,13 +178,13 @@ procedure TXXHash32.TransformBytes(const AData: THashLibByteArray; LPtrMemoryStart := PByte(FState.FMemory) + FState.FMemorySize; System.Move(LPtrADataStart^, LPtrMemoryStart^, 16 - FState.FMemorySize); - FState.FV1 := PRIME32_1 * TBits.RotateLeft32(FState.FV1 + PRIME32_2 * + FState.FV1 := Prime32_1 * TBits.RotateLeft32(FState.FV1 + Prime32_2 * TConverters.ReadBytesAsUInt32LE(LPtrMemory, 0), 13); - FState.FV2 := PRIME32_1 * TBits.RotateLeft32(FState.FV2 + PRIME32_2 * + FState.FV2 := Prime32_1 * TBits.RotateLeft32(FState.FV2 + Prime32_2 * TConverters.ReadBytesAsUInt32LE(LPtrMemory, 4), 13); - FState.FV3 := PRIME32_1 * TBits.RotateLeft32(FState.FV3 + PRIME32_2 * + FState.FV3 := Prime32_1 * TBits.RotateLeft32(FState.FV3 + Prime32_2 * TConverters.ReadBytesAsUInt32LE(LPtrMemory, 8), 13); - FState.FV4 := PRIME32_1 * TBits.RotateLeft32(FState.FV4 + PRIME32_2 * + FState.FV4 := Prime32_1 * TBits.RotateLeft32(FState.FV4 + Prime32_2 * TConverters.ReadBytesAsUInt32LE(LPtrMemory, 12), 13); LPtrADataStart := LPtrADataStart + (16 - FState.FMemorySize); @@ -203,17 +203,17 @@ procedure TXXHash32.TransformBytes(const AData: THashLibByteArray; LPtrADataStartCardinal := PCardinal(LPtrADataStart); - LV1 := PRIME32_1 * TBits.RotateLeft32 - (LV1 + PRIME32_2 * TConverters.ReadPCardinalAsUInt32LE + LV1 := Prime32_1 * TBits.RotateLeft32 + (LV1 + Prime32_2 * TConverters.ReadPCardinalAsUInt32LE (LPtrADataStartCardinal), 13); - LV2 := PRIME32_1 * TBits.RotateLeft32 - (LV2 + PRIME32_2 * TConverters.ReadPCardinalAsUInt32LE + LV2 := Prime32_1 * TBits.RotateLeft32 + (LV2 + Prime32_2 * TConverters.ReadPCardinalAsUInt32LE (LPtrADataStartCardinal + 1), 13); - LV3 := PRIME32_1 * TBits.RotateLeft32 - (LV3 + PRIME32_2 * TConverters.ReadPCardinalAsUInt32LE + LV3 := Prime32_1 * TBits.RotateLeft32 + (LV3 + Prime32_2 * TConverters.ReadPCardinalAsUInt32LE (LPtrADataStartCardinal + 2), 13); - LV4 := PRIME32_1 * TBits.RotateLeft32 - (LV4 + PRIME32_2 * TConverters.ReadPCardinalAsUInt32LE + LV4 := Prime32_1 * TBits.RotateLeft32 + (LV4 + Prime32_2 * TConverters.ReadPCardinalAsUInt32LE (LPtrADataStartCardinal + 3), 13); System.Inc(LPtrADataStart, 16); @@ -248,7 +248,7 @@ function TXXHash32.TransformFinal: IHashResult; end else begin - FHash := FKey + PRIME32_5; + FHash := FKey + Prime32_5; end; System.Inc(FHash, FState.FTotalLength); @@ -258,24 +258,24 @@ function TXXHash32.TransformFinal: IHashResult; while ((LPtrBuffer + 4) <= LPtrEnd) do begin FHash := FHash + TConverters.ReadBytesAsUInt32LE(LPtrBuffer, 0) * PRIME32_3; - FHash := TBits.RotateLeft32(FHash, 17) * PRIME32_4; + FHash := TBits.RotateLeft32(FHash, 17) * Prime32_4; System.Inc(LPtrBuffer, 4); end; while LPtrBuffer < LPtrEnd do begin - FHash := FHash + LPtrBuffer^ * PRIME32_5; - FHash := TBits.RotateLeft32(FHash, 11) * PRIME32_1; + FHash := FHash + LPtrBuffer^ * Prime32_5; + FHash := TBits.RotateLeft32(FHash, 11) * Prime32_1; System.Inc(LPtrBuffer); end; FHash := FHash xor (FHash shr 15); - FHash := FHash * PRIME32_2; + FHash := FHash * Prime32_2; FHash := FHash xor (FHash shr 13); FHash := FHash * PRIME32_3; FHash := FHash xor (FHash shr 16); - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash64/HlpFNV1a64.pas b/HashLib/src/Hash64/HlpFNV1a64.pas index 050a039b..43207390 100644 --- a/HashLib/src/Hash64/HlpFNV1a64.pas +++ b/HashLib/src/Hash64/HlpFNV1a64.pas @@ -37,13 +37,13 @@ function TFNV1a64.Clone(): IHash; begin LHashInstance := TFNV1a64.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TFNV1a64.Create; begin - Inherited Create(8, 1); + inherited Create(8, 1); end; procedure TFNV1a64.Initialize; @@ -73,7 +73,7 @@ procedure TFNV1a64.TransformBytes(const AData: THashLibByteArray; function TFNV1a64.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash64/HlpFNV64.pas b/HashLib/src/Hash64/HlpFNV64.pas index 7cb8a52f..461c4aa8 100644 --- a/HashLib/src/Hash64/HlpFNV64.pas +++ b/HashLib/src/Hash64/HlpFNV64.pas @@ -37,13 +37,13 @@ function TFNV64.Clone(): IHash; begin LHashInstance := TFNV64.Create(); LHashInstance.FHash := FHash; - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TFNV64.Create; begin - Inherited Create(8, 1); + inherited Create(8, 1); end; procedure TFNV64.Initialize; @@ -73,7 +73,7 @@ procedure TFNV64.TransformBytes(const AData: THashLibByteArray; function TFNV64.TransformFinal: IHashResult; begin - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Hash64/HlpMurmur2_64.pas b/HashLib/src/Hash64/HlpMurmur2_64.pas index ae51cef3..f6ab22e4 100644 --- a/HashLib/src/Hash64/HlpMurmur2_64.pas +++ b/HashLib/src/Hash64/HlpMurmur2_64.pas @@ -28,8 +28,8 @@ TMurmur2_64 = class sealed(TMultipleTransformNonBlock, IHash64, IHashWithKey, const CKEY = UInt64($0); // to bypass Internal error (200706094) on FPC, We use "Typed Constant". - M: UInt64 = UInt64($C6A4A7935BD1E995); - R = Int32(47); + CMul: UInt64 = UInt64($C6A4A7935BD1E995); + CShift = Int32(47); function GetKeyLength(): Int32; function GetKey: THashLibByteArray; inline; @@ -61,15 +61,15 @@ function TMurmur2_64.Clone(): IHash; LHashInstance.FWorkingKey := FWorkingKey; FBuffer.Position := 0; LHashInstance.FBuffer.CopyFrom(FBuffer, FBuffer.Size); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; function TMurmur2_64.ComputeAggregatedBytes(const AData: THashLibByteArray) : IHashResult; var LLength, LCurrentIndex, LNBlocks, LIdx: Int32; - LH, LK: UInt64; + LHashAcc, LReadChunk: UInt64; LPtrData: PByte; LPtrDataUInt64: PUInt64; begin @@ -78,11 +78,11 @@ function TMurmur2_64.ComputeAggregatedBytes(const AData: THashLibByteArray) if (LLength = 0) then begin - result := THashResult.Create(UInt64(0)); + Result := THashResult.Create(UInt64(0)); Exit; end; - LH := FWorkingKey xor (UInt64(LLength) * M); + LHashAcc := FWorkingKey xor (UInt64(LLength) * CMul); LCurrentIndex := 0; LIdx := 0; LPtrDataUInt64 := PUInt64(LPtrData); @@ -90,14 +90,14 @@ function TMurmur2_64.ComputeAggregatedBytes(const AData: THashLibByteArray) while LIdx < LNBlocks do begin - LK := TConverters.ReadPUInt64AsUInt64LE(LPtrDataUInt64 + LIdx); + LReadChunk := TConverters.ReadPUInt64AsUInt64LE(LPtrDataUInt64 + LIdx); - LK := LK * M; - LK := LK xor (LK shr R); - LK := LK * M; + LReadChunk := LReadChunk * CMul; + LReadChunk := LReadChunk xor (LReadChunk shr CShift); + LReadChunk := LReadChunk * CMul; - LH := LH xor LK; - LH := LH * M; + LHashAcc := LHashAcc xor LReadChunk; + LHashAcc := LHashAcc * CMul; System.Inc(LIdx); System.Inc(LCurrentIndex, 8); @@ -107,126 +107,126 @@ function TMurmur2_64.ComputeAggregatedBytes(const AData: THashLibByteArray) case LLength of 7: begin - LH := LH xor ((UInt64(AData[LCurrentIndex + 6]) shl 48)); + LHashAcc := LHashAcc xor ((UInt64(AData[LCurrentIndex + 6]) shl 48)); - LH := LH xor (UInt64(AData[LCurrentIndex + 5]) shl 40); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 5]) shl 40); - LH := LH xor (UInt64(AData[LCurrentIndex + 4]) shl 32); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 4]) shl 32); - LH := LH xor (UInt64(AData[LCurrentIndex + 3]) shl 24); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 3]) shl 24); - LH := LH xor (UInt64(AData[LCurrentIndex + 2]) shl 16); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 2]) shl 16); - LH := LH xor (UInt64(AData[LCurrentIndex + 1]) shl 8); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 1]) shl 8); - LH := LH xor UInt64(AData[LCurrentIndex]); + LHashAcc := LHashAcc xor UInt64(AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc * CMul; end; 6: begin - LH := LH xor (UInt64(AData[LCurrentIndex + 5]) shl 40); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 5]) shl 40); - LH := LH xor (UInt64(AData[LCurrentIndex + 4]) shl 32); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 4]) shl 32); - LH := LH xor (UInt64(AData[LCurrentIndex + 3]) shl 24); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 3]) shl 24); - LH := LH xor (UInt64(AData[LCurrentIndex + 2]) shl 16); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 2]) shl 16); - LH := LH xor (UInt64(AData[LCurrentIndex + 1]) shl 8); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 1]) shl 8); - LH := LH xor UInt64(AData[LCurrentIndex]); + LHashAcc := LHashAcc xor UInt64(AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc * CMul; end; 5: begin - LH := LH xor (UInt64(AData[LCurrentIndex + 4]) shl 32); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 4]) shl 32); - LH := LH xor (UInt64(AData[LCurrentIndex + 3]) shl 24); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 3]) shl 24); - LH := LH xor (UInt64(AData[LCurrentIndex + 2]) shl 16); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 2]) shl 16); - LH := LH xor (UInt64(AData[LCurrentIndex + 1]) shl 8); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 1]) shl 8); - LH := LH xor UInt64(AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc xor UInt64(AData[LCurrentIndex]); + LHashAcc := LHashAcc * CMul; end; 4: begin - LH := LH xor (UInt64(AData[LCurrentIndex + 3]) shl 24); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 3]) shl 24); - LH := LH xor (UInt64(AData[LCurrentIndex + 2]) shl 16); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 2]) shl 16); - LH := LH xor (UInt64(AData[LCurrentIndex + 1]) shl 8); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 1]) shl 8); - LH := LH xor UInt64(AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc xor UInt64(AData[LCurrentIndex]); + LHashAcc := LHashAcc * CMul; end; 3: begin - LH := LH xor (UInt64(AData[LCurrentIndex + 2]) shl 16); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 2]) shl 16); - LH := LH xor (UInt64(AData[LCurrentIndex + 1]) shl 8); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 1]) shl 8); - LH := LH xor UInt64(AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc xor UInt64(AData[LCurrentIndex]); + LHashAcc := LHashAcc * CMul; end; 2: begin - LH := LH xor (UInt64(AData[LCurrentIndex + 1]) shl 8); + LHashAcc := LHashAcc xor (UInt64(AData[LCurrentIndex + 1]) shl 8); - LH := LH xor UInt64(AData[LCurrentIndex]); + LHashAcc := LHashAcc xor UInt64(AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc * CMul; end; 1: begin - LH := LH xor UInt64(AData[LCurrentIndex]); + LHashAcc := LHashAcc xor UInt64(AData[LCurrentIndex]); - LH := LH * M; + LHashAcc := LHashAcc * CMul; end; end; - LH := LH xor (LH shr R); - LH := LH * M; - LH := LH xor (LH shr R); + LHashAcc := LHashAcc xor (LHashAcc shr CShift); + LHashAcc := LHashAcc * CMul; + LHashAcc := LHashAcc xor (LHashAcc shr CShift); - result := THashResult.Create(LH); + Result := THashResult.Create(LHashAcc); end; constructor TMurmur2_64.Create; begin - Inherited Create(8, 8); + inherited Create(8, 8); FKey := CKEY; end; function TMurmur2_64.GetKey: THashLibByteArray; begin - result := TConverters.ReadUInt64AsBytesLE(FKey); + Result := TConverters.ReadUInt64AsBytesLE(FKey); end; function TMurmur2_64.GetKeyLength: Int32; begin - result := 8; + Result := 8; end; procedure TMurmur2_64.Initialize; begin FWorkingKey := FKey; - Inherited Initialize(); + inherited Initialize(); end; procedure TMurmur2_64.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin FKey := CKEY; end diff --git a/HashLib/src/Hash64/HlpSipHash.pas b/HashLib/src/Hash64/HlpSipHash.pas index b7562aad..d08de75c 100644 --- a/HashLib/src/Hash64/HlpSipHash.pas +++ b/HashLib/src/Hash64/HlpSipHash.pas @@ -28,8 +28,8 @@ TSipHash = class abstract(THash, IHash64, IHashWithKey, ITransformBlock) V1 = UInt64($646F72616E646F6D); V2 = UInt64($6C7967656E657261); V3 = UInt64($7465646279746573); - KEY0 = UInt64($0706050403020100); - KEY1 = UInt64($0F0E0D0C0B0A0908); + Key0 = UInt64($0706050403020100); + Key1 = UInt64($0F0E0D0C0B0A0908); {$ENDREGION} procedure Compress(); inline; @@ -102,13 +102,13 @@ function TSipHash2_4.Clone(): IHash; LHashInstance.FFinalizationRounds := FFinalizationRounds; LHashInstance.FIdx := FIdx; LHashInstance.FBuffer := System.Copy(FBuffer); - Result := LHashInstance as IHash; + Result := LHashInstance; Result.BufferSize := BufferSize; end; constructor TSipHash2_4.Create(ACompressionRounds, AFinalizationRounds: Int32); begin - Inherited Create(8, 8); + inherited Create(8, 8); FCompressionRounds := ACompressionRounds; FFinalizationRounds := AFinalizationRounds; end; @@ -247,9 +247,9 @@ procedure TSipHash.ByteUpdate(AByte: Byte); constructor TSipHash.Create(AHashSize, ABlockSize: Int32); begin - Inherited Create(AHashSize, ABlockSize); - FKey0 := KEY0; - FKey1 := KEY1; + inherited Create(AHashSize, ABlockSize); + FKey0 := Key0; + FKey1 := Key1; System.SetLength(FBuffer, 8); end; @@ -297,10 +297,10 @@ procedure TSipHash.Initialize; procedure TSipHash.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin - FKey0 := KEY0; - FKey1 := KEY1; + FKey0 := Key0; + FKey1 := Key1; end else begin diff --git a/HashLib/src/Hash64/HlpXXHash64.pas b/HashLib/src/Hash64/HlpXXHash64.pas index 830dcb4e..c7a85a26 100644 --- a/HashLib/src/Hash64/HlpXXHash64.pas +++ b/HashLib/src/Hash64/HlpXXHash64.pas @@ -28,11 +28,11 @@ TXXHash64 = class sealed(THash, IHash64, IHashWithKey, ITransformBlock) const CKEY = UInt64(0); // to bypass Internal error (200706094) on FPC, We use "Typed Constant". - PRIME64_1: UInt64 = (11400714785074694791); - PRIME64_2: UInt64 = (14029467366897019727); - PRIME64_3: UInt64 = (1609587929392839161); - PRIME64_4: UInt64 = (9650029242287828579); - PRIME64_5: UInt64 = (2870177450012600261); + Prime64_1: UInt64 = (11400714785074694791); + Prime64_2: UInt64 = (14029467366897019727); + Prime64_3: UInt64 = (1609587929392839161); + Prime64_4: UInt64 = (9650029242287828579); + Prime64_5: UInt64 = (2870177450012600261); function GetKeyLength(): Int32; function GetKey: THashLibByteArray; inline; @@ -74,14 +74,14 @@ implementation function TXXHash64.TXXH_State.Clone(): TXXH_State; begin - result := Default (TXXH_State); - result.FTotalLength := FTotalLength; - result.FMemorySize := FMemorySize; - result.FV1 := FV1; - result.FV2 := FV2; - result.FV3 := FV3; - result.FV4 := FV4; - result.FMemory := System.Copy(FMemory); + Result := Default(TXXH_State); + Result.FTotalLength := FTotalLength; + Result.FMemorySize := FMemorySize; + Result.FV1 := FV1; + Result.FV2 := FV2; + Result.FV3 := FV3; + Result.FV4 := FV4; + Result.FMemory := System.Copy(FMemory); end; { TXXHash64 } @@ -94,41 +94,41 @@ function TXXHash64.Clone(): IHash; LHashInstance.FKey := FKey; LHashInstance.FHash := FHash; LHashInstance.FState := FState.Clone(); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TXXHash64.Create; begin - Inherited Create(8, 32); + inherited Create(8, 32); FKey := CKEY; System.SetLength(FState.FMemory, 32); end; function TXXHash64.GetKey: THashLibByteArray; begin - result := TConverters.ReadUInt64AsBytesLE(FKey); + Result := TConverters.ReadUInt64AsBytesLE(FKey); end; function TXXHash64.GetKeyLength: Int32; begin - result := 8; + Result := 8; end; procedure TXXHash64.Initialize; begin FHash := 0; - FState.FV1 := FKey + PRIME64_1 + PRIME64_2; - FState.FV2 := FKey + PRIME64_2; + FState.FV1 := FKey + Prime64_1 + Prime64_2; + FState.FV2 := FKey + Prime64_2; FState.FV3 := FKey + 0; - FState.FV4 := FKey - PRIME64_1; + FState.FV4 := FKey - Prime64_1; FState.FTotalLength := 0; FState.FMemorySize := 0; end; procedure TXXHash64.SetKey(const AValue: THashLibByteArray); begin - if (AValue = Nil) then + if (AValue = nil) then begin FKey := CKEY; end @@ -177,13 +177,13 @@ procedure TXXHash64.TransformBytes(const AData: THashLibByteArray; LPtrMemoryStart := PByte(FState.FMemory) + FState.FMemorySize; System.Move(LPtrADataStart^, LPtrMemoryStart^, 32 - FState.FMemorySize); - FState.FV1 := PRIME64_1 * TBits.RotateLeft64(FState.FV1 + PRIME64_2 * + FState.FV1 := Prime64_1 * TBits.RotateLeft64(FState.FV1 + Prime64_2 * TConverters.ReadBytesAsUInt64LE(LPtrMemory, 0), 31); - FState.FV2 := PRIME64_1 * TBits.RotateLeft64(FState.FV2 + PRIME64_2 * + FState.FV2 := Prime64_1 * TBits.RotateLeft64(FState.FV2 + Prime64_2 * TConverters.ReadBytesAsUInt64LE(LPtrMemory, 8), 31); - FState.FV3 := PRIME64_1 * TBits.RotateLeft64(FState.FV3 + PRIME64_2 * + FState.FV3 := Prime64_1 * TBits.RotateLeft64(FState.FV3 + Prime64_2 * TConverters.ReadBytesAsUInt64LE(LPtrMemory, 16), 31); - FState.FV4 := PRIME64_1 * TBits.RotateLeft64(FState.FV4 + PRIME64_2 * + FState.FV4 := Prime64_1 * TBits.RotateLeft64(FState.FV4 + Prime64_2 * TConverters.ReadBytesAsUInt64LE(LPtrMemory, 24), 31); LPtrADataStart := LPtrADataStart + (32 - FState.FMemorySize); @@ -202,17 +202,17 @@ procedure TXXHash64.TransformBytes(const AData: THashLibByteArray; LPtrADataStartUInt64 := PUInt64(LPtrADataStart); - LV1 := PRIME64_1 * TBits.RotateLeft64 - (LV1 + PRIME64_2 * TConverters.ReadPUInt64AsUInt64LE + LV1 := Prime64_1 * TBits.RotateLeft64 + (LV1 + Prime64_2 * TConverters.ReadPUInt64AsUInt64LE (LPtrADataStartUInt64), 31); - LV2 := PRIME64_1 * TBits.RotateLeft64 - (LV2 + PRIME64_2 * TConverters.ReadPUInt64AsUInt64LE + LV2 := Prime64_1 * TBits.RotateLeft64 + (LV2 + Prime64_2 * TConverters.ReadPUInt64AsUInt64LE (LPtrADataStartUInt64 + 1), 31); - LV3 := PRIME64_1 * TBits.RotateLeft64 - (LV3 + PRIME64_2 * TConverters.ReadPUInt64AsUInt64LE + LV3 := Prime64_1 * TBits.RotateLeft64 + (LV3 + Prime64_2 * TConverters.ReadPUInt64AsUInt64LE (LPtrADataStartUInt64 + 2), 31); - LV4 := PRIME64_1 * TBits.RotateLeft64 - (LV4 + PRIME64_2 * TConverters.ReadPUInt64AsUInt64LE + LV4 := Prime64_1 * TBits.RotateLeft64 + (LV4 + Prime64_2 * TConverters.ReadPUInt64AsUInt64LE (LPtrADataStartUInt64 + 3), 31); System.Inc(LPtrADataStart, 32); @@ -249,21 +249,21 @@ function TXXHash64.TransformFinal: IHashResult; FHash := TBits.RotateLeft64(LV1, 1) + TBits.RotateLeft64(LV2, 7) + TBits.RotateLeft64(LV3, 12) + TBits.RotateLeft64(LV4, 18); - LV1 := TBits.RotateLeft64(LV1 * PRIME64_2, 31) * PRIME64_1; - FHash := (FHash xor LV1) * PRIME64_1 + PRIME64_4; + LV1 := TBits.RotateLeft64(LV1 * Prime64_2, 31) * Prime64_1; + FHash := (FHash xor LV1) * Prime64_1 + Prime64_4; - LV2 := TBits.RotateLeft64(LV2 * PRIME64_2, 31) * PRIME64_1; - FHash := (FHash xor LV2) * PRIME64_1 + PRIME64_4; + LV2 := TBits.RotateLeft64(LV2 * Prime64_2, 31) * Prime64_1; + FHash := (FHash xor LV2) * Prime64_1 + Prime64_4; - LV3 := TBits.RotateLeft64(LV3 * PRIME64_2, 31) * PRIME64_1; - FHash := (FHash xor LV3) * PRIME64_1 + PRIME64_4; + LV3 := TBits.RotateLeft64(LV3 * Prime64_2, 31) * Prime64_1; + FHash := (FHash xor LV3) * Prime64_1 + Prime64_4; - LV4 := TBits.RotateLeft64(LV4 * PRIME64_2, 31) * PRIME64_1; - FHash := (FHash xor LV4) * PRIME64_1 + PRIME64_4; + LV4 := TBits.RotateLeft64(LV4 * Prime64_2, 31) * Prime64_1; + FHash := (FHash xor LV4) * Prime64_1 + Prime64_4; end else begin - FHash := FKey + PRIME64_5; + FHash := FKey + Prime64_5; end; System.Inc(FHash, FState.FTotalLength); @@ -273,34 +273,34 @@ function TXXHash64.TransformFinal: IHashResult; while (LPtrBuffer + 8) <= LPtrEnd do begin - FHash := FHash xor (PRIME64_1 * TBits.RotateLeft64(PRIME64_2 * + FHash := FHash xor (Prime64_1 * TBits.RotateLeft64(Prime64_2 * TConverters.ReadBytesAsUInt64LE(LPtrBuffer, 0), 31)); - FHash := TBits.RotateLeft64(FHash, 27) * PRIME64_1 + PRIME64_4; + FHash := TBits.RotateLeft64(FHash, 27) * Prime64_1 + Prime64_4; System.Inc(LPtrBuffer, 8); end; if (LPtrBuffer + 4) <= LPtrEnd then begin FHash := FHash xor TConverters.ReadBytesAsUInt32LE(LPtrBuffer, 0) * - PRIME64_1; - FHash := TBits.RotateLeft64(FHash, 23) * PRIME64_2 + PRIME64_3; + Prime64_1; + FHash := TBits.RotateLeft64(FHash, 23) * Prime64_2 + Prime64_3; System.Inc(LPtrBuffer, 4); end; while LPtrBuffer < LPtrEnd do begin - FHash := FHash xor LPtrBuffer^ * PRIME64_5; - FHash := TBits.RotateLeft64(FHash, 11) * PRIME64_1; + FHash := FHash xor LPtrBuffer^ * Prime64_5; + FHash := TBits.RotateLeft64(FHash, 11) * Prime64_1; System.Inc(LPtrBuffer); end; FHash := FHash xor (FHash shr 33); - FHash := FHash * PRIME64_2; + FHash := FHash * Prime64_2; FHash := FHash xor (FHash shr 29); - FHash := FHash * PRIME64_3; + FHash := FHash * Prime64_3; FHash := FHash xor (FHash shr 32); - result := THashResult.Create(FHash); + Result := THashResult.Create(FHash); Initialize(); end; diff --git a/HashLib/src/Interfaces/HlpICRC.pas b/HashLib/src/Interfaces/HlpICRC.pas index 576ef0dc..5b51c607 100644 --- a/HashLib/src/Interfaces/HlpICRC.pas +++ b/HashLib/src/Interfaces/HlpICRC.pas @@ -20,7 +20,7 @@ interface function GetPolynomial: UInt64; property Polynomial: UInt64 read GetPolynomial; function GetInitialValue: UInt64; - property InitialVlaue: UInt64 read GetInitialValue; + property InitialValue: UInt64 read GetInitialValue; function GetIsInputReflected: Boolean; property IsInputReflected: Boolean read GetIsInputReflected; function GetIsOutputReflected: Boolean; diff --git a/HashLib/src/Interfaces/HlpIHash.pas b/HashLib/src/Interfaces/HlpIHash.pas index d301675f..8f5cd798 100644 --- a/HashLib/src/Interfaces/HlpIHash.pas +++ b/HashLib/src/Interfaces/HlpIHash.pas @@ -42,7 +42,7 @@ interface function TransformFinal(): IHashResult; - function ComputeString(const AData: String; AEncoding: TEncoding) + function ComputeString(const AData: String; const AEncoding: TEncoding) : IHashResult; function ComputeBytes(const AData: THashLibByteArray): IHashResult; function ComputeUntyped(const AData; ALength: Int64): IHashResult; diff --git a/HashLib/src/KDF/HlpPBKDF2_HMACNotBuildInAdapter.pas b/HashLib/src/KDF/HlpPBKDF2_HMACNotBuildInAdapter.pas index a387183e..3f29c959 100644 --- a/HashLib/src/KDF/HlpPBKDF2_HMACNotBuildInAdapter.pas +++ b/HashLib/src/KDF/HlpPBKDF2_HMACNotBuildInAdapter.pas @@ -18,7 +18,7 @@ interface '"(AByteCount)" Argument must be a value greater than zero.'; SInvalidIndex = 'Invalid start or end index in the internal buffer'; SNotInitializedIHashInstance = '"IHash" instance is uninitialized'; - SIterationtooSmall = 'Iteration must be greater than zero.'; + SIterationTooSmall = 'Iteration must be greater than zero.'; type @@ -80,7 +80,7 @@ class procedure TPBKDF2_HMACNotBuildInAdapter.ValidatePBKDF2_HMACInputs raise EArgumentNilHashLibException.CreateRes(@SNotInitializedIHashInstance); if (AIterations < 1) then - raise EArgumentHashLibException.CreateRes(@SIterationtooSmall); + raise EArgumentHashLibException.CreateRes(@SIterationTooSmall); end; procedure TPBKDF2_HMACNotBuildInAdapter.Clear(); @@ -92,7 +92,7 @@ procedure TPBKDF2_HMACNotBuildInAdapter.Clear(); constructor TPBKDF2_HMACNotBuildInAdapter.Create(const AUnderlyingHash: IHash; const APassword, ASalt: THashLibByteArray; AIterations: UInt32); begin - Inherited Create(); + inherited Create(); ValidatePBKDF2_HMACInputs(AUnderlyingHash, AIterations); FHash := AUnderlyingHash; FPassword := System.Copy(APassword); @@ -116,16 +116,16 @@ class function TPBKDF2_HMACNotBuildInAdapter.GetBigEndianBytes(AInput: UInt32) function TPBKDF2_HMACNotBuildInAdapter.Func: THashLibByteArray; var - LINT_Block, LTemp: THashLibByteArray; + LIntBlockBytes, LTemp: THashLibByteArray; LIdx: UInt32; - LJdx: Int32; + LInnerIdx: Int32; begin - LINT_Block := TPBKDF2_HMACNotBuildInAdapter.GetBigEndianBytes(FBlock); + LIntBlockBytes := TPBKDF2_HMACNotBuildInAdapter.GetBigEndianBytes(FBlock); FHMAC.Initialize(); FHMAC.TransformBytes(FSalt, 0, System.Length(FSalt)); - FHMAC.TransformBytes(LINT_Block, 0, System.Length(LINT_Block)); + FHMAC.TransformBytes(LIntBlockBytes, 0, System.Length(LIntBlockBytes)); LTemp := FHMAC.TransformFinal().GetBytes(); @@ -135,11 +135,11 @@ function TPBKDF2_HMACNotBuildInAdapter.Func: THashLibByteArray; while LIdx <= FIterationCount do begin LTemp := FHMAC.ComputeBytes(LTemp).GetBytes(); - LJdx := 0; - while LJdx < FBlockSize do + LInnerIdx := 0; + while LInnerIdx < FBlockSize do begin - Result[LJdx] := Result[LJdx] xor LTemp[LJdx]; - System.Inc(LJdx); + Result[LInnerIdx] := Result[LInnerIdx] xor LTemp[LInnerIdx]; + System.Inc(LInnerIdx); end; System.Inc(LIdx); end; @@ -149,7 +149,7 @@ function TPBKDF2_HMACNotBuildInAdapter.Func: THashLibByteArray; function TPBKDF2_HMACNotBuildInAdapter.GetBytes(AByteCount: Int32) : THashLibByteArray; var - LKey, LT_Block: THashLibByteArray; + LKey, LTempBlock: THashLibByteArray; LOffset, LSize, LRemainder, LRemCount: Int32; begin @@ -187,23 +187,23 @@ function TPBKDF2_HMACNotBuildInAdapter.GetBytes(AByteCount: Int32) while (LOffset < AByteCount) do begin - LT_Block := Func(); + LTempBlock := Func(); LRemainder := AByteCount - LOffset; if (LRemainder > FBlockSize) then begin - System.Move(LT_Block[0], LKey[LOffset], FBlockSize); + System.Move(LTempBlock[0], LKey[LOffset], FBlockSize); LOffset := LOffset + FBlockSize; end else begin if (LRemainder > 0) then begin - System.Move(LT_Block[0], LKey[LOffset], LRemainder); + System.Move(LTempBlock[0], LKey[LOffset], LRemainder); end; LRemCount := FBlockSize - LRemainder; if LRemCount > 0 then begin - System.Move(LT_Block[LRemainder], FBuffer[FStartIndex], LRemCount); + System.Move(LTempBlock[LRemainder], FBuffer[FStartIndex], LRemCount); end; FEndIndex := FEndIndex + LRemCount; Result := LKey; diff --git a/HashLib/src/KDF/HlpPBKDF_Argon2NotBuildInAdapter.pas b/HashLib/src/KDF/HlpPBKDF_Argon2NotBuildInAdapter.pas index ea82b517..da1188c7 100644 --- a/HashLib/src/KDF/HlpPBKDF_Argon2NotBuildInAdapter.pas +++ b/HashLib/src/KDF/HlpPBKDF_Argon2NotBuildInAdapter.pas @@ -1,4 +1,4 @@ -unit HlpPBKDF_Argon2NotBuildInAdapter; +unit HlpPBKDF_Argon2NotBuildInAdapter; {$I ..\Include\HashLib.inc} @@ -39,11 +39,11 @@ TArgon2ParametersBuilder = class abstract(TInterfacedObject, strict private const - DEFAULT_ITERATIONS = Int32(3); - DEFAULT_MEMORY_COST = Int32(12); - DEFAULT_LANES = Int32(1); - DEFAULT_TYPE: TArgon2Type = TArgon2Type.a2tARGON2_i; - DEFAULT_VERSION: TArgon2Version = TArgon2Version.a2vARGON2_VERSION_13; + DefaultIterations = Int32(3); + DefaultMemoryCost = Int32(12); + DefaultLanes = Int32(1); + DefaultType: TArgon2Type = TArgon2Type.a2tARGON2_i; + DefaultVersion: TArgon2Version = TArgon2Version.a2vARGON2_VERSION_13; var FSalt, FSecret, FAdditional: THashLibByteArray; @@ -168,25 +168,25 @@ TPBKDF_Argon2NotBuildInAdapter = class sealed(TKDF, IPBKDF_Argon2, const - ARGON2_BLOCK_SIZE = Int32(1024); - ARGON2_QWORDS_IN_BLOCK = Int32(ARGON2_BLOCK_SIZE div 8); + Argon2BlockSize = Int32(1024); + Argon2QwordsInBlock = Int32(Argon2BlockSize div 8); - ARGON2_ADDRESSES_IN_BLOCK = Int32(128); + Argon2AddressesInBlock = Int32(128); - ARGON2_PREHASH_DIGEST_LENGTH = Int32(64); - ARGON2_PREHASH_SEED_LENGTH = Int32(72); + Argon2PrehashDigestLength = Int32(64); + Argon2PrehashSeedLength = Int32(72); - ARGON2_SYNC_POINTS = Int32(4); + Argon2SyncPoints = Int32(4); // Minimum and maximum number of lanes (degree of parallelism) - MIN_PARALLELISM = Int32(1); - MAX_PARALLELISM = Int32(16777216); + MinParallelism = Int32(1); + MaxParallelism = Int32(16777216); // Minimum digest size in bytes - MIN_OUTLEN = Int32(4); + MinOutLen = Int32(4); // Minimum and maximum number of passes - MIN_ITERATIONS = Int32(1); + MinIterations = Int32(1); type TBlock = record @@ -194,15 +194,13 @@ TBlock = record private const - SIZE = Int32(ARGON2_QWORDS_IN_BLOCK); + Size = Int32(Argon2QwordsInBlock); var // 128 * 8 Byte QWords - Fv: THashLibUInt64Array; + FV: THashLibUInt64Array; FInitialized: Boolean; - procedure CheckAreBlocksInitialized(const ABlocks - : THashLibGenericArray); procedure CopyBlock(const AOther: TBlock); inline; procedure &Xor(const AB1, AB2: TBlock); overload; procedure XorWith(const AOther: TBlock); @@ -249,7 +247,8 @@ TFillBlock = record procedure ApplyBlake(); - procedure FillBlock(var Ax, Ay, ACurrentBlock: TBlock; AWithXor: Boolean); + procedure FillBlock(var ALeftBlock, ARightBlock, ACurrentBlock: TBlock; + AWithXor: Boolean); { *designed by the Lyra PHC team */ @@ -257,15 +256,17 @@ TFillBlock = record * + == addition modulo 2^64 * aL = least 32 bit * } - class procedure FBlaMka(var ABlock: TBlock; Ax, Ay: Int32); - static; inline; - class procedure Rotr64(var ABlock: TBlock; Av, Aw, Ac: Int32); - static; inline; - class procedure F(var ABlock: TBlock; Aa, Ab, Ac, Ad: Int32); + class procedure FBlaMka(var ABlock: TBlock; AIndexX, AIndexY: Int32); static; inline; + class procedure Rotr64(var ABlock: TBlock; AIndexV, AIndexW, + ARotateCount: Int32); static; inline; + class procedure QuarterRound(var ABlock: TBlock; AWordIndexA, AWordIndexB, AWordIndexC, + AWordIndexD: Int32); static; inline; class procedure RoundFunction(var ABlock: TBlock; - Av0, Av1, Av2, Av3, Av4, Av5, Av6, Av7, Av8, Av9, Av10, Av11, Av12, - Av13, Av14, Av15: Int32); static; inline; + ABlockWord0, ABlockWord1, ABlockWord2, ABlockWord3, ABlockWord4, + ABlockWord5, ABlockWord6, ABlockWord7, ABlockWord8, ABlockWord9, + ABlockWord10, ABlockWord11, ABlockWord12, ABlockWord13, ABlockWord14, + ABlockWord15: Int32); static; inline; public property R: TBlock read GetR; @@ -284,7 +285,7 @@ TFillBlock = record FParameters: IArgon2Parameters; FPassword, FResult: THashLibByteArray; - class procedure AddIntToLittleEndian(const AHash: IHash; An: Int32); + class procedure AddIntToLittleEndian(const AHash: IHash; AInt32Value: Int32); static; inline; class procedure AddByteString(const AHash: IHash; @@ -305,7 +306,7 @@ TFillBlock = record : Boolean; inline; procedure NextAddresses(const AFiller: TFillBlock; var AZeroBlock, AInputBlock, AAddressBlock: TBlock); inline; - function IntToUInt64(Ax: Int32): UInt64; inline; + function IntToUInt64(AValue: Int32): UInt64; inline; procedure InitAddressBlocks(const AFiller: TFillBlock; const APosition: TPosition; var AZeroBlock, AInputBlock, AAddressBlock: TBlock); @@ -330,7 +331,7 @@ TFillBlock = record (* * * H0 = H64(p, τ, m, t, v, y, |P|, P, |S|, S, |L|, K, |X|, X) - * -> 64 byte (ARGON2_PREHASH_DIGEST_LENGTH) + * -> 64 byte (Argon2PrehashDigestLength) *) function InitialHash(const AParameters: IArgon2Parameters; AOutputLength: Int32; const APassword: THashLibByteArray) @@ -378,7 +379,7 @@ TFillBlock = record /// /// The number of pseudo-random key bytes to generate. /// A byte array filled with pseudo-random key bytes. - /// /// AByteCount must be greater than MIN_OUTLEN. + /// /// AByteCount must be greater than MinOutLen. function GetBytes(AByteCount: Int32): THashLibByteArray; override; end; @@ -389,41 +390,30 @@ implementation class function TPBKDF_Argon2NotBuildInAdapter.TBlock.CreateBlock: TBlock; begin - result := Default(TBlock); - System.SetLength(result.Fv, SIZE); - result.FInitialized := True; -end; - -procedure TPBKDF_Argon2NotBuildInAdapter.TBlock.CheckAreBlocksInitialized - (const ABlocks: THashLibGenericArray); -var - LBlock: TBlock; -begin - for LBlock in ABlocks do - begin - if not(LBlock.FInitialized) then - begin - raise EArgumentNilHashLibException.CreateRes - (@SBlockInstanceNotInitialized); - end; - end; + Result := Default(TBlock); + System.SetLength(Result.FV, Size); + Result.FInitialized := True; end; procedure TPBKDF_Argon2NotBuildInAdapter.TBlock.CopyBlock(const AOther: TBlock); begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self, AOther)); - Fv := System.Copy(AOther.Fv); +{$IFDEF DEBUG} + System.Assert(FInitialized and AOther.FInitialized, SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + FV := System.Copy(AOther.FV); end; procedure TPBKDF_Argon2NotBuildInAdapter.TBlock.&Xor(const AB1, AB2: TBlock); var LIdx: Int32; begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self, - AB1, AB2)); - for LIdx := 0 to System.Pred(SIZE) do +{$IFDEF DEBUG} + System.Assert(FInitialized and AB1.FInitialized and AB2.FInitialized, + SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + for LIdx := 0 to System.Pred(Size) do begin - Fv[LIdx] := AB1.Fv[LIdx] xor AB2.Fv[LIdx]; + FV[LIdx] := AB1.FV[LIdx] xor AB2.FV[LIdx]; end; end; @@ -431,18 +421,22 @@ procedure TPBKDF_Argon2NotBuildInAdapter.TBlock.XorWith(const AOther: TBlock); var LIdx: Int32; begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self, AOther)); - for LIdx := 0 to System.Pred(System.Length(Fv)) do +{$IFDEF DEBUG} + System.Assert(FInitialized and AOther.FInitialized, SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + for LIdx := 0 to System.Pred(System.Length(FV)) do begin - Fv[LIdx] := Fv[LIdx] xor AOther.Fv[LIdx]; + FV[LIdx] := FV[LIdx] xor AOther.FV[LIdx]; end; end; function TPBKDF_Argon2NotBuildInAdapter.TBlock.Clear; begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self)); - TArrayUtils.ZeroFill(Fv); - result := Self; +{$IFDEF DEBUG} + System.Assert(FInitialized, SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + TArrayUtils.ZeroFill(FV); + Result := Self; end; procedure TPBKDF_Argon2NotBuildInAdapter.TBlock.&Xor(const AB1, AB2, @@ -450,11 +444,13 @@ procedure TPBKDF_Argon2NotBuildInAdapter.TBlock.&Xor(const AB1, AB2, var LIdx: Int32; begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self, AB1, - AB2, AB3)); - for LIdx := 0 to System.Pred(SIZE) do +{$IFDEF DEBUG} + System.Assert(FInitialized and AB1.FInitialized and AB2.FInitialized + and AB3.FInitialized, SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + for LIdx := 0 to System.Pred(Size) do begin - Fv[LIdx] := AB1.Fv[LIdx] xor AB2.Fv[LIdx] xor AB3.Fv[LIdx]; + FV[LIdx] := AB1.FV[LIdx] xor AB2.FV[LIdx] xor AB3.FV[LIdx]; end; end; @@ -464,16 +460,18 @@ procedure TPBKDF_Argon2NotBuildInAdapter.TBlock.FromBytes LIdx: Int32; LPtrInput: PByte; begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self)); - if (System.Length(AInput) <> ARGON2_BLOCK_SIZE) then +{$IFDEF DEBUG} + System.Assert(FInitialized, SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + if (System.Length(AInput) <> Argon2BlockSize) then begin raise EArgumentHashLibException.CreateResFmt(@SInputLengthInvalid, - [System.Length(AInput), ARGON2_BLOCK_SIZE]); + [System.Length(AInput), Argon2BlockSize]); end; LPtrInput := PByte(AInput); - for LIdx := 0 to System.Pred(SIZE) do + for LIdx := 0 to System.Pred(Size) do begin - Fv[LIdx] := TConverters.ReadBytesAsUInt64LE(LPtrInput, LIdx * 8); + FV[LIdx] := TConverters.ReadBytesAsUInt64LE(LPtrInput, LIdx * 8); end; end; @@ -481,11 +479,13 @@ function TPBKDF_Argon2NotBuildInAdapter.TBlock.ToBytes: THashLibByteArray; var LIdx: Int32; begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self)); - System.SetLength(result, ARGON2_BLOCK_SIZE); - for LIdx := 0 to System.Pred(SIZE) do +{$IFDEF DEBUG} + System.Assert(FInitialized, SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + System.SetLength(Result, Argon2BlockSize); + for LIdx := 0 to System.Pred(Size) do begin - TConverters.ReadUInt64AsBytesLE(Fv[LIdx], result, LIdx * 8); + TConverters.ReadUInt64AsBytesLE(FV[LIdx], Result, LIdx * 8); end; end; @@ -493,12 +493,14 @@ function TPBKDF_Argon2NotBuildInAdapter.TBlock.ToString: String; var LIdx: Int32; begin - CheckAreBlocksInitialized(THashLibGenericArray.Create(Self)); - result := ''; - for LIdx := 0 to System.Pred(SIZE) do +{$IFDEF DEBUG} + System.Assert(FInitialized, SBlockInstanceNotInitialized); +{$ENDIF DEBUG} + Result := ''; + for LIdx := 0 to System.Pred(Size) do begin - result := result + TConverters.ConvertBytesToHexString - (TConverters.ReadUInt64AsBytesLE(Fv[LIdx]), False); + Result := Result + TConverters.ConvertBytesToHexString + (TConverters.ReadUInt64AsBytesLE(FV[LIdx]), False); end; end; @@ -507,7 +509,7 @@ function TPBKDF_Argon2NotBuildInAdapter.TBlock.ToString: String; class function TPBKDF_Argon2NotBuildInAdapter.TPosition.CreatePosition() : TPosition; begin - result := Default(TPosition); + Result := Default(TPosition); end; procedure TPBKDF_Argon2NotBuildInAdapter.TPosition.Update(APass, ALane, ASlice, @@ -522,124 +524,128 @@ procedure TPBKDF_Argon2NotBuildInAdapter.TPosition.Update(APass, ALane, ASlice, { TPBKDF_Argon2NotBuildInAdapter.TFillBlock } class procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.FBlaMka - (var ABlock: TBlock; Ax, Ay: Int32); + (var ABlock: TBlock; AIndexX, AIndexY: Int32); var - Lm: UInt32; - Lxy: UInt64; + LLowWordMask: UInt32; + LProduct64: UInt64; begin - Lm := $FFFFFFFF; - Lxy := (ABlock.Fv[Ax] and Lm) * (ABlock.Fv[Ay] and Lm); + LLowWordMask := $FFFFFFFF; + LProduct64 := (ABlock.FV[AIndexX] and LLowWordMask) * + (ABlock.FV[AIndexY] and LLowWordMask); - ABlock.Fv[Ax] := ABlock.Fv[Ax] + ABlock.Fv[Ay] + (2 * Lxy); + ABlock.FV[AIndexX] := ABlock.FV[AIndexX] + ABlock.FV[AIndexY] + + (2 * LProduct64); end; class procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.Rotr64 - (var ABlock: TBlock; Av, Aw, Ac: Int32); + (var ABlock: TBlock; AIndexV, AIndexW, ARotateCount: Int32); var LTemp: UInt64; begin - LTemp := ABlock.Fv[Av] xor ABlock.Fv[Aw]; - ABlock.Fv[Av] := TBits.RotateRight64(LTemp, Ac); + LTemp := ABlock.FV[AIndexV] xor ABlock.FV[AIndexW]; + ABlock.FV[AIndexV] := TBits.RotateRight64(LTemp, ARotateCount); end; -class procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.F(var ABlock: TBlock; - Aa, Ab, Ac, Ad: Int32); +class procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.QuarterRound(var ABlock: TBlock; + AWordIndexA, AWordIndexB, AWordIndexC, AWordIndexD: Int32); begin - FBlaMka(ABlock, Aa, Ab); - Rotr64(ABlock, Ad, Aa, 32); + FBlaMka(ABlock, AWordIndexA, AWordIndexB); + Rotr64(ABlock, AWordIndexD, AWordIndexA, 32); - FBlaMka(ABlock, Ac, Ad); - Rotr64(ABlock, Ab, Ac, 24); + FBlaMka(ABlock, AWordIndexC, AWordIndexD); + Rotr64(ABlock, AWordIndexB, AWordIndexC, 24); - FBlaMka(ABlock, Aa, Ab); - Rotr64(ABlock, Ad, Aa, 16); + FBlaMka(ABlock, AWordIndexA, AWordIndexB); + Rotr64(ABlock, AWordIndexD, AWordIndexA, 16); - FBlaMka(ABlock, Ac, Ad); - Rotr64(ABlock, Ab, Ac, 63); + FBlaMka(ABlock, AWordIndexC, AWordIndexD); + Rotr64(ABlock, AWordIndexB, AWordIndexC, 63); end; class procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.RoundFunction - (var ABlock: TBlock; Av0, Av1, Av2, Av3, Av4, Av5, Av6, Av7, Av8, Av9, Av10, - Av11, Av12, Av13, Av14, Av15: Int32); + (var ABlock: TBlock; ABlockWord0, ABlockWord1, ABlockWord2, ABlockWord3, + ABlockWord4, ABlockWord5, ABlockWord6, ABlockWord7, ABlockWord8, + ABlockWord9, ABlockWord10, ABlockWord11, ABlockWord12, ABlockWord13, + ABlockWord14, ABlockWord15: Int32); begin - F(ABlock, Av0, Av4, Av8, Av12); - F(ABlock, Av1, Av5, Av9, Av13); - F(ABlock, Av2, Av6, Av10, Av14); - F(ABlock, Av3, Av7, Av11, Av15); + QuarterRound(ABlock, ABlockWord0, ABlockWord4, ABlockWord8, ABlockWord12); + QuarterRound(ABlock, ABlockWord1, ABlockWord5, ABlockWord9, ABlockWord13); + QuarterRound(ABlock, ABlockWord2, ABlockWord6, ABlockWord10, ABlockWord14); + QuarterRound(ABlock, ABlockWord3, ABlockWord7, ABlockWord11, ABlockWord15); - F(ABlock, Av0, Av5, Av10, Av15); - F(ABlock, Av1, Av6, Av11, Av12); - F(ABlock, Av2, Av7, Av8, Av13); - F(ABlock, Av3, Av4, Av9, Av14); + QuarterRound(ABlock, ABlockWord0, ABlockWord5, ABlockWord10, ABlockWord15); + QuarterRound(ABlock, ABlockWord1, ABlockWord6, ABlockWord11, ABlockWord12); + QuarterRound(ABlock, ABlockWord2, ABlockWord7, ABlockWord8, ABlockWord13); + QuarterRound(ABlock, ABlockWord3, ABlockWord4, ABlockWord9, ABlockWord14); end; function TPBKDF_Argon2NotBuildInAdapter.TFillBlock.GetAddressBlock: TBlock; begin - result := FAddressBlock; + Result := FAddressBlock; end; function TPBKDF_Argon2NotBuildInAdapter.TFillBlock.GetInputBlock: TBlock; begin - result := FInputBlock; + Result := FInputBlock; end; function TPBKDF_Argon2NotBuildInAdapter.TFillBlock.GetR: TBlock; begin - result := FR; + Result := FR; end; function TPBKDF_Argon2NotBuildInAdapter.TFillBlock.GetZ: TBlock; begin - result := FZ; + Result := FZ; end; function TPBKDF_Argon2NotBuildInAdapter.TFillBlock.GetZeroBlock: TBlock; begin - result := FZeroBlock; + Result := FZeroBlock; end; procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.ApplyBlake(); var - Li, Li16, Li2: Int32; + LRoundIdx, LColBase, LRowBase: Int32; begin (* Apply Blake2 on columns of 64-bit words: (0,1,...,15) , then (16,17,..31)... finally (112,113,...127) *) - for Li := 0 to System.Pred(8) do + for LRoundIdx := 0 to System.Pred(8) do begin - Li16 := 16 * Li; - RoundFunction(FZ, Li16, Li16 + 1, Li16 + 2, Li16 + 3, Li16 + 4, Li16 + 5, - Li16 + 6, Li16 + 7, Li16 + 8, Li16 + 9, Li16 + 10, Li16 + 11, Li16 + 12, - Li16 + 13, Li16 + 14, Li16 + 15); + LColBase := 16 * LRoundIdx; + RoundFunction(FZ, LColBase, LColBase + 1, LColBase + 2, LColBase + 3, LColBase + 4, LColBase + 5, + LColBase + 6, LColBase + 7, LColBase + 8, LColBase + 9, LColBase + 10, LColBase + 11, LColBase + 12, + LColBase + 13, LColBase + 14, LColBase + 15); end; (* Apply Blake2 on rows of 64-bit words: (0,1,16,17,...112,113), then (2,3,18,19,...,114,115).. finally (14,15,30,31,...,126,127) *) - for Li := 0 to System.Pred(8) do + for LRoundIdx := 0 to System.Pred(8) do begin - Li2 := 2 * Li; - RoundFunction(FZ, Li2, Li2 + 1, Li2 + 16, Li2 + 17, Li2 + 32, Li2 + 33, - Li2 + 48, Li2 + 49, Li2 + 64, Li2 + 65, Li2 + 80, Li2 + 81, Li2 + 96, - Li2 + 97, Li2 + 112, Li2 + 113); + LRowBase := 2 * LRoundIdx; + RoundFunction(FZ, LRowBase, LRowBase + 1, LRowBase + 16, LRowBase + 17, LRowBase + 32, LRowBase + 33, + LRowBase + 48, LRowBase + 49, LRowBase + 64, LRowBase + 65, LRowBase + 80, LRowBase + 81, LRowBase + 96, + LRowBase + 97, LRowBase + 112, LRowBase + 113); end; end; class function TPBKDF_Argon2NotBuildInAdapter.TFillBlock.CreateFillBlock : TFillBlock; begin - result := Default(TFillBlock); - result.FR := TBlock.CreateBlock(); - result.FZ := TBlock.CreateBlock(); - result.FAddressBlock := TBlock.CreateBlock(); - result.FZeroBlock := TBlock.CreateBlock(); - result.FInputBlock := TBlock.CreateBlock(); + Result := Default(TFillBlock); + Result.FR := TBlock.CreateBlock(); + Result.FZ := TBlock.CreateBlock(); + Result.FAddressBlock := TBlock.CreateBlock(); + Result.FZeroBlock := TBlock.CreateBlock(); + Result.FInputBlock := TBlock.CreateBlock(); end; -procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.FillBlock(var Ax, Ay, - ACurrentBlock: TBlock; AWithXor: Boolean); +procedure TPBKDF_Argon2NotBuildInAdapter.TFillBlock.FillBlock(var ALeftBlock, + ARightBlock, ACurrentBlock: TBlock; AWithXor: Boolean); begin - R.&Xor(Ax, Ay); + R.&Xor(ALeftBlock, ARightBlock); FZ.CopyBlock(R); ApplyBlake(); @@ -660,7 +666,7 @@ constructor TArgon2ParametersBuilder.TArgon2Parameters.Create (AType: TArgon2Type; const ASalt, ASecret, AAdditional: THashLibByteArray; AIterations, AMemory, ALanes: Int32; AVersion: TArgon2Version); begin - Inherited Create(); + inherited Create(); FSalt := System.Copy(ASalt); FSecret := System.Copy(ASecret); FAdditional := System.Copy(AAdditional); @@ -673,44 +679,44 @@ constructor TArgon2ParametersBuilder.TArgon2Parameters.Create function TArgon2ParametersBuilder.TArgon2Parameters.GetSalt: THashLibByteArray; begin - result := System.Copy(FSalt); + Result := System.Copy(FSalt); end; function TArgon2ParametersBuilder.TArgon2Parameters.GetSecret : THashLibByteArray; begin - result := System.Copy(FSecret); + Result := System.Copy(FSecret); end; function TArgon2ParametersBuilder.TArgon2Parameters.GetAdditional : THashLibByteArray; begin - result := System.Copy(FAdditional); + Result := System.Copy(FAdditional); end; function TArgon2ParametersBuilder.TArgon2Parameters.GetIterations: Int32; begin - result := FIterations; + Result := FIterations; end; function TArgon2ParametersBuilder.TArgon2Parameters.GetMemory: Int32; begin - result := FMemory; + Result := FMemory; end; function TArgon2ParametersBuilder.TArgon2Parameters.GetLanes: Int32; begin - result := FLanes; + Result := FLanes; end; function TArgon2ParametersBuilder.TArgon2Parameters.GetVersion: TArgon2Version; begin - result := FVersion; + Result := FVersion; end; function TArgon2ParametersBuilder.TArgon2Parameters.GetType: TArgon2Type; begin - result := FType; + Result := FType; end; procedure TArgon2ParametersBuilder.TArgon2Parameters.Clear(); @@ -724,12 +730,12 @@ procedure TArgon2ParametersBuilder.TArgon2Parameters.Clear(); constructor TArgon2ParametersBuilder.Create(AType: TArgon2Type); begin - Inherited Create(); - FLanes := DEFAULT_LANES; - FMemory := 1 shl DEFAULT_MEMORY_COST; - FIterations := DEFAULT_ITERATIONS; + inherited Create(); + FLanes := DefaultLanes; + FMemory := 1 shl DefaultMemoryCost; + FIterations := DefaultIterations; FType := AType; - FVersion := DEFAULT_VERSION; + FVersion := DefaultVersion; end; destructor TArgon2ParametersBuilder.Destroy; @@ -742,61 +748,61 @@ function TArgon2ParametersBuilder.WithAdditional(const AAdditional : THashLibByteArray): IArgon2ParametersBuilder; begin FAdditional := System.Copy(AAdditional); - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.WithIterations(AIterations: Int32) : IArgon2ParametersBuilder; begin FIterations := AIterations; - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.WithMemoryAsKB(AMemory: Int32) : IArgon2ParametersBuilder; begin FMemory := AMemory; - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.WithMemoryPowOfTwo(AMemory: Int32) : IArgon2ParametersBuilder; begin FMemory := 1 shl AMemory; - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.WithParallelism(AParallelism: Int32) : IArgon2ParametersBuilder; begin FLanes := AParallelism; - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.WithSalt(const ASalt: THashLibByteArray) : IArgon2ParametersBuilder; begin FSalt := System.Copy(ASalt); - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.WithSecret(const ASecret: THashLibByteArray) : IArgon2ParametersBuilder; begin FSecret := System.Copy(ASecret); - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.WithVersion(AVersion: TArgon2Version) : IArgon2ParametersBuilder; begin FVersion := AVersion; - result := Self as IArgon2ParametersBuilder; + Result := Self; end; function TArgon2ParametersBuilder.Build(): IArgon2Parameters; begin - result := TArgon2Parameters.Create(FType, FSalt, FSecret, FAdditional, + Result := TArgon2Parameters.Create(FType, FSalt, FSecret, FAdditional, FIterations, FMemory, FLanes, FVersion); end; @@ -811,36 +817,36 @@ procedure TArgon2ParametersBuilder.Clear(); constructor TArgon2iParametersBuilder.Create; begin - Inherited Create(TArgon2Type.a2tARGON2_i); + inherited Create(TArgon2Type.a2tARGON2_i); end; class function TArgon2iParametersBuilder.Builder: IArgon2ParametersBuilder; begin - result := TArgon2iParametersBuilder.Create() as IArgon2ParametersBuilder; + Result := TArgon2iParametersBuilder.Create(); end; { TArgon2dParametersBuilder } constructor TArgon2dParametersBuilder.Create; begin - Inherited Create(TArgon2Type.a2tARGON2_d); + inherited Create(TArgon2Type.a2tARGON2_d); end; class function TArgon2dParametersBuilder.Builder: IArgon2ParametersBuilder; begin - result := TArgon2dParametersBuilder.Create() as IArgon2ParametersBuilder; + Result := TArgon2dParametersBuilder.Create(); end; { TArgon2idParametersBuilder } constructor TArgon2idParametersBuilder.Create; begin - Inherited Create(TArgon2Type.a2tARGON2_id); + inherited Create(TArgon2Type.a2tARGON2_id); end; class function TArgon2idParametersBuilder.Builder: IArgon2ParametersBuilder; begin - result := TArgon2idParametersBuilder.Create() as IArgon2ParametersBuilder; + Result := TArgon2idParametersBuilder.Create(); end; { TPBKDF_Argon2NotBuildInAdapter } @@ -856,15 +862,15 @@ class procedure TPBKDF_Argon2NotBuildInAdapter.ValidatePBKDF_Argon2Inputs end; class procedure TPBKDF_Argon2NotBuildInAdapter.AddIntToLittleEndian - (const AHash: IHash; An: Int32); + (const AHash: IHash; AInt32Value: Int32); begin - AHash.TransformBytes(TConverters.ReadUInt32AsBytesLE(UInt32(An))); + AHash.TransformBytes(TConverters.ReadUInt32AsBytesLE(UInt32(AInt32Value))); end; class procedure TPBKDF_Argon2NotBuildInAdapter.AddByteString(const AHash: IHash; const AOctets: THashLibByteArray); begin - if (AOctets <> Nil) then + if (AOctets <> nil) then begin AddIntToLittleEndian(AHash, System.Length(AOctets)); AHash.TransformBytes(AOctets, 0, System.Length(AOctets)); @@ -878,8 +884,8 @@ class procedure TPBKDF_Argon2NotBuildInAdapter.AddByteString(const AHash: IHash; class function TPBKDF_Argon2NotBuildInAdapter.MakeBlake2BInstanceAndInitialize (AHashSize: Int32): IHash; begin - result := TBlake2B.Create(TBlake2BConfig.Create(AHashSize) as IBlake2BConfig); - result.Initialize; + Result := TBlake2B.Create(TBlake2BConfig.Create(AHashSize) as IBlake2BConfig); + Result.Initialize; end; class function TPBKDF_Argon2NotBuildInAdapter.GetStartingIndex(const APosition @@ -888,11 +894,11 @@ class function TPBKDF_Argon2NotBuildInAdapter.GetStartingIndex(const APosition if ((APosition.FPass = 0) and (APosition.FSlice = 0)) then begin // we have already generated the first two blocks - result := 2; + Result := 2; end else begin - result := 0; + Result := 0; end; end; @@ -916,16 +922,16 @@ procedure TPBKDF_Argon2NotBuildInAdapter.DoInit(const AParameters // Minimum memoryBlocks = 8L blocks, where L is the number of lanes */ LMemoryBlocks := AParameters.Memory; - if (LMemoryBlocks < (2 * ARGON2_SYNC_POINTS * AParameters.Lanes)) then + if (LMemoryBlocks < (2 * Argon2SyncPoints * AParameters.Lanes)) then begin - LMemoryBlocks := 2 * ARGON2_SYNC_POINTS * AParameters.Lanes; + LMemoryBlocks := 2 * Argon2SyncPoints * AParameters.Lanes; end; - FSegmentLength := LMemoryBlocks div (FParameters.Lanes * ARGON2_SYNC_POINTS); - FLaneLength := FSegmentLength * ARGON2_SYNC_POINTS; + FSegmentLength := LMemoryBlocks div (FParameters.Lanes * Argon2SyncPoints); + FLaneLength := FSegmentLength * Argon2SyncPoints; // Ensure that all segments have equal length - LMemoryBlocks := FSegmentLength * (AParameters.Lanes * ARGON2_SYNC_POINTS); + LMemoryBlocks := FSegmentLength * (AParameters.Lanes * Argon2SyncPoints); InitializeMemory(LMemoryBlocks); end; @@ -940,7 +946,7 @@ procedure TPBKDF_Argon2NotBuildInAdapter.Reset; FMemory[LIdx].Clear; FMemory[LIdx] := Default(TBlock); end; - FMemory := Nil; + FMemory := nil; TArrayUtils.ZeroFill(FResult); end; @@ -950,7 +956,7 @@ function TPBKDF_Argon2NotBuildInAdapter.InitialHash(const AParameters var LBlake2B: IHash; begin - LBlake2B := MakeBlake2BInstanceAndInitialize(ARGON2_PREHASH_DIGEST_LENGTH); + LBlake2B := MakeBlake2BInstanceAndInitialize(Argon2PrehashDigestLength); AddIntToLittleEndian(LBlake2B, AParameters.Lanes); AddIntToLittleEndian(LBlake2B, AOutputLength); @@ -964,16 +970,16 @@ function TPBKDF_Argon2NotBuildInAdapter.InitialHash(const AParameters AddByteString(LBlake2B, AParameters.Secret); AddByteString(LBlake2B, AParameters.Additional); - result := LBlake2B.TransformFinal.GetBytes(); + Result := LBlake2B.TransformFinal.GetBytes(); end; function TPBKDF_Argon2NotBuildInAdapter.GetInitialHashLong(const AInitialHash, AAppendix: THashLibByteArray): THashLibByteArray; begin - System.SetLength(result, ARGON2_PREHASH_SEED_LENGTH); - System.Move(AInitialHash[0], result[0], ARGON2_PREHASH_DIGEST_LENGTH * + System.SetLength(Result, Argon2PrehashSeedLength); + System.Move(AInitialHash[0], Result[0], Argon2PrehashDigestLength * System.SizeOf(Byte)); - System.Move(AAppendix[0], result[ARGON2_PREHASH_DIGEST_LENGTH], + System.Move(AAppendix[0], Result[Argon2PrehashDigestLength], 4 * System.SizeOf(Byte)); end; @@ -981,10 +987,10 @@ function TPBKDF_Argon2NotBuildInAdapter.Hash(const AInput: THashLibByteArray; AOutputLength: Int32): THashLibByteArray; var LOutlenBytes, LOutBuffer: THashLibByteArray; - LBlake2BLength, Lr, LPosition, LIdx, LLastLength: Int32; + LBlake2BLength, LRoundCount, LPosition, LIdx, LLastLength: Int32; LBlake2B: IHash; begin - System.SetLength(result, AOutputLength); + System.SetLength(Result, AOutputLength); LOutlenBytes := TConverters.ReadUInt32AsBytesLE(UInt32(AOutputLength)); LBlake2BLength := 64; @@ -996,7 +1002,7 @@ function TPBKDF_Argon2NotBuildInAdapter.Hash(const AInput: THashLibByteArray; LBlake2B.TransformBytes(LOutlenBytes, 0, System.Length(LOutlenBytes)); LBlake2B.TransformBytes(AInput, 0, System.Length(AInput)); - result := LBlake2B.TransformFinal.GetBytes(); + Result := LBlake2B.TransformFinal.GetBytes(); end else begin @@ -1010,29 +1016,29 @@ function TPBKDF_Argon2NotBuildInAdapter.Hash(const AInput: THashLibByteArray; LBlake2B.TransformBytes(AInput, 0, System.Length(AInput)); LOutBuffer := LBlake2B.TransformFinal.GetBytes(); - System.Move(LOutBuffer[0], result[0], (LBlake2BLength div 2) * + System.Move(LOutBuffer[0], Result[0], (LBlake2BLength div 2) * System.SizeOf(Byte)); - Lr := ((AOutputLength + 31) div 32) - 2; + LRoundCount := ((AOutputLength + 31) div 32) - 2; LPosition := LBlake2BLength div 2; LIdx := 2; - while LIdx <= Lr do + while LIdx <= LRoundCount do begin // V2 to Vr LBlake2B.TransformBytes(LOutBuffer, 0, System.Length(LOutBuffer)); LOutBuffer := LBlake2B.TransformFinal.GetBytes(); - System.Move(LOutBuffer[0], result[LPosition], (LBlake2BLength div 2) * + System.Move(LOutBuffer[0], Result[LPosition], (LBlake2BLength div 2) * System.SizeOf(Byte)); System.Inc(LIdx); LPosition := LPosition + (LBlake2BLength div 2); end; - LLastLength := AOutputLength - (32 * Lr); + LLastLength := AOutputLength - (32 * LRoundCount); // Vr+1 @@ -1040,32 +1046,32 @@ function TPBKDF_Argon2NotBuildInAdapter.Hash(const AInput: THashLibByteArray; LBlake2B.TransformBytes(LOutBuffer, 0, System.Length(LOutBuffer)); LOutBuffer := LBlake2B.TransformFinal.GetBytes(); - System.Move(LOutBuffer[0], result[LPosition], + System.Move(LOutBuffer[0], Result[LPosition], LLastLength * System.SizeOf(Byte)); end; {$IFDEF DEBUG} - System.Assert(System.Length(result) = AOutputLength); + System.Assert(System.Length(Result) = AOutputLength); {$ENDIF DEBUG} end; procedure TPBKDF_Argon2NotBuildInAdapter.Digest(AOutputLength: Int32); var LIdx, LLastBlockInLane: Int32; - FFinalBlockBytes: THashLibByteArray; - FFinalBlock: TBlock; + LFinalBlockBytes: THashLibByteArray; + LFinalBlock: TBlock; begin - FFinalBlock := FMemory[FLaneLength - 1]; + LFinalBlock := FMemory[FLaneLength - 1]; // XOR the last blocks for LIdx := 1 to System.Pred(FParameters.Lanes) do begin LLastBlockInLane := (LIdx * FLaneLength) + (FLaneLength - 1); - FFinalBlock.XorWith(FMemory[LLastBlockInLane]); + LFinalBlock.XorWith(FMemory[LLastBlockInLane]); end; - FFinalBlockBytes := FFinalBlock.ToBytes(); + LFinalBlockBytes := LFinalBlock.ToBytes(); - FResult := Hash(FFinalBlockBytes, AOutputLength); + FResult := Hash(LFinalBlockBytes, AOutputLength); end; procedure TPBKDF_Argon2NotBuildInAdapter.FillFirstBlocks(const AInitialHash @@ -1085,14 +1091,14 @@ procedure TPBKDF_Argon2NotBuildInAdapter.FillFirstBlocks(const AInitialHash for LIdx := 0 to System.Pred(FParameters.Lanes) do begin TConverters.ReadUInt32AsBytesLE(UInt32(LIdx), LInitialHashWithZeros, - ARGON2_PREHASH_DIGEST_LENGTH + 4); + Argon2PrehashDigestLength + 4); TConverters.ReadUInt32AsBytesLE(UInt32(LIdx), LInitialHashWithOnes, - ARGON2_PREHASH_DIGEST_LENGTH + 4); + Argon2PrehashDigestLength + 4); - LBlockHashBytes := Hash(LInitialHashWithZeros, ARGON2_BLOCK_SIZE); + LBlockHashBytes := Hash(LInitialHashWithZeros, Argon2BlockSize); FMemory[LIdx * FLaneLength].FromBytes(LBlockHashBytes); - LBlockHashBytes := Hash(LInitialHashWithOnes, ARGON2_BLOCK_SIZE); + LBlockHashBytes := Hash(LInitialHashWithOnes, Argon2BlockSize); FMemory[(LIdx * FLaneLength) + 1].FromBytes(LBlockHashBytes); end; end; @@ -1100,34 +1106,34 @@ procedure TPBKDF_Argon2NotBuildInAdapter.FillFirstBlocks(const AInitialHash function TPBKDF_Argon2NotBuildInAdapter.IsDataIndependentAddressing (const APosition: TPosition): Boolean; begin - result := (FParameters.&Type = TArgon2Type.a2tARGON2_i) or + Result := (FParameters.&Type = TArgon2Type.a2tARGON2_i) or ((FParameters.&Type = TArgon2Type.a2tARGON2_id) and (APosition.FPass = 0) - and (APosition.FSlice < (ARGON2_SYNC_POINTS div 2))); + and (APosition.FSlice < (Argon2SyncPoints div 2))); end; procedure TPBKDF_Argon2NotBuildInAdapter.NextAddresses(const AFiller : TFillBlock; var AZeroBlock, AInputBlock, AAddressBlock: TBlock); begin - System.Inc(AInputBlock.Fv[6]); + System.Inc(AInputBlock.FV[6]); AFiller.FillBlock(AZeroBlock, AInputBlock, AAddressBlock, False); AFiller.FillBlock(AZeroBlock, AAddressBlock, AAddressBlock, False); end; -function TPBKDF_Argon2NotBuildInAdapter.IntToUInt64(Ax: Int32): UInt64; +function TPBKDF_Argon2NotBuildInAdapter.IntToUInt64(AValue: Int32): UInt64; begin - result := UInt64((Ax and UInt32($FFFFFFFF))) + Result := UInt64((AValue and UInt32($FFFFFFFF))) end; procedure TPBKDF_Argon2NotBuildInAdapter.InitAddressBlocks (const AFiller: TFillBlock; const APosition: TPosition; var AZeroBlock, AInputBlock, AAddressBlock: TBlock); begin - AInputBlock.Fv[0] := IntToUInt64(APosition.FPass); - AInputBlock.Fv[1] := IntToUInt64(APosition.FLane); - AInputBlock.Fv[2] := IntToUInt64(APosition.FSlice); - AInputBlock.Fv[3] := IntToUInt64(System.Length(FMemory)); - AInputBlock.Fv[4] := IntToUInt64(FParameters.Iterations); - AInputBlock.Fv[5] := IntToUInt64(Int32(FParameters.&Type)); + AInputBlock.FV[0] := IntToUInt64(APosition.FPass); + AInputBlock.FV[1] := IntToUInt64(APosition.FLane); + AInputBlock.FV[2] := IntToUInt64(APosition.FSlice); + AInputBlock.FV[3] := IntToUInt64(System.Length(FMemory)); + AInputBlock.FV[4] := IntToUInt64(FParameters.Iterations); + AInputBlock.FV[5] := IntToUInt64(Int32(FParameters.&Type)); if ((APosition.FPass = 0) and (APosition.FSlice = 0)) then begin @@ -1143,16 +1149,16 @@ function TPBKDF_Argon2NotBuildInAdapter.GetPseudoRandom(const AFiller begin if (ADataIndependentAddressing) then begin - if (APosition.FIndex mod ARGON2_ADDRESSES_IN_BLOCK = 0) then + if (APosition.FIndex mod Argon2AddressesInBlock = 0) then begin NextAddresses(AFiller, AZeroBlock, AInputBlock, AAddressBlock); end; - result := AAddressBlock.Fv[APosition.FIndex mod ARGON2_ADDRESSES_IN_BLOCK]; + Result := AAddressBlock.FV[APosition.FIndex mod Argon2AddressesInBlock]; Exit; end else begin - result := FMemory[APrevOffset].Fv[0]; + Result := FMemory[APrevOffset].FV[0]; end; end; @@ -1168,7 +1174,7 @@ function TPBKDF_Argon2NotBuildInAdapter.GetRefLane(const APosition: TPosition; // Can not reference other lanes yet LRefLane := APosition.FLane; end; - result := LRefLane; + Result := LRefLane; end; function TPBKDF_Argon2NotBuildInAdapter.GetRefColumn(const APosition: TPosition; @@ -1228,13 +1234,13 @@ function TPBKDF_Argon2NotBuildInAdapter.GetRefColumn(const APosition: TPosition; LRelativePosition := UInt64(LReferenceAreaSize) - 1 - UInt64((UInt64(LReferenceAreaSize) * LRelativePosition) shr 32); - result := Int32(UInt64(LStartPosition) + LRelativePosition) mod FLaneLength; + Result := Int32(UInt64(LStartPosition) + LRelativePosition) mod FLaneLength; end; function TPBKDF_Argon2NotBuildInAdapter.IsWithXor(const APosition : TPosition): Boolean; begin - result := not((APosition.FPass = 0) or + Result := not((APosition.FPass = 0) or (FParameters.Version = TArgon2Version.a2vARGON2_VERSION_10)); end; @@ -1244,13 +1250,13 @@ function TPBKDF_Argon2NotBuildInAdapter.GetPrevOffset(ACurrentOffset if (ACurrentOffset mod FLaneLength = 0) then begin // Last block in this lane - result := ACurrentOffset + FLaneLength - 1; + Result := ACurrentOffset + FLaneLength - 1; Exit; end else begin // Previous block - result := ACurrentOffset - 1; + Result := ACurrentOffset - 1; Exit; end; end; @@ -1262,7 +1268,7 @@ function TPBKDF_Argon2NotBuildInAdapter.RotatePrevOffset(ACurrentOffset, begin APrevOffset := ACurrentOffset - 1; end; - result := APrevOffset; + Result := APrevOffset; end; procedure TPBKDF_Argon2NotBuildInAdapter.Initialize(const APassword @@ -1355,7 +1361,7 @@ procedure TPBKDF_Argon2NotBuildInAdapter.DoParallelFillMemoryBlocks; for LPass := 0 to System.Pred(LIterations) do begin - for LSlice := 0 to System.Pred(ARGON2_SYNC_POINTS) do + for LSlice := 0 to System.Pred(Argon2SyncPoints) do begin LBasePosition := TPosition.CreatePosition(); LBasePosition.Update(LPass, 0, LSlice, 0); @@ -1382,17 +1388,17 @@ procedure TPBKDF_Argon2NotBuildInAdapter.DoParallelFillMemoryBlocks; function TPBKDF_Argon2NotBuildInAdapter.GetBytes(AByteCount: Int32) : THashLibByteArray; begin - if (AByteCount <= MIN_OUTLEN) then + if (AByteCount <= MinOutLen) then begin raise EArgumentHashLibException.CreateResFmt(@SInvalidOutputByteCount, - [MIN_OUTLEN]); + [MinOutLen]); end; Initialize(FPassword, AByteCount); DoParallelFillMemoryBlocks; Digest(AByteCount); - System.SetLength(result, AByteCount); - System.Move(FResult[0], result[0], AByteCount * System.SizeOf(Byte)); + System.SetLength(Result, AByteCount); + System.Move(FResult[0], Result[0], AByteCount * System.SizeOf(Byte)); Reset(); end; @@ -1405,30 +1411,30 @@ procedure TPBKDF_Argon2NotBuildInAdapter.Clear(); constructor TPBKDF_Argon2NotBuildInAdapter.Create(const APassword : THashLibByteArray; const AParameters: IArgon2Parameters); begin - Inherited Create(); + inherited Create(); ValidatePBKDF_Argon2Inputs(AParameters); FPassword := System.Copy(APassword); FParameters := AParameters; - if (FParameters.Lanes < MIN_PARALLELISM) then + if (FParameters.Lanes < MinParallelism) then begin raise EArgumentInvalidHashLibException.CreateResFmt(@SLanesTooSmall, - [MIN_PARALLELISM]); + [MinParallelism]); end - else if (FParameters.Lanes > MAX_PARALLELISM) then + else if (FParameters.Lanes > MaxParallelism) then begin raise EArgumentInvalidHashLibException.CreateResFmt(@SLanesTooBig, - [MAX_PARALLELISM]); + [MaxParallelism]); end else if (FParameters.Memory < (2 * FParameters.Lanes)) then begin raise EArgumentInvalidHashLibException.CreateResFmt(@SMemoryTooSmall, [(2 * FParameters.Lanes), (2 * FParameters.Lanes)]); end - else if (FParameters.Iterations < MIN_ITERATIONS) then + else if (FParameters.Iterations < MinIterations) then begin raise EArgumentInvalidHashLibException.CreateResFmt(@SIterationsTooSmall, - [MIN_ITERATIONS]); + [MinIterations]); end; DoInit(AParameters); diff --git a/HashLib/src/KDF/HlpPBKDF_ScryptNotBuildInAdapter.pas b/HashLib/src/KDF/HlpPBKDF_ScryptNotBuildInAdapter.pas index be2c1291..0bc75f81 100644 --- a/HashLib/src/KDF/HlpPBKDF_ScryptNotBuildInAdapter.pas +++ b/HashLib/src/KDF/HlpPBKDF_ScryptNotBuildInAdapter.pas @@ -43,50 +43,27 @@ TPBKDF_ScryptNotBuildInAdapter = class sealed(TKDF, IPBKDF_Scrypt, FPasswordBytes, FSaltBytes: THashLibByteArray; FCost, FBlockSize, FParallelism: Int32; - class procedure ClearArray(const AInput: THashLibByteArray); overload; - static; inline; - class procedure ClearArray(const AInput: THashLibUInt32Array); overload; - static; inline; - - class procedure ClearAllArrays(const AInputs - : THashLibMatrixUInt32Array); static; - - class function IsPowerOf2(Ax: Int32): Boolean; static; inline; + class function IsPowerOf2(AValue: Int32): Boolean; static; inline; class function SingleIterationPBKDF2(const APasswordBytes, ASaltBytes: THashLibByteArray; AOutputLength: Int32) : THashLibByteArray; static; - /// - /// Rotate left - /// - /// - /// value to rotate - /// - /// - /// distance to rotate AValue - /// - /// - /// rotated AValue - /// - class function Rotl(AValue: UInt32; ADistance: Int32): UInt32; - static; inline; - /// /// lifted from ClpSalsa20Engine.pas in CryptoLib4Pascal with /// minor modifications. /// class procedure SalsaCore(ARounds: Int32; - const AInput, Ax: THashLibUInt32Array); static; + const AInput, AOutWords: THashLibUInt32Array); static; - class procedure &Xor(const Aa, Ab: THashLibUInt32Array; AbOff: Int32; - const AOutput: THashLibUInt32Array); static; + class procedure &Xor(const ALeftWords, ARightWords: THashLibUInt32Array; + ARightWordOffset: Int32; const AOutput: THashLibUInt32Array); static; class procedure SMixLane(AIdx: Int32; APtrB: PCardinal; ACost, ABlockSize: Int32); static; - class procedure BlockMix(const Ab, AX1, AX2, Ay: THashLibUInt32Array; - AR: Int32); static; + class procedure BlockMix(const ASourceBlock, AScratchX1, AScratchX2, + AMixedOut: THashLibUInt32Array; ABlockSize: Int32); static; class procedure DoParallelSMix(APtrB: PCardinal; AParallelism, ACost, ABlockSize: Int32); static; @@ -95,8 +72,6 @@ TPBKDF_ScryptNotBuildInAdapter = class sealed(TKDF, IPBKDF_Scrypt, ACost, ABlockSize, AParallelism, AOutputLength: Int32) : THashLibByteArray; static; - public - /// /// Validates Scrypt input parameters. /// @@ -128,6 +103,8 @@ TPBKDF_ScryptNotBuildInAdapter = class sealed(TKDF, IPBKDF_Scrypt, class procedure ValidatePBKDF_ScryptInputs(ACost, ABlockSize, AParallelism: Int32; ARelaxCostRestriction: Boolean = False); static; + public + constructor Create(const APasswordBytes, ASaltBytes: THashLibByteArray; ACost, ABlockSize, AParallelism: Int32; ARelaxCostRestriction: Boolean = False); @@ -150,180 +127,153 @@ implementation { TPBKDF_ScryptNotBuildInAdapter } -class procedure TPBKDF_ScryptNotBuildInAdapter.ClearArray - (const AInput: THashLibByteArray); -begin - TArrayUtils.ZeroFill(AInput); -end; - -class procedure TPBKDF_ScryptNotBuildInAdapter.ClearArray - (const AInput: THashLibUInt32Array); +class function TPBKDF_ScryptNotBuildInAdapter.IsPowerOf2(AValue: Int32): Boolean; begin - TArrayUtils.ZeroFill(AInput); -end; - -class procedure TPBKDF_ScryptNotBuildInAdapter.ClearAllArrays - (const AInputs: THashLibMatrixUInt32Array); -var - LIdx: Int32; -begin - for LIdx := System.Low(AInputs) to System.High(AInputs) do - begin - ClearArray(AInputs[LIdx]); - end; -end; - -class function TPBKDF_ScryptNotBuildInAdapter.IsPowerOf2(Ax: Int32): Boolean; -begin - result := (Ax > 0) and ((Ax and (Ax - 1)) = 0); + Result := (AValue > 0) and ((AValue and (AValue - 1)) = 0); end; class function TPBKDF_ScryptNotBuildInAdapter.SingleIterationPBKDF2 (const APasswordBytes, ASaltBytes: THashLibByteArray; AOutputLength: Int32) : THashLibByteArray; begin - result := (TPBKDF2_HMACNotBuildInAdapter.Create(TSHA2_256.Create() as IHash, + Result := (TPBKDF2_HMACNotBuildInAdapter.Create(TSHA2_256.Create() as IHash, APasswordBytes, ASaltBytes, 1) as IPBKDF2_HMAC).GetBytes(AOutputLength); end; -class procedure TPBKDF_ScryptNotBuildInAdapter.&Xor(const Aa, - Ab: THashLibUInt32Array; AbOff: Int32; const AOutput: THashLibUInt32Array); +class procedure TPBKDF_ScryptNotBuildInAdapter.&Xor(const ALeftWords, + ARightWords: THashLibUInt32Array; ARightWordOffset: Int32; + const AOutput: THashLibUInt32Array); var LIdx: Int32; begin LIdx := System.Length(AOutput) - 1; while LIdx >= 0 do begin - AOutput[LIdx] := Aa[LIdx] xor Ab[AbOff + LIdx]; + AOutput[LIdx] := ALeftWords[LIdx] xor ARightWords[ARightWordOffset + LIdx]; System.Dec(LIdx); end; end; -class function TPBKDF_ScryptNotBuildInAdapter.Rotl(AValue: UInt32; - ADistance: Int32): UInt32; -begin - result := TBits.RotateLeft32(AValue, ADistance); -end; - class procedure TPBKDF_ScryptNotBuildInAdapter.SalsaCore(ARounds: Int32; - const AInput, Ax: THashLibUInt32Array); + const AInput, AOutWords: THashLibUInt32Array); var - x00, x01, x02, x03, x04, x05, x06, x07, x08, x09, x10, x11, x12, x13, x14, - x15: UInt32; + LWord0, LWord1, LWord2, LWord3, LWord4, LWord5, LWord6, LWord7, LWord8, LWord9, LWord10, LWord11, LWord12, LWord13, LWord14, + LWord15: UInt32; LIdx: Int32; begin if (System.Length(AInput) <> 16) then begin - raise EArgumentHashLibException.Create(''); + raise EArgumentHashLibException.Create('AInput length must be 16'); end; - if (System.Length(Ax) <> 16) then + if (System.Length(AOutWords) <> 16) then begin - raise EArgumentHashLibException.Create(''); + raise EArgumentHashLibException.Create('AOutWords length must be 16'); end; if ((ARounds mod 2) <> 0) then begin raise EArgumentHashLibException.CreateRes(@SRoundsMustBeEven); end; - x00 := AInput[0]; - x01 := AInput[1]; - x02 := AInput[2]; - x03 := AInput[3]; - x04 := AInput[4]; - x05 := AInput[5]; - x06 := AInput[6]; - x07 := AInput[7]; - x08 := AInput[8]; - x09 := AInput[9]; - x10 := AInput[10]; - x11 := AInput[11]; - x12 := AInput[12]; - x13 := AInput[13]; - x14 := AInput[14]; - x15 := AInput[15]; + LWord0 := AInput[0]; + LWord1 := AInput[1]; + LWord2 := AInput[2]; + LWord3 := AInput[3]; + LWord4 := AInput[4]; + LWord5 := AInput[5]; + LWord6 := AInput[6]; + LWord7 := AInput[7]; + LWord8 := AInput[8]; + LWord9 := AInput[9]; + LWord10 := AInput[10]; + LWord11 := AInput[11]; + LWord12 := AInput[12]; + LWord13 := AInput[13]; + LWord14 := AInput[14]; + LWord15 := AInput[15]; LIdx := ARounds; while LIdx > 0 do begin - x04 := x04 xor (Rotl((x00 + x12), 7)); - x08 := x08 xor (Rotl((x04 + x00), 9)); - x12 := x12 xor (Rotl((x08 + x04), 13)); - x00 := x00 xor (Rotl((x12 + x08), 18)); - x09 := x09 xor (Rotl((x05 + x01), 7)); - x13 := x13 xor (Rotl((x09 + x05), 9)); - x01 := x01 xor (Rotl((x13 + x09), 13)); - x05 := x05 xor (Rotl((x01 + x13), 18)); - x14 := x14 xor (Rotl((x10 + x06), 7)); - x02 := x02 xor (Rotl((x14 + x10), 9)); - x06 := x06 xor (Rotl((x02 + x14), 13)); - x10 := x10 xor (Rotl((x06 + x02), 18)); - x03 := x03 xor (Rotl((x15 + x11), 7)); - x07 := x07 xor (Rotl((x03 + x15), 9)); - x11 := x11 xor (Rotl((x07 + x03), 13)); - x15 := x15 xor (Rotl((x11 + x07), 18)); - - x01 := x01 xor (Rotl((x00 + x03), 7)); - x02 := x02 xor (Rotl((x01 + x00), 9)); - x03 := x03 xor (Rotl((x02 + x01), 13)); - x00 := x00 xor (Rotl((x03 + x02), 18)); - x06 := x06 xor (Rotl((x05 + x04), 7)); - x07 := x07 xor (Rotl((x06 + x05), 9)); - x04 := x04 xor (Rotl((x07 + x06), 13)); - x05 := x05 xor (Rotl((x04 + x07), 18)); - x11 := x11 xor (Rotl((x10 + x09), 7)); - x08 := x08 xor (Rotl((x11 + x10), 9)); - x09 := x09 xor (Rotl((x08 + x11), 13)); - x10 := x10 xor (Rotl((x09 + x08), 18)); - x12 := x12 xor (Rotl((x15 + x14), 7)); - x13 := x13 xor (Rotl((x12 + x15), 9)); - x14 := x14 xor (Rotl((x13 + x12), 13)); - x15 := x15 xor (Rotl((x14 + x13), 18)); + LWord4 := LWord4 xor (TBits.RotateLeft32((LWord0 + LWord12), 7)); + LWord8 := LWord8 xor (TBits.RotateLeft32((LWord4 + LWord0), 9)); + LWord12 := LWord12 xor (TBits.RotateLeft32((LWord8 + LWord4), 13)); + LWord0 := LWord0 xor (TBits.RotateLeft32((LWord12 + LWord8), 18)); + LWord9 := LWord9 xor (TBits.RotateLeft32((LWord5 + LWord1), 7)); + LWord13 := LWord13 xor (TBits.RotateLeft32((LWord9 + LWord5), 9)); + LWord1 := LWord1 xor (TBits.RotateLeft32((LWord13 + LWord9), 13)); + LWord5 := LWord5 xor (TBits.RotateLeft32((LWord1 + LWord13), 18)); + LWord14 := LWord14 xor (TBits.RotateLeft32((LWord10 + LWord6), 7)); + LWord2 := LWord2 xor (TBits.RotateLeft32((LWord14 + LWord10), 9)); + LWord6 := LWord6 xor (TBits.RotateLeft32((LWord2 + LWord14), 13)); + LWord10 := LWord10 xor (TBits.RotateLeft32((LWord6 + LWord2), 18)); + LWord3 := LWord3 xor (TBits.RotateLeft32((LWord15 + LWord11), 7)); + LWord7 := LWord7 xor (TBits.RotateLeft32((LWord3 + LWord15), 9)); + LWord11 := LWord11 xor (TBits.RotateLeft32((LWord7 + LWord3), 13)); + LWord15 := LWord15 xor (TBits.RotateLeft32((LWord11 + LWord7), 18)); + + LWord1 := LWord1 xor (TBits.RotateLeft32((LWord0 + LWord3), 7)); + LWord2 := LWord2 xor (TBits.RotateLeft32((LWord1 + LWord0), 9)); + LWord3 := LWord3 xor (TBits.RotateLeft32((LWord2 + LWord1), 13)); + LWord0 := LWord0 xor (TBits.RotateLeft32((LWord3 + LWord2), 18)); + LWord6 := LWord6 xor (TBits.RotateLeft32((LWord5 + LWord4), 7)); + LWord7 := LWord7 xor (TBits.RotateLeft32((LWord6 + LWord5), 9)); + LWord4 := LWord4 xor (TBits.RotateLeft32((LWord7 + LWord6), 13)); + LWord5 := LWord5 xor (TBits.RotateLeft32((LWord4 + LWord7), 18)); + LWord11 := LWord11 xor (TBits.RotateLeft32((LWord10 + LWord9), 7)); + LWord8 := LWord8 xor (TBits.RotateLeft32((LWord11 + LWord10), 9)); + LWord9 := LWord9 xor (TBits.RotateLeft32((LWord8 + LWord11), 13)); + LWord10 := LWord10 xor (TBits.RotateLeft32((LWord9 + LWord8), 18)); + LWord12 := LWord12 xor (TBits.RotateLeft32((LWord15 + LWord14), 7)); + LWord13 := LWord13 xor (TBits.RotateLeft32((LWord12 + LWord15), 9)); + LWord14 := LWord14 xor (TBits.RotateLeft32((LWord13 + LWord12), 13)); + LWord15 := LWord15 xor (TBits.RotateLeft32((LWord14 + LWord13), 18)); System.Dec(LIdx, 2); end; - Ax[0] := x00 + AInput[0]; - Ax[1] := x01 + AInput[1]; - Ax[2] := x02 + AInput[2]; - Ax[3] := x03 + AInput[3]; - Ax[4] := x04 + AInput[4]; - Ax[5] := x05 + AInput[5]; - Ax[6] := x06 + AInput[6]; - Ax[7] := x07 + AInput[7]; - Ax[8] := x08 + AInput[8]; - Ax[9] := x09 + AInput[9]; - Ax[10] := x10 + AInput[10]; - Ax[11] := x11 + AInput[11]; - Ax[12] := x12 + AInput[12]; - Ax[13] := x13 + AInput[13]; - Ax[14] := x14 + AInput[14]; - Ax[15] := x15 + AInput[15]; + AOutWords[0] := LWord0 + AInput[0]; + AOutWords[1] := LWord1 + AInput[1]; + AOutWords[2] := LWord2 + AInput[2]; + AOutWords[3] := LWord3 + AInput[3]; + AOutWords[4] := LWord4 + AInput[4]; + AOutWords[5] := LWord5 + AInput[5]; + AOutWords[6] := LWord6 + AInput[6]; + AOutWords[7] := LWord7 + AInput[7]; + AOutWords[8] := LWord8 + AInput[8]; + AOutWords[9] := LWord9 + AInput[9]; + AOutWords[10] := LWord10 + AInput[10]; + AOutWords[11] := LWord11 + AInput[11]; + AOutWords[12] := LWord12 + AInput[12]; + AOutWords[13] := LWord13 + AInput[13]; + AOutWords[14] := LWord14 + AInput[14]; + AOutWords[15] := LWord15 + AInput[15]; end; -class procedure TPBKDF_ScryptNotBuildInAdapter.BlockMix(const Ab, AX1, AX2, - Ay: THashLibUInt32Array; AR: Int32); +class procedure TPBKDF_ScryptNotBuildInAdapter.BlockMix(const ASourceBlock, + AScratchX1, AScratchX2, AMixedOut: THashLibUInt32Array; ABlockSize: Int32); var - LbOff, LYOff, LHalfLen, LIdx: Int32; + LBlockOffset, LYOffset, LHalfLength, LIdx: Int32; begin - System.Move(Ab[System.Length(Ab) - 16], AX1[0], 16 * System.SizeOf(UInt32)); + System.Move(ASourceBlock[System.Length(ASourceBlock) - 16], AScratchX1[0], + 16 * System.SizeOf(UInt32)); - LbOff := 0; - LYOff := 0; - LHalfLen := System.Length(Ab) div 2; + LBlockOffset := 0; + LYOffset := 0; + LHalfLength := System.Length(ASourceBlock) div 2; - LIdx := 2 * AR; + LIdx := 2 * ABlockSize; while LIdx > 0 do begin - &Xor(AX1, Ab, LbOff, AX2); + &Xor(AScratchX1, ASourceBlock, LBlockOffset, AScratchX2); - SalsaCore(8, AX2, AX1); - System.Move(AX1[0], Ay[LYOff], 16 * System.SizeOf(UInt32)); + SalsaCore(8, AScratchX2, AScratchX1); + System.Move(AScratchX1[0], AMixedOut[LYOffset], 16 * System.SizeOf(UInt32)); - LYOff := LHalfLen + LbOff - LYOff; - LbOff := LbOff + 16; + LYOffset := LHalfLength + LBlockOffset - LYOffset; + LBlockOffset := LBlockOffset + 16; System.Dec(LIdx); end; end; @@ -331,9 +281,9 @@ class procedure TPBKDF_ScryptNotBuildInAdapter.BlockMix(const Ab, AX1, AX2, class procedure TPBKDF_ScryptNotBuildInAdapter.SMixLane(AIdx: Int32; APtrB: PCardinal; ACost, ABlockSize: Int32); var - LBCount, LIdx, LJdx, LOffset: Int32; + LBCount, LIdx, LRandomIndex, LOffset: Int32; LMask: UInt32; - LBlockX1, LBlockX2, LBlockY, LX, LV: THashLibUInt32Array; + LBlockX1, LBlockX2, LBlockY, LWorkBlock, LScryptRom: THashLibUInt32Array; begin AIdx := AIdx * 32 * ABlockSize; LBCount := ABlockSize * 32; @@ -341,22 +291,22 @@ class procedure TPBKDF_ScryptNotBuildInAdapter.SMixLane(AIdx: Int32; System.SetLength(LBlockX1, 16); System.SetLength(LBlockX2, 16); System.SetLength(LBlockY, LBCount); - System.SetLength(LX, LBCount); - System.SetLength(LV, ACost * LBCount); + System.SetLength(LWorkBlock, LBCount); + System.SetLength(LScryptRom, ACost * LBCount); try - System.Move(APtrB[AIdx], LX[0], LBCount * System.SizeOf(UInt32)); + System.Move(APtrB[AIdx], LWorkBlock[0], LBCount * System.SizeOf(UInt32)); LOffset := 0; LIdx := 0; while LIdx < ACost do begin - System.Move(LX[0], LV[LOffset], LBCount * System.SizeOf(UInt32)); + System.Move(LWorkBlock[0], LScryptRom[LOffset], LBCount * System.SizeOf(UInt32)); LOffset := LOffset + LBCount; - BlockMix(LX, LBlockX1, LBlockX2, LBlockY, ABlockSize); - System.Move(LBlockY[0], LV[LOffset], LBCount * System.SizeOf(UInt32)); + BlockMix(LWorkBlock, LBlockX1, LBlockX2, LBlockY, ABlockSize); + System.Move(LBlockY[0], LScryptRom[LOffset], LBCount * System.SizeOf(UInt32)); LOffset := LOffset + LBCount; - BlockMix(LBlockY, LBlockX1, LBlockX2, LX, ABlockSize); + BlockMix(LBlockY, LBlockX1, LBlockX2, LWorkBlock, ABlockSize); System.Inc(LIdx, 2); end; @@ -365,19 +315,19 @@ class procedure TPBKDF_ScryptNotBuildInAdapter.SMixLane(AIdx: Int32; LIdx := 0; while LIdx < ACost do begin - LJdx := Int32(LX[LBCount - 16] and LMask); - System.Move(LV[LJdx * LBCount], LBlockY[0], + LRandomIndex := Int32(LWorkBlock[LBCount - 16] and LMask); + System.Move(LScryptRom[LRandomIndex * LBCount], LBlockY[0], LBCount * System.SizeOf(UInt32)); - &Xor(LBlockY, LX, 0, LBlockY); - BlockMix(LBlockY, LBlockX1, LBlockX2, LX, ABlockSize); + &Xor(LBlockY, LWorkBlock, 0, LBlockY); + BlockMix(LBlockY, LBlockX1, LBlockX2, LWorkBlock, ABlockSize); System.Inc(LIdx); end; - System.Move(LX[0], APtrB[AIdx], LBCount * System.SizeOf(UInt32)); + System.Move(LWorkBlock[0], APtrB[AIdx], LBCount * System.SizeOf(UInt32)); finally - ClearArray(LV); - ClearAllArrays(THashLibMatrixUInt32Array.Create(LX, LBlockX1, LBlockX2, - LBlockY)); + TArrayUtils.ZeroFill(LScryptRom); + TArrayUtils.ZeroFill(THashLibMatrixUInt32Array.Create(LWorkBlock, LBlockX1, + LBlockX2, LBlockY)); end; end; @@ -411,7 +361,7 @@ class function TPBKDF_ScryptNotBuildInAdapter.MFCrypt(const APasswordBytes, var LMFLenBytes, LBLen: Int32; LBytes: THashLibByteArray; - Lb: THashLibUInt32Array; + LBlockWords: THashLibUInt32Array; begin LMFLenBytes := ABlockSize * 128; LBytes := SingleIterationPBKDF2(APasswordBytes, ASaltBytes, @@ -419,20 +369,20 @@ class function TPBKDF_ScryptNotBuildInAdapter.MFCrypt(const APasswordBytes, try LBLen := System.Length(LBytes) div 4; - System.SetLength(Lb, LBLen); + System.SetLength(LBlockWords, LBLen); - TConverters.le32_copy(PByte(LBytes), 0, PCardinal(Lb), 0, + TConverters.le32_copy(PByte(LBytes), 0, PCardinal(LBlockWords), 0, System.Length(LBytes) * System.SizeOf(Byte)); - DoParallelSMix(PCardinal(Lb), AParallelism, ACost, ABlockSize); + DoParallelSMix(PCardinal(LBlockWords), AParallelism, ACost, ABlockSize); - TConverters.le32_copy(PCardinal(Lb), 0, PByte(LBytes), 0, - System.Length(Lb) * System.SizeOf(UInt32)); + TConverters.le32_copy(PCardinal(LBlockWords), 0, PByte(LBytes), 0, + System.Length(LBlockWords) * System.SizeOf(UInt32)); - result := SingleIterationPBKDF2(APasswordBytes, LBytes, AOutputLength); + Result := SingleIterationPBKDF2(APasswordBytes, LBytes, AOutputLength); finally - ClearArray(Lb); - ClearArray(LBytes); + TArrayUtils.ZeroFill(LBlockWords); + TArrayUtils.ZeroFill(LBytes); end; end; @@ -480,7 +430,7 @@ constructor TPBKDF_ScryptNotBuildInAdapter.Create(const APasswordBytes, ASaltBytes: THashLibByteArray; ACost, ABlockSize, AParallelism: Int32; ARelaxCostRestriction: Boolean); begin - Inherited Create(); + inherited Create(); ValidatePBKDF_ScryptInputs(ACost, ABlockSize, AParallelism, ARelaxCostRestriction); FPasswordBytes := System.Copy(APasswordBytes); FSaltBytes := System.Copy(ASaltBytes); @@ -503,7 +453,7 @@ function TPBKDF_ScryptNotBuildInAdapter.GetBytes(AByteCount: Int32) raise EArgumentHashLibException.CreateRes(@SInvalidByteCount); end; - result := MFCrypt(FPasswordBytes, FSaltBytes, FCost, FBlockSize, FParallelism, + Result := MFCrypt(FPasswordBytes, FSaltBytes, FCost, FBlockSize, FParallelism, AByteCount); end; diff --git a/HashLib/src/NullDigest/HlpNullDigest.pas b/HashLib/src/NullDigest/HlpNullDigest.pas index 8e69a197..2f19427c 100644 --- a/HashLib/src/NullDigest/HlpNullDigest.pas +++ b/HashLib/src/NullDigest/HlpNullDigest.pas @@ -61,13 +61,13 @@ function TNullDigest.Clone(): IHash; LHashInstance := TNullDigest.Create(); FOut.Position := 0; LHashInstance.FOut.CopyFrom(FOut, FOut.Size); - result := LHashInstance as IHash; - result.BufferSize := BufferSize; + Result := LHashInstance; + Result.BufferSize := BufferSize; end; constructor TNullDigest.Create; begin - Inherited Create(-1, -1); // Dummy State + inherited Create(-1, -1); // Dummy State FOut := TMemoryStream.Create(); end; @@ -85,7 +85,7 @@ procedure TNullDigest.Initialize; procedure TNullDigest.TransformBytes(const AData: THashLibByteArray; AIndex, ALength: Int32); begin - if AData <> Nil then + if AData <> nil then begin FOut.Write(AData[AIndex], ALength); end; @@ -102,7 +102,7 @@ function TNullDigest.TransformFinal: IHashResult; System.SetLength(LResult, FOut.Size); FOut.Read(LResult[0], FOut.Size); end; - result := THashResult.Create(LResult); + Result := THashResult.Create(LResult); finally Initialize(); end; diff --git a/HashLib/src/Utils/HlpArrayUtils.pas b/HashLib/src/Utils/HlpArrayUtils.pas index ace679f2..76ad2600 100644 --- a/HashLib/src/Utils/HlpArrayUtils.pas +++ b/HashLib/src/Utils/HlpArrayUtils.pas @@ -69,7 +69,7 @@ class function TArrayUtils.AreEqual(const ABuffer1, begin if System.Length(ABuffer1) <> System.Length(ABuffer2) then begin - Result := false; + Result := False; Exit; end; Result := CompareMem(ABuffer1, ABuffer2, System.Length(ABuffer1) * @@ -99,7 +99,7 @@ class function TArrayUtils.ConstantTimeAreEqual(const ABuffer1, class procedure TArrayUtils.Fill(const ABuffer: THashLibByteArray; AFrom, ATo: Int32; AFiller: Byte); begin - if ABuffer <> Nil then + if ABuffer <> nil then begin System.FillChar(ABuffer[AFrom], (ATo - AFrom) * System.SizeOf(Byte), AFiller); @@ -109,7 +109,7 @@ class procedure TArrayUtils.Fill(const ABuffer: THashLibByteArray; class procedure TArrayUtils.Fill(const ABuffer: THashLibUInt32Array; AFrom, ATo: Int32; AFiller: UInt32); begin - if ABuffer <> Nil then + if ABuffer <> nil then begin {$IFDEF FPC} System.FillDWord(ABuffer[AFrom], (ATo - AFrom), AFiller); @@ -126,7 +126,7 @@ class procedure TArrayUtils.Fill(const ABuffer: THashLibUInt32Array; class procedure TArrayUtils.Fill(const ABuffer: THashLibUInt64Array; AFrom, ATo: Int32; AFiller: UInt64); begin - if ABuffer <> Nil then + if ABuffer <> nil then begin {$IFDEF FPC} System.FillQWord(ABuffer[AFrom], (ATo - AFrom), AFiller); @@ -143,7 +143,7 @@ class procedure TArrayUtils.Fill(const ABuffer: THashLibUInt64Array; class procedure TArrayUtils.FillMemory(ABufferPtr: Pointer; ASize: Int64; AFiller: Byte); begin - if ABufferPtr <> Nil then + if ABufferPtr <> nil then begin System.FillChar(ABufferPtr^, ASize, AFiller); end; @@ -193,11 +193,11 @@ class function TArrayUtils.Concatenate(const ABuffer1, begin LABuffer1Length := System.Length(ABuffer1); System.SetLength(Result, LABuffer1Length + System.Length(ABuffer2)); - if ABuffer1 <> Nil then + if ABuffer1 <> nil then begin System.Move(ABuffer1[0], Result[0], LABuffer1Length * System.SizeOf(Byte)); end; - if ABuffer2 <> Nil then + if ABuffer2 <> nil then begin System.Move(ABuffer2[0], Result[LABuffer1Length], System.Length(ABuffer2) * System.SizeOf(Byte)); @@ -211,12 +211,12 @@ class function TArrayUtils.Concatenate(const ABuffer1, begin LABuffer1Length := System.Length(ABuffer1); System.SetLength(Result, LABuffer1Length + System.Length(ABuffer2)); - if ABuffer1 <> Nil then + if ABuffer1 <> nil then begin System.Move(ABuffer1[0], Result[0], LABuffer1Length * System.SizeOf(UInt32)); end; - if ABuffer2 <> Nil then + if ABuffer2 <> nil then begin System.Move(ABuffer2[0], Result[LABuffer1Length], System.Length(ABuffer2) * System.SizeOf(UInt32)); diff --git a/HashLib/src/Utils/HlpBitConverter.pas b/HashLib/src/Utils/HlpBitConverter.pas index 8e3f70bc..873fa4e9 100644 --- a/HashLib/src/Utils/HlpBitConverter.pas +++ b/HashLib/src/Utils/HlpBitConverter.pas @@ -100,90 +100,90 @@ implementation class function TBitConverter.GetBytes(AValue: Int16): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PSmallInt(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PSmallInt(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: Int32): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PInteger(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PInteger(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: Double): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PDouble(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PDouble(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: Boolean): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PBoolean(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PBoolean(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: Char): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PChar(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PChar(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: UInt8): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PByte(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PByte(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: UInt16): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PWord(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PWord(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: Int64): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PInt64(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PInt64(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: Single): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PSingle(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PSingle(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: UInt32): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PCardinal(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PCardinal(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; class function TBitConverter.GetBytes(AValue: UInt64): THashLibByteArray; begin - // System.SetLength(result, System.SizeOf(AValue)); - // PUInt64(@result[0])^ := AValue; - System.SetLength(result, System.SizeOf(AValue)); - System.Move(AValue, result[0], System.SizeOf(AValue)); + // System.SetLength(Result, System.SizeOf(AValue)); + // PUInt64(@Result[0])^ := AValue; + System.SetLength(Result, System.SizeOf(AValue)); + System.Move(AValue, Result[0], System.SizeOf(AValue)); end; { ==================================================================== } @@ -192,17 +192,17 @@ class function TBitConverter.GetHexValue(AValue: Int32): Char; begin if AValue < 10 then begin - result := Char(AValue + System.Ord('0')) + Result := Char(AValue + System.Ord('0')) end else begin - result := Char((AValue - 10) + System.Ord('A')); + Result := Char((AValue - 10) + System.Ord('A')); end; end; class function TBitConverter.GetIsLittleEndian: Boolean; begin - result := FIsLittleEndian; + Result := FIsLittleEndian; end; { ==================================================================== } @@ -210,77 +210,77 @@ class function TBitConverter.GetIsLittleEndian: Boolean; class function TBitConverter.ToBoolean(const AValue: THashLibByteArray; AStartIndex: Int32): Boolean; begin - // result := PBoolean(@AValue[AStartIndex])^; - System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // Result := PBoolean(@AValue[AStartIndex])^; + System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); end; class function TBitConverter.ToChar(const AValue: THashLibByteArray; AStartIndex: Int32): Char; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - result := Char(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8)); + Result := Char(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8)); end else begin - result := Char((AValue[AStartIndex] shl 8) or AValue[AStartIndex + 1]); + Result := Char((AValue[AStartIndex] shl 8) or AValue[AStartIndex + 1]); end; end; class function TBitConverter.ToDouble(const AValue: THashLibByteArray; AStartIndex: Int32): Double; var - i1, i2: Int32; + LLowInt32, LHighInt32: Int32; LValue: Int64; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - i1 := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or + LLowInt32 := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or (AValue[AStartIndex + 2] shl 16) or (AValue[AStartIndex + 3] shl 24); - i2 := (AValue[AStartIndex + 4]) or (AValue[AStartIndex + 5] shl 8) or + LHighInt32 := (AValue[AStartIndex + 4]) or (AValue[AStartIndex + 5] shl 8) or (AValue[AStartIndex + 6] shl 16) or (AValue[AStartIndex + 7] shl 24); - LValue := UInt32(i1) or (Int64(i2) shl 32); - result := PDouble(@LValue)^; + LValue := UInt32(LLowInt32) or (Int64(LHighInt32) shl 32); + Result := PDouble(@LValue)^; end else begin - i1 := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or + LLowInt32 := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or (AValue[AStartIndex + 2] shl 8) or (AValue[AStartIndex + 3]); - i2 := (AValue[AStartIndex + 4] shl 24) or (AValue[AStartIndex + 5] shl 16) + LHighInt32 := (AValue[AStartIndex + 4] shl 24) or (AValue[AStartIndex + 5] shl 16) or (AValue[AStartIndex + 6] shl 8) or (AValue[AStartIndex + 7]); - LValue := UInt32(i2) or (Int64(i1) shl 32); - result := PDouble(@LValue)^; + LValue := UInt32(LHighInt32) or (Int64(LLowInt32) shl 32); + Result := PDouble(@LValue)^; end; end; class function TBitConverter.ToInt16(const AValue: THashLibByteArray; AStartIndex: Int32): Int16; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - result := SmallInt(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8)); + Result := SmallInt(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8)); end else begin - result := SmallInt((AValue[AStartIndex] shl 8) or AValue[AStartIndex + 1]); + Result := SmallInt((AValue[AStartIndex] shl 8) or AValue[AStartIndex + 1]); end; end; class function TBitConverter.ToInt32(const AValue: THashLibByteArray; AStartIndex: Int32): Int32; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - result := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or + Result := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or (AValue[AStartIndex + 2] shl 16) or (AValue[AStartIndex + 3] shl 24); end else begin - result := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) + Result := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or (AValue[AStartIndex + 2] shl 8) or (AValue[AStartIndex + 3]); end; end; @@ -288,24 +288,24 @@ class function TBitConverter.ToInt32(const AValue: THashLibByteArray; class function TBitConverter.ToInt64(const AValue: THashLibByteArray; AStartIndex: Int32): Int64; var - i1, i2: Int32; + LLowInt32, LHighInt32: Int32; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - i1 := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or + LLowInt32 := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or (AValue[AStartIndex + 2] shl 16) or (AValue[AStartIndex + 3] shl 24); - i2 := (AValue[AStartIndex + 4]) or (AValue[AStartIndex + 5] shl 8) or + LHighInt32 := (AValue[AStartIndex + 4]) or (AValue[AStartIndex + 5] shl 8) or (AValue[AStartIndex + 6] shl 16) or (AValue[AStartIndex + 7] shl 24); - result := UInt32(i1) or (Int64(i2) shl 32); + Result := UInt32(LLowInt32) or (Int64(LHighInt32) shl 32); end else begin - i1 := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or + LLowInt32 := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or (AValue[AStartIndex + 2] shl 8) or (AValue[AStartIndex + 3]); - i2 := (AValue[AStartIndex + 4] shl 24) or (AValue[AStartIndex + 5] shl 16) + LHighInt32 := (AValue[AStartIndex + 4] shl 24) or (AValue[AStartIndex + 5] shl 16) or (AValue[AStartIndex + 6] shl 8) or (AValue[AStartIndex + 7]); - result := UInt32(i2) or (Int64(i1) shl 32); + Result := UInt32(LHighInt32) or (Int64(LLowInt32) shl 32); end; end; @@ -314,54 +314,54 @@ class function TBitConverter.ToSingle(const AValue: THashLibByteArray; var LValue: Int32; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin LValue := (AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or (AValue[AStartIndex + 2] shl 16) or (AValue[AStartIndex + 3] shl 24)); - result := PSingle(@LValue)^; + Result := PSingle(@LValue)^; end else begin LValue := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or (AValue[AStartIndex + 2] shl 8) or (AValue[AStartIndex + 3]); - result := PSingle(@LValue)^; + Result := PSingle(@LValue)^; end; end; class function TBitConverter.ToUInt8(const AValue: THashLibByteArray; AStartIndex: Int32): UInt8; begin - // result := PByte(@AValue[AStartIndex])^; - System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // Result := PByte(@AValue[AStartIndex])^; + System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); end; class function TBitConverter.ToUInt16(const AValue: THashLibByteArray; AStartIndex: Int32): UInt16; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - result := Word(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8)); + Result := Word(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8)); end else begin - result := Word((AValue[AStartIndex] shl 8) or AValue[AStartIndex + 1]); + Result := Word((AValue[AStartIndex] shl 8) or AValue[AStartIndex + 1]); end; end; class function TBitConverter.ToUInt32(const AValue: THashLibByteArray; AStartIndex: Int32): UInt32; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - result := UInt32(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or + Result := UInt32(AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or (AValue[AStartIndex + 2] shl 16) or (AValue[AStartIndex + 3] shl 24)); end else begin - result := UInt32((AValue[AStartIndex] shl 24) or + Result := UInt32((AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or (AValue[AStartIndex + 2] shl 8) or (AValue[AStartIndex + 3])); end; @@ -370,36 +370,36 @@ class function TBitConverter.ToUInt32(const AValue: THashLibByteArray; class function TBitConverter.ToUInt64(const AValue: THashLibByteArray; AStartIndex: Int32): UInt64; var - i1, i2: Int32; + LLowInt32, LHighInt32: Int32; begin - // System.Move(AValue[AStartIndex], result, System.SizeOf(result)); + // System.Move(AValue[AStartIndex], Result, System.SizeOf(Result)); if (IsLittleEndian) then begin - i1 := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or + LLowInt32 := AValue[AStartIndex] or (AValue[AStartIndex + 1] shl 8) or (AValue[AStartIndex + 2] shl 16) or (AValue[AStartIndex + 3] shl 24); - i2 := (AValue[AStartIndex + 4]) or (AValue[AStartIndex + 5] shl 8) or + LHighInt32 := (AValue[AStartIndex + 4]) or (AValue[AStartIndex + 5] shl 8) or (AValue[AStartIndex + 6] shl 16) or (AValue[AStartIndex + 7] shl 24); - result := UInt64(UInt32(i1) or (Int64(i2) shl 32)); + Result := UInt64(UInt32(LLowInt32) or (Int64(LHighInt32) shl 32)); end else begin - i1 := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or + LLowInt32 := (AValue[AStartIndex] shl 24) or (AValue[AStartIndex + 1] shl 16) or (AValue[AStartIndex + 2] shl 8) or (AValue[AStartIndex + 3]); - i2 := (AValue[AStartIndex + 4] shl 24) or (AValue[AStartIndex + 5] shl 16) + LHighInt32 := (AValue[AStartIndex + 4] shl 24) or (AValue[AStartIndex + 5] shl 16) or (AValue[AStartIndex + 6] shl 8) or (AValue[AStartIndex + 7]); - result := UInt64(UInt32(i2) or (Int64(i1) shl 32)); + Result := UInt64(UInt32(LHighInt32) or (Int64(LLowInt32) shl 32)); end; end; class function TBitConverter.ToString(const AValue: THashLibByteArray): String; begin - result := ToString(AValue, System.Low(AValue)); + Result := ToString(AValue, System.Low(AValue)); end; class function TBitConverter.ToString(const AValue: THashLibByteArray; AStartIndex: Int32): String; begin - result := ToString(AValue, AStartIndex, System.Length(AValue) - AStartIndex); + Result := ToString(AValue, AStartIndex, System.Length(AValue) - AStartIndex); end; class function TBitConverter.ToString(const AValue: THashLibByteArray; @@ -409,7 +409,7 @@ class function TBitConverter.ToString(const AValue: THashLibByteArray; LCharArray: THashLibCharArray; LByte: Byte; begin - result := ''; + Result := ''; LCharArrayLength := ALength * 3; @@ -427,7 +427,7 @@ class function TBitConverter.ToString(const AValue: THashLibByteArray; System.Inc(LIdx, 3); end; - System.SetString(result, PChar(@LCharArray[System.Low(LCharArray)]), + System.SetString(Result, PChar(@LCharArray[System.Low(LCharArray)]), System.Length(LCharArray) - 1); end; diff --git a/HashLib/src/Utils/HlpBits.pas b/HashLib/src/Utils/HlpBits.pas index cb453d11..93bfe7fe 100644 --- a/HashLib/src/Utils/HlpBits.pas +++ b/HashLib/src/Utils/HlpBits.pas @@ -201,18 +201,18 @@ class function TBits.RotateRight64(AValue: UInt64; ADistance: Int32): UInt64; class function TBits.ReverseBytesInt32(AValue: Int32): Int32; {$IFNDEF FPC} var - i1, i2, i3, i4: Int32; + LByte1, LByte2, LByte3, LByte4: Int32; {$ENDIF FPC} begin {$IFDEF FPC} Result := SwapEndian(AValue); {$ELSE} - i1 := AValue and $FF; - i2 := TBits.Asr32(AValue, 8) and $FF; - i3 := TBits.Asr32(AValue, 16) and $FF; - i4 := TBits.Asr32(AValue, 24) and $FF; + LByte1 := AValue and $FF; + LByte2 := TBits.Asr32(AValue, 8) and $FF; + LByte3 := TBits.Asr32(AValue, 16) and $FF; + LByte4 := TBits.Asr32(AValue, 24) and $FF; - Result := (i1 shl 24) or (i2 shl 16) or (i3 shl 8) or (i4 shl 0); + Result := (LByte1 shl 24) or (LByte2 shl 16) or (LByte3 shl 8) or (LByte4 shl 0); {$ENDIF FPC} end; diff --git a/HashLib/src/Utils/HlpConverters.pas b/HashLib/src/Utils/HlpConverters.pas index 269d950b..ec1072ce 100644 --- a/HashLib/src/Utils/HlpConverters.pas +++ b/HashLib/src/Utils/HlpConverters.pas @@ -5,11 +5,13 @@ interface uses +{$IFDEF FPC} + StrUtils, // FPC needs StrUtils for BinToHex/HexToBin +{$ENDIF} Classes, SysUtils, HlpHashLibTypes, - HlpBits, - HlpBitConverter; + HlpBits; resourcestring SAEncodingNilError = 'AEncoding cannot be nil'; @@ -195,18 +197,18 @@ class procedure TConverters.swap_copy_str_to_u64(ASource: Pointer; class function TConverters.be2me_32(AInput: UInt32): UInt32; begin {$IFDEF HASHLIB_LITTLE_ENDIAN} - result := TBits.ReverseBytesUInt32(AInput); + Result := TBits.ReverseBytesUInt32(AInput); {$ELSE} - result := AInput; + Result := AInput; {$ENDIF HASHLIB_LITTLE_ENDIAN} end; class function TConverters.be2me_64(AInput: UInt64): UInt64; begin {$IFDEF HASHLIB_LITTLE_ENDIAN} - result := TBits.ReverseBytesUInt64(AInput); + Result := TBits.ReverseBytesUInt64(AInput); {$ELSE} - result := AInput; + Result := AInput; {$ENDIF HASHLIB_LITTLE_ENDIAN} end; @@ -237,18 +239,18 @@ class procedure TConverters.be64_copy(ASource: Pointer; ASourceIndex: Int32; class function TConverters.le2me_32(AInput: UInt32): UInt32; begin {$IFDEF HASHLIB_LITTLE_ENDIAN} - result := AInput; + Result := AInput; {$ELSE} - result := TBits.ReverseBytesUInt32(AInput); + Result := TBits.ReverseBytesUInt32(AInput); {$ENDIF HASHLIB_LITTLE_ENDIAN} end; class function TConverters.le2me_64(AInput: UInt64): UInt64; begin {$IFDEF HASHLIB_LITTLE_ENDIAN} - result := AInput; + Result := AInput; {$ELSE} - result := TBits.ReverseBytesUInt64(AInput); + Result := TBits.ReverseBytesUInt64(AInput); {$ENDIF HASHLIB_LITTLE_ENDIAN} end; @@ -355,56 +357,56 @@ class procedure TConverters.ReadUInt64AsBytesBE(AInput: UInt64; class function TConverters.ReadPCardinalAsUInt32(AInput: PCardinal): UInt32; begin {$IFDEF HASHLIB_REQUIRES_PROPER_ALIGNMENT} - System.Move(AInput^, result, System.SizeOf(UInt32)); + System.Move(AInput^, Result, System.SizeOf(UInt32)); {$ELSE} - result := AInput^; + Result := AInput^; {$ENDIF HASHLIB_REQUIRES_PROPER_ALIGNMENT} end; class function TConverters.ReadPUInt64AsUInt64(AInput: PUInt64): UInt64; begin {$IFDEF HASHLIB_REQUIRES_PROPER_ALIGNMENT} - System.Move(AInput^, result, System.SizeOf(UInt64)); + System.Move(AInput^, Result, System.SizeOf(UInt64)); {$ELSE} - result := AInput^; + Result := AInput^; {$ENDIF HASHLIB_REQUIRES_PROPER_ALIGNMENT} end; class function TConverters.ReadPCardinalAsUInt32LE(AInput: PCardinal): UInt32; begin - result := le2me_32(ReadPCardinalAsUInt32(AInput)); + Result := le2me_32(ReadPCardinalAsUInt32(AInput)); end; class function TConverters.ReadPUInt64AsUInt64LE(AInput: PUInt64): UInt64; begin - result := le2me_64(ReadPUInt64AsUInt64(AInput)); + Result := le2me_64(ReadPUInt64AsUInt64(AInput)); end; class function TConverters.ReadPCardinalAsUInt32BE(AInput: PCardinal): UInt32; begin - result := be2me_32(ReadPCardinalAsUInt32(AInput)); + Result := be2me_32(ReadPCardinalAsUInt32(AInput)); end; class function TConverters.ReadPUInt64AsUInt64BE(AInput: PUInt64): UInt64; begin - result := be2me_64(ReadPUInt64AsUInt64(AInput)); + Result := be2me_64(ReadPUInt64AsUInt64(AInput)); end; class function TConverters.ReadBytesAsUInt32LE(AInput: PByte; AIndex: Int32): UInt32; begin - result := ReadPCardinalAsUInt32LE(PCardinal(AInput + AIndex)); + Result := ReadPCardinalAsUInt32LE(PCardinal(AInput + AIndex)); // while this below is slower, it's portable - // result := (UInt32(AInput[AIndex])) or (UInt32(AInput[AIndex + 1]) shl 8) or + // Result := (UInt32(AInput[AIndex])) or (UInt32(AInput[AIndex + 1]) shl 8) or // (UInt32(AInput[AIndex + 2]) shl 16) or (UInt32(AInput[AIndex + 3]) shl 24); end; class function TConverters.ReadBytesAsUInt64LE(AInput: PByte; AIndex: Int32): UInt64; begin - result := ReadPUInt64AsUInt64LE(PUInt64(AInput + AIndex)); + Result := ReadPUInt64AsUInt64LE(PUInt64(AInput + AIndex)); // while this below is slower, it's portable - // result := (UInt64(AInput[AIndex])) or (UInt64(AInput[AIndex + 1]) shl 8) or + // Result := (UInt64(AInput[AIndex])) or (UInt64(AInput[AIndex + 1]) shl 8) or // (UInt64(AInput[AIndex + 2]) shl 16) or (UInt64(AInput[AIndex + 3]) shl 24) // or (UInt64(AInput[AIndex + 4]) shl 32) or // (UInt64(AInput[AIndex + 5]) shl 40) or (UInt64(AInput[AIndex + 6]) shl 48) @@ -414,9 +416,9 @@ class function TConverters.ReadBytesAsUInt64LE(AInput: PByte; class function TConverters.ReadBytesAsUInt32BE(AInput: PByte; AIndex: Int32): UInt32; begin - result := ReadPCardinalAsUInt32BE(PCardinal(AInput + AIndex)); + Result := ReadPCardinalAsUInt32BE(PCardinal(AInput + AIndex)); // while this below is slower, it's portable - // result := (UInt32(AInput[AIndex]) shl 24) or + // Result := (UInt32(AInput[AIndex]) shl 24) or // (UInt32(AInput[AIndex + 1]) shl 16) or (UInt32(AInput[AIndex + 2]) shl 8) or // (UInt32(AInput[AIndex + 3])); end; @@ -424,9 +426,9 @@ class function TConverters.ReadBytesAsUInt32BE(AInput: PByte; class function TConverters.ReadBytesAsUInt64BE(AInput: PByte; AIndex: Int32): UInt64; begin - result := ReadPUInt64AsUInt64BE(PUInt64(AInput + AIndex)); + Result := ReadPUInt64AsUInt64BE(PUInt64(AInput + AIndex)); // while this below is slower, it's portable - // result := (UInt64(AInput[AIndex]) shl 56) or + // Result := (UInt64(AInput[AIndex]) shl 56) or // (UInt64(AInput[AIndex + 1]) shl 48) or (UInt64(AInput[AIndex + 2]) shl 40) // or (UInt64(AInput[AIndex + 3]) shl 32) or // (UInt64(AInput[AIndex + 4]) shl 24) or (UInt64(AInput[AIndex + 5]) shl 16) @@ -436,33 +438,57 @@ class function TConverters.ReadBytesAsUInt64BE(AInput: PByte; class function TConverters.ReadUInt32AsBytesLE(AInput: UInt32) : THashLibByteArray; begin - System.SetLength(result, System.SizeOf(UInt32)); - TConverters.ReadUInt32AsBytesLE(AInput, result, 0); + System.SetLength(Result, System.SizeOf(UInt32)); + TConverters.ReadUInt32AsBytesLE(AInput, Result, 0); end; class function TConverters.ReadUInt64AsBytesLE(AInput: UInt64) : THashLibByteArray; begin - System.SetLength(result, System.SizeOf(UInt64)); - TConverters.ReadUInt64AsBytesLE(AInput, result, 0); + System.SetLength(Result, System.SizeOf(UInt64)); + TConverters.ReadUInt64AsBytesLE(AInput, Result, 0); end; class function TConverters.ConvertBytesToHexString(const AInput : THashLibByteArray; AGroup: Boolean): String; +var + LCount, LIdx: Int32; + LHex: String; + LPtrHex, LPtrResult: PChar; begin - result := UpperCase(TBitConverter.ToString(AInput)); - - if System.length(AInput) = 1 then + LCount := System.Length(AInput); + if LCount = 0 then begin + Result := ''; Exit; end; - if (AGroup) then + System.SetLength(LHex, LCount * 2); + {$IFDEF FPC}StrUtils.{$ENDIF}BinToHex(@AInput[0], PChar(LHex), LCount); + + if (not AGroup) or (LCount <= 1) then begin + Result := LHex; Exit; end; - result := StringReplace(result, '-', '', [rfIgnoreCase, rfReplaceAll]); + System.SetLength(Result, (LCount * 3) - 1); + LPtrHex := PChar(LHex); + LPtrResult := PChar(Result); + for LIdx := 0 to LCount - 1 do + begin + LPtrResult^ := LPtrHex^; + System.Inc(LPtrHex); + System.Inc(LPtrResult); + LPtrResult^ := LPtrHex^; + System.Inc(LPtrHex); + System.Inc(LPtrResult); + if LIdx < (LCount - 1) then + begin + LPtrResult^ := '-'; + System.Inc(LPtrResult); + end; + end; end; class function TConverters.ConvertHexStringToBytes(const AInput: String) @@ -474,44 +500,40 @@ class function TConverters.ConvertHexStringToBytes(const AInput: String) LInput := StringReplace(LInput, '-', '', [rfIgnoreCase, rfReplaceAll]); {$IFDEF DEBUG} - System.Assert(System.length(LInput) and 1 = 0); + System.Assert(System.Length(LInput) and 1 = 0); {$ENDIF DEBUG} - System.SetLength(result, System.length(LInput) shr 1); + System.SetLength(Result, System.Length(LInput) shr 1); -{$IFNDEF NEXTGEN} - HexToBin(PChar(LInput), @result[0], System.length(result)); -{$ELSE} - HexToBin(PChar(LInput), 0, result, 0, System.length(LInput)); -{$ENDIF !NEXTGEN} + {$IFDEF FPC}StrUtils.{$ENDIF}HexToBin(PChar(LInput), @Result[0], System.Length(Result)); end; class function TConverters.ConvertStringToBytes(const AInput: String; const AEncoding: TEncoding): THashLibByteArray; begin - if AEncoding = Nil then + if AEncoding = nil then begin raise EArgumentNilHashLibException.CreateRes(@SAEncodingNilError); end; {$IFDEF FPC} - result := AEncoding.GetBytes(UnicodeString(AInput)); + Result := AEncoding.GetBytes(UnicodeString(AInput)); {$ELSE} - result := AEncoding.GetBytes(AInput); + Result := AEncoding.GetBytes(AInput); {$ENDIF FPC} end; class function TConverters.ConvertBytesToString(const AInput: THashLibByteArray; const AEncoding: TEncoding): String; begin - if AEncoding = Nil then + if AEncoding = nil then begin raise EArgumentNilHashLibException.CreateRes(@SAEncodingNilError); end; {$IFDEF FPC} - result := String(AEncoding.GetString(AInput)); + Result := String(AEncoding.GetString(AInput)); {$ELSE} - result := AEncoding.GetString(AInput); + Result := AEncoding.GetString(AInput); {$ENDIF FPC} end; diff --git a/scripts/check-duplicate-guids.ps1 b/scripts/check-duplicate-guids.ps1 new file mode 100644 index 00000000..13ac5a28 --- /dev/null +++ b/scripts/check-duplicate-guids.ps1 @@ -0,0 +1,49 @@ +<# +.SYNOPSIS + Checks that no two interface GUIDs in *.pas files are identical. +.DESCRIPTION + Extracts all ['{...}'] GUIDs from *.pas, groups by GUID, and exits with + non-zero if any GUID appears more than once (reporting file:line for each). +.EXAMPLE + .\scripts\check-duplicate-guids.ps1 +#> + +$ErrorActionPreference = 'Stop' + +# Repo root: script lives in /scripts/check-duplicate-guids.ps1 +$root = if ($PSScriptRoot) { Split-Path $PSScriptRoot -Parent } else { Get-Location } +$pasFiles = Get-ChildItem -Path $root -Filter '*.pas' -Recurse -File -ErrorAction SilentlyContinue | + Where-Object { $_.FullName -notmatch '\.git\\' } + +# Use Select-String for fast single-pass scan over all files (no full file read per line) +$guidPattern = "\['\{([0-9A-Fa-f-]+)\}'\]" +$matches = Select-String -LiteralPath $pasFiles.FullName -Pattern $guidPattern -AllMatches -ErrorAction SilentlyContinue + +$locationsByGuid = @{} +foreach ($m in $matches) { + $guid = $m.Matches.Groups[1].Value.ToUpperInvariant() + $relPath = $m.Path.Replace($root, '').TrimStart('\', '/') + $entry = "${relPath}:$($m.LineNumber)" + if (-not $locationsByGuid.ContainsKey($guid)) { + $locationsByGuid[$guid] = [System.Collections.ArrayList]::new() + } + [void]$locationsByGuid[$guid].Add($entry) +} + +$duplicates = $locationsByGuid.GetEnumerator() | Where-Object { $_.Value.Count -gt 1 } +if ($duplicates) { + Write-Host 'Duplicate interface GUIDs found. Each GUID must be unique across the codebase.' -ForegroundColor Red + Write-Host '' + foreach ($d in $duplicates) { + Write-Host "GUID: {$($d.Key)}" -ForegroundColor Yellow + foreach ($loc in $d.Value) { + Write-Host " $loc" + } + Write-Host '' + } + Write-Host 'Generate a new GUID: [guid]::NewGuid().ToString(''B'').ToUpperInvariant()' -ForegroundColor Cyan + exit 1 +} + +Write-Host 'No duplicate interface GUIDs found.' -ForegroundColor Green +exit 0 From b7f9eeb0700040e60dfeb3df8bcd2489913fa9d7 Mon Sep 17 00:00:00 2001 From: Ugochukwu Mmaduekwe Date: Sun, 22 Mar 2026 21:54:54 +0100 Subject: [PATCH 2/3] update README and inc file --- HashLib/src/Include/HashLibFPC.inc | 6 +- README.md | 269 +++++++++++++++++++---------- 2 files changed, 179 insertions(+), 96 deletions(-) diff --git a/HashLib/src/Include/HashLibFPC.inc b/HashLib/src/Include/HashLibFPC.inc index b44ce718..7434d78d 100644 --- a/HashLib/src/Include/HashLibFPC.inc +++ b/HashLib/src/Include/HashLibFPC.inc @@ -12,9 +12,9 @@ (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) {$IFDEF FPC} - // FPC 3.0.0 and Above - {$IF FPC_FULLVERSION < 30000} - {$MESSAGE ERROR 'This Library requires FreePascal 3.0.0 or higher.'} + // FPC 3.2.2 and Above + {$IF FPC_FULLVERSION < 30202} + {$MESSAGE ERROR 'This Library requires FreePascal 3.2.2 or higher.'} {$IFEND} {$IFDEF ENDIAN_BIG} diff --git a/README.md b/README.md index 13eec7f1..058b7eb9 100644 --- a/README.md +++ b/README.md @@ -1,153 +1,236 @@ -HashLib4Pascal: Hashing for Modern Object Pascal [![License](http://img.shields.io/badge/license-MIT-green.svg)](https://github.com/Xor-el/HashLib4Pascal/blob/master/LICENSE) -======================================== +# HashLib4Pascal -``HashLib4Pascal`` is an Object Pascal hashing library released under the permissive [MIT License](https://github.com/Xor-el/HashLib4Pascal/blob/master/LICENSE) which provides an easy to use interface for computing hashes and checksums of data. It also supports state based (incremental) hashing. +[![Build Status](https://github.com/Xor-el/HashLib4Pascal/actions/workflows/make.yml/badge.svg)](https://github.com/Xor-el/HashLib4Pascal/actions/workflows/make.yml) +[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Xor-el/HashLib4Pascal/blob/master/LICENSE) +[![Delphi](https://img.shields.io/badge/Delphi-2010%2B-red.svg)](https://www.embarcadero.com/products/delphi) +[![FreePascal](https://img.shields.io/badge/FreePascal-3.2.2%2B-blue.svg)](https://www.freepascal.org/) -``HashLib4Pascal's`` goal is to be the best option for hashing in Object Pascal by offering various hashing primitives via an easy to use API to Object Pascal developers. +HashLib4Pascal is a comprehensive hashing library for Object Pascal, providing an easy-to-use interface for computing hashes, checksums, MACs, KDFs, and XOFs with support for state-based (incremental) hashing, released under the permissive [MIT License](LICENSE). -Development is coordinated on [GitHub](https://github.com/Xor-el/HashLib4Pascal) and contributions are welcome. If you need help, please open an issue [here](https://github.com/Xor-el/HashLib4Pascal/issues). +## Table of Contents +- [Features](#features) +- [Available Algorithms](#available-algorithms) +- [Getting Started](#getting-started) +- [Quick Examples](#quick-examples) +- [Running Tests](#running-tests) +- [Contributing](#contributing) +- [Other Implementations](#other-implementations) +- [Tip Jar](#tip-jar) +- [License](#license) -**Build Status** -[![Build Status](https://github.com/Xor-el/HashLib4Pascal/actions/workflows/make.yml/badge.svg)](https://github.com/Xor-el/HashLib4Pascal/actions/workflows/make.yml) +## Features + +- **Extensive hash coverage** -- CRC (all standard variants from CRC3 to CRC64), non-cryptographic (Murmur, XXHash, SipHash, etc.), and cryptographic (SHA-2, SHA-3, Blake2, Blake3, and more) +- **State-based (incremental) hashing** -- feed data in chunks via `TransformBytes` / `TransformString`, then finalize with `TransformFinal` +- **One-shot convenience** -- `ComputeString`, `ComputeBytes`, `ComputeFile`, `ComputeStream` for single-call hashing +- **Password hashing / KDFs** -- Argon2 (2i/2d/2id), Scrypt, PBKDF2-HMAC +- **MACs** -- HMAC (all supported hashes), KMAC (128/256), Blake2BMAC, Blake2SMAC +- **Extendable output functions (XOFs)** -- Shake, CShake, Blake2X, KMACXOF, Blake3XOF +- **Cloneable state** -- clone any hash instance mid-computation for parallel/divergent processing +- **Cross-platform** -- Delphi and FreePascal on Windows, Linux, macOS, and more + +## Available Algorithms + +
+Checksums + +#### CRC +`All CRC variants from CRC3 to CRC64` + +#### Other +`Adler32` + +
+ +
+Non-Cryptographic Hash Functions -Available Algorithms ----------------------------------------- +#### 32-bit +`AP` | `BKDR` | `Bernstein` | `Bernstein1` | `DEK` | `DJB` | `ELF` | `FNV` | `FNV1a` | `Jenkins3` | `JS` | `Murmur2` | `MurmurHash3_x86_32` | `OneAtTime` | `PJW` | `Rotating` | `RS` | `SDBM` | `ShiftAndXor` | `SuperFast` | `XXHash32` - ### Hashes ----------------------------------------- -##### Cyclic Redundancy Checks +#### 64-bit +`FNV64` | `FNV1a64` | `Murmur2_64` | `SipHash2_4` | `XXHash64` -* `All CRC Variants from CRC3 to CRC64` +#### 128-bit +`SipHash128_2_4` | `MurmurHash3_x86_128` | `MurmurHash3_x64_128` -##### Checksums +
-* `Adler32` +
+Cryptographic Hash Functions -##### Non-Cryptographic Hash Functions ----------------------------------------- +| Family | Variants | +|---|---| +| MD | MD2, MD4, MD5 | +| SHA-0 | SHA-0 | +| SHA-1 | SHA-1 | +| SHA-2 | 224, 256, 384, 512, 512-224, 512-256 | +| SHA-3 | 224, 256, 384, 512 | +| Keccak | 224, 256, 288, 384, 512 | +| Blake2B | 160, 256, 384, 512 | +| Blake2S | 128, 160, 224, 256 | +| Blake2BP | Blake2BP | +| Blake2SP | Blake2SP | +| Blake3 | Blake3 | +| GOST | 34.11-94, R 34.11-2012 (256, 512) | +| Grindahl | 256, 512 | +| HAS160 | HAS160 | +| RIPEMD | 128, 160, 256, 320 | +| Tiger | 128, 160, 192 (Rounds 3, 4, 5) | +| Tiger2 | 128, 160, 192 (Rounds 3, 4, 5) | +| Snefru | 128, 256 | +| Haval | 128, 160, 192, 224, 256 (Rounds 3, 4, 5) | +| Panama | Panama | +| RadioGatun | RadioGatun32, RadioGatun64 | +| WhirlPool | WhirlPool | -###### 32 bit hashes +
-* `AP` `BKDR` `Bernstein` `Bernstein1` `DEK` `DJB` `ELF` `FNV` +
+Key Derivation Functions -* `FNV1a` `JS` `Jenkins3` `Murmur2` `MurmurHash3_x86_32` `OneAtTime` +#### Password Hashing +`PBKDF2-HMAC` | `Argon2 (2i, 2d, 2id)` | `Scrypt` -* `PJW` `RS` `Rotating` `SDBM` `ShiftAndXor` `SuperFast` `XXHash32` +
-###### 64 bit hashes +
+MACs -* `FNV64` `FNV1a64` `Murmur2_64` `SipHash2_4` `XXHash64` +`HMAC (all supported hashes)` | `KMAC (128, 256)` | `Blake2BMAC` | `Blake2SMAC` -###### 128 bit hashes +
-* `MurmurHash3_x86_128` `MurmurHash3_x64_128` +
+XOF (Extendable Output Functions) -##### Cryptographic Hash Functions ----------------------------------------- +`Shake (128, 256)` | `CShake (128, 256)` | `Blake2XS` | `Blake2XB` | `KMAC128XOF` | `KMAC256XOF` | `Blake3XOF` - * `MD2` +
- * `MD4` +## Getting Started - * `MD5` +### Prerequisites - * `SHA-0` +| Compiler | Minimum Version | +|---|---| +| Delphi | 2010 or later | +| FreePascal | 3.2.2 or later | - * `SHA-1` +### Installation - * `SHA-2 (224, 256, 384, 512, 512-224, 512-256)` +#### Delphi - * `GOST 34.11-94` +1. Open and install the package: `HashLib/src/Packages/Delphi/HashLib4PascalPackage.dpk` +2. Add the `HashLib/src` subdirectories to your project's search path. - * `GOST R 34.11-2012 (AKA Streebog) (256, 512)` - - * `Grindahl (256, 512)` - - * `Has160` +#### FreePascal / Lazarus - * `RIPEMD (128, 160, 256, 256, 320)` +1. Open and install the package: `HashLib/src/Packages/FPC/HashLib4PascalPackage.lpk` - * `Tiger (128, 160, 192 (Rounds 3, 4, 5))` +## Quick Examples - * `Tiger2 (128, 160, 192 (Rounds 3, 4, 5))` - - * `Snefru (128, 256)` - - * `Haval (128, 160, 192, 224, 256 (Rounds 3, 4, 5))` - - * `Panama` - - * `RadioGatun (RadioGatun32, RadioGatun64)` +### SHA-256 Hash - * `WhirlPool` +```pascal +uses + SysUtils, HlpHashFactory; - * `Blake2B (160, 256, 384, 512)` - - * `Blake2S (128, 160, 224, 256)` +var + LHash: String; +begin + LHash := THashFactory.TCrypto.CreateSHA2_256() + .ComputeString('Hello HashLib4Pascal', TEncoding.UTF8) + .ToString(); - * `SHA-3 (224, 256, 384, 512)` - - * `Keccak (224, 256, 288, 384, 512)` + WriteLn(LHash); +end; +``` - * `Blake2BP` +### Incremental (Streaming) Hash - * `Blake2SP` +```pascal +uses + SysUtils, HlpIHash, HlpHashFactory; - * `Blake3` +var + LHashInstance: IHash; +begin + LHashInstance := THashFactory.TCrypto.CreateBlake2B_256(); + LHashInstance.Initialize(); -### Key Derivation Functions ----------------------------------------- + LHashInstance.TransformString('chunk one', TEncoding.UTF8); + LHashInstance.TransformString('chunk two', TEncoding.UTF8); + LHashInstance.TransformString('chunk three', TEncoding.UTF8); -###### Password Hashing Schemes (Password Based Key Derivation Functions) + WriteLn(LHashInstance.TransformFinal().ToString()); +end; +``` ----------------------------------------- +### HMAC -* `PBKDF2` - -* `Argon2 (2i, 2d and 2id variants)` +```pascal +uses + SysUtils, HlpIHashInfo, HlpHashFactory, HlpConverters; -* `Scrypt` +var + LHMAC: IHMAC; +begin + LHMAC := THashFactory.THMAC.CreateHMAC( + THashFactory.TCrypto.CreateSHA2_256(), + TConverters.ConvertStringToBytes('secret key', TEncoding.UTF8)); -### MAC ----------------------------------------- + WriteLn(LHMAC.ComputeString('message', TEncoding.UTF8).ToString()); +end; +``` -* `HMAC (all supported hashes)` +### Scrypt KDF -* `KMAC (KMAC128, KMAC256)` +```pascal +uses + SysUtils, HlpIHashInfo, HlpHashFactory, HlpConverters; -* `Blake2MAC (Blake2BMAC, Blake2SMAC)` +var + LDerivedKey: TBytes; +begin + LDerivedKey := TKDF.TPBKDF_Scrypt.CreatePBKDF_Scrypt( + TConverters.ConvertStringToBytes('password', TEncoding.UTF8), + TConverters.ConvertStringToBytes('salt', TEncoding.UTF8), + 1024, 8, 1) + .GetBytes(32); -### XOF (Extendable Output Function) ----------------------------------------- + WriteLn(TConverters.ConvertBytesToHexString(LDerivedKey)); +end; +``` -* `Shake (Shake-128, Shake-256)` +## Running Tests -* `CShake (CShake-128, CShake-256)` +Tests use **DUnit** (Delphi) and **FPCUnit** (FreePascal). -* `Blake2X (Blake2XS, Blake2XB)` +- **Delphi:** Open `HashLib.Tests/Delphi.Tests/HashLib.Tests.dpr` in the IDE and run. +- **FreePascal / Lazarus:** Open `HashLib.Tests/FreePascal.Tests/HashLib.Tests.lpi` in the IDE and run. -* `KMACXOF (KMAC128XOF, KMAC256XOF)` +## Contributing -* `Blake3XOF` +Contributions are welcome. Please open an [issue](https://github.com/Xor-el/HashLib4Pascal/issues) for bug reports or feature requests, and submit pull requests. -### Supported Compilers ----------------------------------------- +## Other Implementations -* `FreePascal 3.0.0+` +If you want implementations in other languages, you can check out these: -* `Delphi 2010+` +- [HashLib4CPP](https://github.com/ron4fun/HashLib4CPP) by Mbadiwe Nnaemeka Ronald -### Other Implementations ----------------------------------------- +## Tip Jar -If you want implementations in other languages, you can check out these +If you find this library useful and would like to support its continued development, tips are greatly appreciated! 🙏 -* [HashLib4CPP](https://github.com/ron4fun/HashLib4CPP) by Mbadiwe Nnaemeka Ronald +| Cryptocurrency | Wallet Address | +|---|---| +| Bitcoin **Bitcoin (BTC)** | `bc1quqhe342vw4ml909g334w9ygade64szqupqulmu` | +| Ethereum **Ethereum (ETH)** | `0x53651185b7467c27facab542da5868bfebe2bb69` | +| Solana **Solana (SOL)** | `BPZHjY1eYCdQjLecumvrTJRi5TXj3Yz1vAWcmyEB9Miu` | -### Tip Jar ----------------------------------------- +## License -* :dollar: **Bitcoin**: `1MhFfW7tDuEHQSgie65uJcAfJgCNchGeKf` -* :euro: **Ethereum**: `0x6c1DC21aeC49A822A4f1E3bf07c623C2C1978a98` -* :pound: **Pascalcoin**: `345367-40` +HashLib4Pascal is released under the [MIT License](LICENSE). From e22a8d0fb623a66b900626ee113e37d2e88387c8 Mon Sep 17 00:00:00 2001 From: Ugochukwu Mmaduekwe Date: Sun, 22 Mar 2026 22:05:41 +0100 Subject: [PATCH 3/3] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 058b7eb9..6e65a21e 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ end; ```pascal uses - SysUtils, HlpIHashInfo, HlpHashFactory, HlpConverters; + SysUtils, HlpHashFactory, HlpConverters; var LDerivedKey: TBytes;