Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HashProvider.cs
Go to the documentation of this file.
1using System;
2
4
5internal abstract class HashProvider : IDisposable
6{
7 public abstract int HashSizeInBytes { get; }
8
9 public void AppendHashData(byte[] data, int offset, int count)
10 {
11 if (data == null)
12 {
14 }
15 if (offset < 0)
16 {
18 }
19 if (count < 0)
20 {
22 }
23 if (data.Length - offset < count)
24 {
26 }
28 }
29
30 public abstract void AppendHashData(ReadOnlySpan<byte> data);
31
33
35
36 public byte[] FinalizeHashAndReset()
37 {
38 byte[] array = new byte[HashSizeInBytes];
39 int num = FinalizeHashAndReset(array);
40 return array;
41 }
42
43 public bool TryFinalizeHashAndReset(Span<byte> destination, out int bytesWritten)
44 {
45 if (destination.Length < HashSizeInBytes)
46 {
47 bytesWritten = 0;
48 return false;
49 }
50 bytesWritten = FinalizeHashAndReset(destination);
51 return true;
52 }
53
54 public void Dispose()
55 {
56 Dispose(disposing: true);
57 GC.SuppressFinalize(this);
58 }
59
60 public abstract void Dispose(bool disposing);
61
62 public abstract void Reset();
63}
void Dispose(bool disposing)
void AppendHashData(byte[] data, int offset, int count)
bool TryFinalizeHashAndReset(Span< byte > destination, out int bytesWritten)
int FinalizeHashAndReset(Span< byte > destination)
void AppendHashData(ReadOnlySpan< byte > data)
int GetCurrentHash(Span< byte > destination)
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8
static string ArgumentNull_Buffer
Definition SR.cs:22
static string Argument_InvalidOffLen
Definition SR.cs:22
static string ArgumentOutOfRange_NeedNonNegNum
Definition SR.cs:32
Definition SR.cs:7