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

◆ ConvertFromBase64()

void System.Security.Cryptography.FromBase64Transform.ConvertFromBase64 ( Span< byte > tmpBuffer,
Span< byte > outputBuffer,
out int consumed,
out int written )
inlineprivate

Definition at line 144 of file FromBase64Transform.cs.

145 {
146 int num = _inputIndex + tmpBuffer.Length;
147 byte[] array = null;
148 Span<byte> span = stackalloc byte[32];
149 if (num > 32)
150 {
152 }
153 _inputBuffer.AsSpan(0, _inputIndex).CopyTo(span);
154 tmpBuffer.CopyTo(span.Slice(_inputIndex));
155 _inputIndex = num & 3;
156 num -= _inputIndex;
157 tmpBuffer.Slice(tmpBuffer.Length - _inputIndex).CopyTo(_inputBuffer);
158 span = span.Slice(0, num);
159 if (Base64.DecodeFromUtf8(span, outputBuffer, out consumed, out written) != 0)
160 {
161 ThrowHelper.ThrowBase64FormatException();
162 }
163 ReturnToCryptoPool(array, span.Length);
164 }
static unsafe OperationStatus DecodeFromUtf8(ReadOnlySpan< byte > utf8, Span< byte > bytes, out int bytesConsumed, out int bytesWritten, bool isFinalBlock=true)
Definition Base64.cs:43
static byte[] Rent(int minimumLength)
Definition CryptoPool.cs:7
void ReturnToCryptoPool(byte[] array, int clearSize)
void CopyTo(Span< T > destination)
Definition Span.cs:224
Span< T > Slice(int start)
Definition Span.cs:271
int Length
Definition Span.cs:70

References System.Security.Cryptography.FromBase64Transform._inputBuffer, System.Security.Cryptography.FromBase64Transform._inputIndex, System.array, System.Span< T >.CopyTo(), System.Buffers.Text.Base64.DecodeFromUtf8(), System.Span< T >.Length, System.Security.Cryptography.CryptoPool.Rent(), System.Security.Cryptography.FromBase64Transform.ReturnToCryptoPool(), System.Span< T >.Slice(), and System.Security.Cryptography.ThrowHelper.ThrowBase64FormatException().

Referenced by System.Security.Cryptography.FromBase64Transform.TransformBlock(), and System.Security.Cryptography.FromBase64Transform.TransformFinalBlock().