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

◆ Mgf1() [2/2]

void System.Security.Cryptography.RsaPaddingProcessor.Mgf1 ( IncrementalHash hasher,
ReadOnlySpan< byte > mgfSeed,
Span< byte > mask )
inlineprivate

Definition at line 164 of file RsaPaddingProcessor.cs.

165 {
166 Span<byte> destination = mask;
167 int num = 0;
168 Span<byte> span = stackalloc byte[4];
169 while (destination.Length > 0)
170 {
171 hasher.AppendData(mgfSeed);
173 hasher.AppendData(span);
174 if (destination.Length >= _hLen)
175 {
176 if (!hasher.TryGetHashAndReset(destination, out var bytesWritten))
177 {
178 throw new CryptographicException();
179 }
180 destination = destination.Slice(bytesWritten);
181 num++;
182 continue;
183 }
184 Span<byte> destination2 = stackalloc byte[_hLen];
185 if (!hasher.TryGetHashAndReset(destination2, out var _))
186 {
187 throw new CryptographicException();
188 }
189 destination2.Slice(0, destination.Length).CopyTo(destination);
190 break;
191 }
192 }
static void WriteInt32BigEndian(Span< byte > destination, int value)

References System.Security.Cryptography.IncrementalHash.AppendData(), System.destination, System.Span< T >.Slice(), System.Security.Cryptography.IncrementalHash.TryGetHashAndReset(), and System.Buffers.Binary.BinaryPrimitives.WriteInt32BigEndian().