Browse Source

Merge downstream

Herman Schoenfeld 7 years ago
parent
commit
bde7feb128

+ 5 - 5
src/libraries/hashlib4pascal/Base/HlpHashBuffer.pas

@@ -57,6 +57,11 @@ begin
 
 end;
 
+function THashBuffer.GetIsFull: Boolean;
+begin
+  result := Fm_pos = System.Length(Fm_data);
+end;
+
 function THashBuffer.Feed(a_data: PByte; a_length_a_data: Int32;
   a_length: Int32): Boolean;
 var
@@ -153,11 +158,6 @@ begin
   result := Fm_pos = 0;
 end;
 
-function THashBuffer.GetIsFull: Boolean;
-begin
-  result := Fm_pos = System.Length(Fm_data);
-end;
-
 function THashBuffer.GetLength: Int32;
 begin
   result := System.Length(Fm_data);

+ 80 - 80
src/libraries/hashlib4pascal/Checksum/HlpCRC.pas

@@ -610,6 +610,86 @@ implementation
 
 { TCRC }
 
+function TCRC.GetCheckValue: UInt64;
+begin
+  result := FCheckValue;
+end;
+
+function TCRC.GetInit: UInt64;
+begin
+  result := FInit;
+end;
+
+function TCRC.GetNames: THashLibStringArray;
+begin
+  result := FNames;
+end;
+
+function TCRC.GetPolynomial: UInt64;
+begin
+  result := FPolynomial;
+end;
+
+function TCRC.GetReflectIn: Boolean;
+begin
+  result := FReflectIn;
+end;
+
+function TCRC.GetReflectOut: Boolean;
+begin
+  result := FReflectOut;
+end;
+
+function TCRC.GetWidth: Int32;
+begin
+  result := FWidth;
+end;
+
+function TCRC.GetXOROut: UInt64;
+begin
+  result := FXorOut;
+end;
+
+procedure TCRC.SetCheckValue(value: UInt64);
+begin
+  FCheckValue := value;
+end;
+
+procedure TCRC.SetInit(value: UInt64);
+begin
+  FInit := value;
+end;
+
+procedure TCRC.SetNames(value: THashLibStringArray);
+begin
+  FNames := value;
+end;
+
+procedure TCRC.SetPolynomial(value: UInt64);
+begin
+  FPolynomial := value;
+end;
+
+procedure TCRC.SetReflectIn(value: Boolean);
+begin
+  FReflectIn := value;
+end;
+
+procedure TCRC.SetReflectOut(value: Boolean);
+begin
+  FReflectOut := value;
+end;
+
+procedure TCRC.SetWidth(value: Int32);
+begin
+  FWidth := value;
+end;
+
+procedure TCRC.SetXOROut(value: UInt64);
+begin
+  FXorOut := value;
+end;
+
 procedure TCRC.CalculateCRCbyTable(a_data: PByte;
   a_data_length, a_index: Int32);
 var
@@ -1197,46 +1277,6 @@ begin
   FIsTableGenerated := True;
 end;
 
-function TCRC.GetCheckValue: UInt64;
-begin
-  result := FCheckValue;
-end;
-
-function TCRC.GetInit: UInt64;
-begin
-  result := FInit;
-end;
-
-function TCRC.GetNames: THashLibStringArray;
-begin
-  result := FNames;
-end;
-
-function TCRC.GetPolynomial: UInt64;
-begin
-  result := FPolynomial;
-end;
-
-function TCRC.GetReflectIn: Boolean;
-begin
-  result := FReflectIn;
-end;
-
-function TCRC.GetReflectOut: Boolean;
-begin
-  result := FReflectOut;
-end;
-
-function TCRC.GetWidth: Int32;
-begin
-  result := FWidth;
-end;
-
-function TCRC.GetXOROut: UInt64;
-begin
-  result := FXorOut;
-end;
-
 procedure TCRC.Initialize;
 begin
   // initialize some bitmasks
@@ -1278,46 +1318,6 @@ begin
   end;
 end;
 
-procedure TCRC.SetCheckValue(value: UInt64);
-begin
-  FCheckValue := value;
-end;
-
-procedure TCRC.SetInit(value: UInt64);
-begin
-  FInit := value;
-end;
-
-procedure TCRC.SetNames(value: THashLibStringArray);
-begin
-  FNames := value;
-end;
-
-procedure TCRC.SetPolynomial(value: UInt64);
-begin
-  FPolynomial := value;
-end;
-
-procedure TCRC.SetReflectIn(value: Boolean);
-begin
-  FReflectIn := value;
-end;
-
-procedure TCRC.SetReflectOut(value: Boolean);
-begin
-  FReflectOut := value;
-end;
-
-procedure TCRC.SetWidth(value: Int32);
-begin
-  FWidth := value;
-end;
-
-procedure TCRC.SetXOROut(value: UInt64);
-begin
-  FXorOut := value;
-end;
-
 procedure TCRC.TransformBytes(a_data: THashLibByteArray;
   a_index, a_length: Int32);
 var

+ 9 - 9
src/libraries/hashlib4pascal/Crypto/Blake2BConfigurations/HlpBlake2BConfig.pas

@@ -50,15 +50,6 @@ implementation
 
 { TBlake2BConfig }
 
-constructor TBlake2BConfig.Create(AHashSize: THashSize);
-begin
-  if not (Int32(AHashSize) in [20, 32, 48, 64]) then
-  begin
-    raise EArgumentHashLibException.CreateRes(@SInvalidHashSize);
-  end;
-  HashSize := Int32(AHashSize);
-end;
-
 function TBlake2BConfig.GetHashSize: Int32;
 begin
   result := FHashSize;
@@ -99,4 +90,13 @@ begin
   FSalt := value;
 end;
 
+constructor TBlake2BConfig.Create(AHashSize: THashSize);
+begin
+  if not (Int32(AHashSize) in [20, 32, 48, 64]) then
+  begin
+    raise EArgumentHashLibException.CreateRes(@SInvalidHashSize);
+  end;
+  HashSize := Int32(AHashSize);
+end;
+
 end.

+ 5 - 5
src/libraries/hashlib4pascal/Crypto/Blake2BConfigurations/HlpBlake2BTreeConfig.pas

@@ -43,11 +43,6 @@ implementation
 
 { TBlake2BTreeConfig }
 
-constructor TBlake2BTreeConfig.Create;
-begin
-  IntermediateHashSize := 64;
-end;
-
 class function TBlake2BTreeConfig.CreateInterleaved(parallelism: Int32)
   : IBlake2BTreeConfig;
 begin
@@ -97,4 +92,9 @@ begin
   FMaxHeight := value;
 end;
 
+constructor TBlake2BTreeConfig.Create;
+begin
+  IntermediateHashSize := 64;
+end;
+
 end.

+ 9 - 9
src/libraries/hashlib4pascal/Crypto/Blake2SConfigurations/HlpBlake2SConfig.pas

@@ -50,15 +50,6 @@ implementation
 
 { TBlake2SConfig }
 
-constructor TBlake2SConfig.Create(AHashSize: THashSize);
-begin
-  if not (Int32(AHashSize) in [16, 20, 28, 32]) then
-  begin
-    raise EArgumentHashLibException.CreateRes(@SInvalidHashSize);
-  end;
-  HashSize := Int32(AHashSize);
-end;
-
 function TBlake2SConfig.GetHashSize: Int32;
 begin
   result := FHashSize;
@@ -99,4 +90,13 @@ begin
   FSalt := value;
 end;
 
+constructor TBlake2SConfig.Create(AHashSize: THashSize);
+begin
+  if not (Int32(AHashSize) in [16, 20, 28, 32]) then
+  begin
+    raise EArgumentHashLibException.CreateRes(@SInvalidHashSize);
+  end;
+  HashSize := Int32(AHashSize);
+end;
+
 end.

+ 5 - 5
src/libraries/hashlib4pascal/Crypto/Blake2SConfigurations/HlpBlake2STreeConfig.pas

@@ -43,11 +43,6 @@ implementation
 
 { TBlake2STreeConfig }
 
-constructor TBlake2STreeConfig.Create;
-begin
-  IntermediateHashSize := 32;
-end;
-
 class function TBlake2STreeConfig.CreateInterleaved(parallelism: Int32)
   : IBlake2STreeConfig;
 begin
@@ -97,4 +92,9 @@ begin
   FMaxHeight := value;
 end;
 
+constructor TBlake2STreeConfig.Create;
+begin
+  IntermediateHashSize := 32;
+end;
+
 end.

+ 1 - 1
src/libraries/hashlib4pascal/Crypto/HlpBlake2B.pas

@@ -82,7 +82,7 @@ type
 {$IFNDEF USE_UNROLLED_VARIANT}
     procedure G(a, b, c, d, r, i: Int32); inline;
 {$ENDIF USE_UNROLLED_VARIANT}
-    procedure Compress(block: PByte; start: Int32); inline;
+    procedure Compress(block: PByte; start: Int32);
 
     procedure Finish(); inline;
 

+ 1 - 1
src/libraries/hashlib4pascal/Crypto/HlpBlake2S.pas

@@ -82,7 +82,7 @@ type
 {$IFNDEF USE_UNROLLED_VARIANT}
     procedure G(a, b, c, d, r, i: Int32); inline;
 {$ENDIF USE_UNROLLED_VARIANT}
-    procedure Compress(block: PByte; start: Int32); inline;
+    procedure Compress(block: PByte; start: Int32);
 
     procedure Finish(); inline;