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

◆ TryEncryptEcbCore()

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

Reimplemented from System.Security.Cryptography.SymmetricAlgorithm.

Definition at line 94 of file RC2Implementation.cs.

95 {
96 if (!ValidKeySize(Key.Length, out var keySizeBits))
97 {
99 }
100 int effectiveKeyLength = ((EffectiveKeySizeValue == 0) ? keySizeBits : EffectiveKeySize);
101 UniversalCryptoTransform universalCryptoTransform = CreateTransformCore(CipherMode.ECB, paddingMode, Key, effectiveKeyLength, null, BlockSize / 8, 0, BlockSize / 8, encrypting: true);
102 using (universalCryptoTransform)
103 {
104 return universalCryptoTransform.TransformOneShot(plaintext, destination, out bytesWritten);
105 }
106 }
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().