Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8166881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:01:55+00:00 2026-06-06T20:01:55+00:00

I’m writing an application in C# that needs to decrypt some data that was

  • 0

I’m writing an application in C# that needs to decrypt some data that was encrypted by some legacy software. The legacy code loops over the unencrypted bytes in chunks of 8 and encrypts them via TripleDES in CBC mode. It then handles the remaining bytes by using TripleDES CFB, using a block size of the remaining amount (in this specific case, 2).

I can unencrypt the data from the first phase fine in C# using System.Security.Cryptography.TripleDES, since it allows for block sizes of 64 bits (8 bytes). The TripleDES class won’t allow for a block size of 16 bits, however. The following code throws an error that says “Specified block size is not valid for this algorithm”:

TripleDES provider = TripleDESCryptoServiceProvider.Create();
provider.Mode = CipherMode.CFB;
provider.BlockSize = 16; // exception thrown here

I’m assuming this is in place due to the weak nature of small block sizes. Unfortunately, it’s what I’m stuck with. Are there any free third-party libraries that might support a 16-bit block size for TripleDES/CFB? Or are there any tricks I can use on this data set to make this work? I’ve checked the DES class to see if it supports 16-bit block sizes, but no dice…

I’m no cryptography expert, so if I end up having to roll my own code for TripleDES (over 2 bytes…grrr), any straight-forward articles on the details of the algorithm would be super helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:01:58+00:00Added an answer on June 6, 2026 at 8:01 pm

    One possibility is that the last two bytes of the plaintext are simply XORed with the two bytes of the final encrypted cipher block, and the remainder is discarded. It should be simple enough to get this behavior using the .NET classes.

    1. Set the blocksize to 64 bits.
    2. Set the mode to CFB.
    3. Set the feedback size to 64 bits
    4. Pad the input to be a multiple of 8 bytes. It doesn’t matter what padding you use because you are going to throw away the extra data.
    5. Transform the blocks.
    6. Throw away the residue.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.