public void Clone_SeperateStateFromOriginal() { var digest = new SHA512Digest(SHA512Digest.Mode.SHA384); var buffer = Encoding.UTF8.GetBytes("The quick brown fox jumps"); digest.Update(buffer); var digest2 = digest.Clone(); buffer = Encoding.UTF8.GetBytes(" over the lazy dog"); digest2.Update(buffer); var result1 = digest.DigestBuffer(); var result2 = digest2.DigestBuffer(); AssertSHA384("17ab2a4374f66611b44d072223392aac47619917f67c563be63506a2445438dac1f08aff2289b6306c63015e17f6d756", result1); AssertSHA384("ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1", result2); }
public void Clone_SeperateStateFromOriginal() { var digest = new SHA512Digest(SHA512Digest.Mode.SHA512); var buffer = Encoding.UTF8.GetBytes("The quick brown fox jumps"); digest.Update(buffer); var digest2 = digest.Clone(); buffer = Encoding.UTF8.GetBytes(" over the lazy dog"); digest2.Update(buffer); var result1 = digest.DigestBuffer(); var result2 = digest2.DigestBuffer(); AssertSHA512("4b4c254dd0bc5c4a1a70900bc9eea84c852e11ac3d16f87f1d3aaff0478e46ee58c264d4aea58d2ce1b08e84bd7bbbf032e99521f60fcec637abdb243977dd7c", result1); AssertSHA512("07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6", result2); }