I was wondering, is it possible to extend the cipher byte length when block size 64bits (8byte) in DES?
Its like this, When the input Blocksize
is <=64bits
the cypher size is 128bits
for sure because of the PaddingMode.PKCS7
in DES. The below code is an example of what I'm saying.
static void Main(string[] args)
{
Console.WriteLine("Original String: ");
string originalString = Console.ReadLine();
string cryptedString = Encrypt(originalString);
Console.WriteLine("Encrypt Result: " +cryptedString);
}
public static string Encrypt(string originalString)
{
const string AesIV = "!QAZ2WSX";
const string AesKey = "5TGB&YHN";
byte[] input_text = Encoding.UTF8.GetBytes(originalString);
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
des.BlockSize = 64;
des.IV = Encoding.UTF8.GetBytes(AesIV);
des.Key = Encoding.UTF8.GetBytes(AesKey);
des.Mode = CipherMode.CBC;
des.Padding = PaddingMode.PKCS7;
ICryptoTransform des_demo = des.CreateEncryptor();
byte[] encrypted = des_demo.TransformFinalBlock(input_text , 0, input_text.Length );
string encrypt = Convert.ToBase64String(encrypted );
return encrypt;
}
But I want to have cyphersize more than 128bits
(specially 192bits
) from same input Blocksize
which is <=64bits
from this code. How I can I do that? Is there any way to fix up the output cipher size to 24bytes?