-1
        using (ICryptoTransform Encryptor = TDes.CreateEncryptor())
        {
            OutputBuffer = Encryptor.TransformFinalBlock(InputBuffer, 0, 8);
        }


        using (ICryptoTransform Decryptor = TDes.CreateDecryptor())
        {
            OutputBuffer = Decryptor.TransformFinalBlock(InputBuffer, 0, 8);
        }

This was the issue, I wan encrypting only 8 characters and that is the reason why I was getting back only 8. This was a real question and not a dumb one. Since many of you had no idea. Thanks for the help or at least for you trying to answer it.

Ridvan
  • 11
  • 3
  • 1
    Please narrow down the portion of code that doesn't work. People here don't like to think that Stack Overflow is a place where you can dump non-working code and expect it to be fixed by the minute. – zneak Feb 03 '11 at 04:55
  • 1
    SO can help you solve your problem but not to the extent that we will do the whole job for you. :) – Carls Jr. Feb 03 '11 at 05:03
  • @Ridvan Have you tried debugging the code using breakpoints? http://www.homeandlearn.co.uk/csharp/csharp_s5p4.html – Searock Feb 03 '11 at 05:17
  • 1
    Folks, if a question is low quality, edit to fix it when possible (here it really isn't) or vote it down, but closing it just penalizes psychic debuggers. – Ben Voigt Feb 03 '11 at 05:37
  • 1
    @Ridvan: The [answer where you got this code](http://stackoverflow.com/questions/3569783/query-string-parameter-obfuscation/3571165#3571165) is creating a hash code, not an encoding which can be decrypted. Furthermore, you ought to incorporate [the improvements](http://stackoverflow.com/questions/4882378/convert-pointer-to-loop-option-in-c/4882418#4882418) suggested at [your other question](http://stackoverflow.com/questions/4882378/convert-pointer-to-loop-option-in-c) – Ben Voigt Feb 03 '11 at 05:40

1 Answers1

2

Your only asking for 8:

Encryptor.TransformFinalBlock(InputBuffer, 0, 8)

http://msdn.microsoft.com/en-us/library/system.security.cryptography.icryptotransform.transformfinalblock.aspx

Robert Wagner
  • 17,515
  • 9
  • 56
  • 72
  • Thanks Robert, I figured it out just seconds before you commented. It looks like I need to make sure to know the length of the string that I want to encrypt and decrypt. or probably use some default bytes to have all strings the same lengths in bytes. Anyone has a better solution on encryption query string values and decrypting them back. Keep in mind I am trying to use a short url. – Ridvan Feb 03 '11 at 07:16