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

◆ TryDecryptEcbCore()

override bool Internal.Cryptography.RC2Implementation.TryDecryptEcbCore ( ReadOnlySpan< byte > ciphertext,
Span< byte > destination,
PaddingMode paddingMode,
out int bytesWritten )
inlineprotectedvirtual

Reimplemented from System.Security.Cryptography.SymmetricAlgorithm.

Definition at line 80 of file RC2Implementation.cs.

81 {
82 if (!ValidKeySize(Key.Length, out var keySizeBits))
83 {
85 }
86 int effectiveKeyLength = ((EffectiveKeySizeValue == 0) ? keySizeBits : EffectiveKeySize);
87 UniversalCryptoTransform universalCryptoTransform = CreateTransformCore(CipherMode.ECB, paddingMode, Key, effectiveKeyLength, null, BlockSize / 8, 0, BlockSize / 8, encrypting: false);
88 using (universalCryptoTransform)
89 {
90 return universalCryptoTransform.TransformOneShot(ciphertext, destination, out bytesWritten);
91 }
92 }
static UniversalCryptoTransform CreateTransformCore(CipherMode cipherMode, PaddingMode paddingMode, byte[] key, int effectiveKeyLength, byte[] iv, int blockSize, int feedbackSize, int paddingSize, bool encrypting)
bool ValidKeySize(int keySizeBytes, out int keySizeBits)
static string Cryptography_InvalidKeySize
Definition SR.cs:92
Definition SR.cs:7

References System.Security.Cryptography.SymmetricAlgorithm.BlockSize, Internal.Cryptography.RC2Implementation.CreateTransformCore(), System.SR.Cryptography_InvalidKeySize, System.destination, Internal.Cryptography.RC2Implementation.EffectiveKeySize, System.Security.Cryptography.RC2.EffectiveKeySizeValue, System.Security.Cryptography.SymmetricAlgorithm.Key, Internal.Cryptography.UniversalCryptoTransform.TransformOneShot(), and Internal.Cryptography.RC2Implementation.ValidKeySize().