Browse Source

remove unneeded method in IDigest interface.

Ugochukwu Mmaduekwe 6 years ago
parent
commit
cc2ce932ab

+ 7 - 3
CryptoLib.Tests/src/Others/ShortenedDigestTests.pas

@@ -67,7 +67,7 @@ procedure TTestShortenedDigest.DoTestShortenedDigest;
 var
 var
   d: IDigest;
   d: IDigest;
   sd: IShortenedDigest;
   sd: IShortenedDigest;
-  temp: TCryptoLibByteArray;
+  temp, temp2: TCryptoLibByteArray;
 begin
 begin
   d := TDigestUtilities.GetDigest('SHA-1');
   d := TDigestUtilities.GetDigest('SHA-1');
   sd := TShortenedDigest.Create(TDigestUtilities.GetDigest('SHA-1'), 10);
   sd := TShortenedDigest.Create(TDigestUtilities.GetDigest('SHA-1'), 10);
@@ -86,9 +86,11 @@ begin
   // check output fits
   // check output fits
   //
   //
   System.SetLength(temp, 10);
   System.SetLength(temp, 10);
+  System.SetLength(temp2, 10);
   sd.DoFinal(temp, 0);
   sd.DoFinal(temp, 0);
+  sd.DoFinal(temp2, 0);
 
 
-  CheckTrue(TArrayUtils.AreEqual(temp, sd.DoFinal),
+  CheckTrue(TArrayUtils.AreEqual(temp, temp2),
     Format('DoFinal(temp, 0) <> temp := DoFinal() %s', [sd.AlgorithmName]));
     Format('DoFinal(temp, 0) <> temp := DoFinal() %s', [sd.AlgorithmName]));
 
 
   d := TDigestUtilities.GetDigest('SHA-512');
   d := TDigestUtilities.GetDigest('SHA-512');
@@ -108,9 +110,11 @@ begin
   // check output fits
   // check output fits
   //
   //
   System.SetLength(temp, 20);
   System.SetLength(temp, 20);
+  System.SetLength(temp2, 20);
   sd.DoFinal(temp, 0);
   sd.DoFinal(temp, 0);
+  sd.DoFinal(temp2, 0);
 
 
-  CheckTrue(TArrayUtils.AreEqual(temp, sd.DoFinal),
+  CheckTrue(TArrayUtils.AreEqual(temp, temp2),
     Format('DoFinal(temp, 0) <> temp := DoFinal() %s', [sd.AlgorithmName]));
     Format('DoFinal(temp, 0) <> temp := DoFinal() %s', [sd.AlgorithmName]));
 
 
   try
   try

+ 1 - 3
CryptoLib/src/Interfaces/ClpIDigest.pas

@@ -81,9 +81,7 @@ type
     /// <param name="outOff">
     /// <param name="outOff">
     /// the offset into the out array the digest is to start at.
     /// the offset into the out array the digest is to start at.
     /// </param>
     /// </param>
-    function DoFinal(const output: TCryptoLibByteArray; outOff: Int32)
-      : Int32; overload;
-    function DoFinal: TCryptoLibByteArray; overload;
+    function DoFinal(const output: TCryptoLibByteArray; outOff: Int32): Int32;
 
 
     /// <summary>
     /// <summary>
     /// Resets the digest back to it's initial state.
     /// Resets the digest back to it's initial state.