Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GenerateMask()

override byte[] System.Security.Cryptography.PKCS1MaskGenerationMethod.GenerateMask ( byte[] rgbSeed,
int cbReturn )
inline

Definition at line 31 of file PKCS1MaskGenerationMethod.cs.

32 {
33 using HashAlgorithm hashAlgorithm = CryptoConfig.CreateFromName(_hashNameValue) as HashAlgorithm;
34 if (hashAlgorithm == null)
35 {
36 throw new CryptographicException(System.SR.Format(System.SR.Cryptography_UnknownHashAlgorithm, _hashNameValue));
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 }
static void WriteUInt32BigEndian(Span< byte > destination, uint value)
static string Cryptography_UnknownHashAlgorithm
Definition SR.cs:152
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7

References System.Security.Cryptography.PKCS1MaskGenerationMethod._hashNameValue, System.array, System.Buffer.BlockCopy(), System.Security.Cryptography.CryptoConfig.CreateFromName(), System.SR.Cryptography_UnknownHashAlgorithm, System.SR.Format(), System.Security.Cryptography.HashAlgorithm, System.Math.Min(), and System.Buffers.Binary.BinaryPrimitives.WriteUInt32BigEndian().