Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SHA1CryptoServiceProvider.cs
Go to the documentation of this file.
2
4
5[Obsolete("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
6[EditorBrowsable(EditorBrowsableState.Never)]
7public sealed class SHA1CryptoServiceProvider : SHA1
8{
10
11 private bool _running;
12
18
19 public override void Initialize()
20 {
21 if (_running)
22 {
23 Span<byte> destination = stackalloc byte[20];
25 {
26 throw new CryptographicException();
27 }
28 _running = false;
29 }
30 }
31
32 protected override void HashCore(byte[] array, int ibStart, int cbSize)
33 {
34 _running = true;
35 _incrementalHash.AppendData(array, ibStart, cbSize);
36 }
37
38 protected override void HashCore(ReadOnlySpan<byte> source)
39 {
40 _running = true;
42 }
43
44 protected override byte[] HashFinal()
45 {
46 _running = false;
48 }
49
50 protected override bool TryHashFinal(Span<byte> destination, out int bytesWritten)
51 {
52 _running = false;
53 return _incrementalHash.TryGetHashAndReset(destination, out bytesWritten);
54 }
55
56 protected override void Dispose(bool disposing)
57 {
58 if (disposing)
59 {
61 }
62 base.Dispose(disposing);
63 }
64}
static IncrementalHash CreateHash(HashAlgorithmName hashAlgorithm)
bool TryGetHashAndReset(Span< byte > destination, out int bytesWritten)
override bool TryHashFinal(Span< byte > destination, out int bytesWritten)
override void HashCore(byte[] array, int ibStart, int cbSize)