Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PKCS1MaskGenerationMethod.cs
Go to the documentation of this file.
4
6
7[UnsupportedOSPlatform("browser")]
9{
10 private string _hashNameValue;
11
12 public string HashName
13 {
14 get
15 {
16 return _hashNameValue;
17 }
18 set
19 {
20 _hashNameValue = value ?? "SHA1";
21 }
22 }
23
24 [RequiresUnreferencedCode("PKCS1MaskGenerationMethod is not trim compatible because the algorithm implementation referenced by HashName might be removed.")]
26 {
27 _hashNameValue = "SHA1";
28 }
29
30 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "The constructor of this class is marked as RequiresUnreferencedCode. Don't mark this method as RequiresUnreferencedCode because it is an override and would then need to mark the base method (and all other overrides) as well.")]
31 public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn)
32 {
34 if (hashAlgorithm == null)
35 {
37 }
38 byte[] array = new byte[4];
39 byte[] array2 = new byte[cbReturn];
40 uint num = 0u;
41 for (int i = 0; i < array2.Length; i += hashAlgorithm.Hash.Length)
42 {
44 hashAlgorithm.TransformBlock(rgbSeed, 0, rgbSeed.Length, rgbSeed, 0);
45 hashAlgorithm.TransformFinalBlock(array, 0, 4);
46 byte[] hash = hashAlgorithm.Hash;
47 hashAlgorithm.Initialize();
48 Buffer.BlockCopy(hash, 0, array2, i, Math.Min(array2.Length - i, hash.Length));
49 }
50 return array2;
51 }
52}
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
Definition Buffer.cs:102
static void WriteUInt32BigEndian(Span< byte > destination, uint value)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static string Cryptography_UnknownHashAlgorithm
Definition SR.cs:152
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7
static ? object CreateFromName(string name, params object?[]? args)
override byte[] GenerateMask(byte[] rgbSeed, int cbReturn)