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 7490133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:33:18+00:00 2026-05-29T15:33:18+00:00

I am using TripleDESCryptoServiceProvider class encrypt string which is provided Here I am getting

  • 0

I am using TripleDESCryptoServiceProvider class encrypt string which is provided Here

I am getting same encrypted string in the desktop code(not WP7 simple c#) with initilization vector = { 0, 0, 0, 0, 0, 0, 0, 0}
but if i change the IV to { 64, 64, 64, 64, 64, 64,64, 64} i am getting different encrypted strings .
for converting from byte string i am using the base64 encoding.
Here is my code:
Note:If i use the WP7 encrypted string tro decrypt in desktop first 8 characters are not decrypted correctly, remaining characters are correct. means in “Hi my friends ! I am safe with TripleDES :)”); only “ends ! I am safe with TripleDES :)” this much correct. some junk at starting.

 private static byte[] sharedkey ={
            0x01, 0x02, 0x03, 0x05, 0x07, 0x0B, 0x0D, 0x11, 
            0x12, 0x11, 0x0D, 0x0B, 0x07, 0x02, 0x04, 0x08, 
            0x01, 0x02, 0x03, 0x05, 0x07, 0x0B, 0x0D, 0x11
          };
    private static byte[] sharedvector = new byte[] { 64, 64, 64, 64, 64, 64, 64, 64 };

var toEncrypt = Encoding.UTF8.GetBytes(“Hi my friends ! I am safe with TripleDES :)”);

        TripleDESCryptoServiceProvider tdesAlgorithm = new TripleDESCryptoServiceProvider();

        // Create the encryptor
        ICryptoTransform encryptor = tdesAlgorithm.CreateEncryptor(sharedkey, sharedvector);
        var cryptedBytes = encryptor.TransformFinalBlock(toEncrypt, 0, toEncrypt.Length);

        // Create the decryptor
        ICryptoTransform decryptor = tdesAlgorithm.CreateDecryptor(sharedkey, sharedvector);
        var decryptedBytes = decryptor.TransformFinalBlock(cryptedBytes, 0, cryptedBytes.Length);

        var uncryptedString = Encoding.UTF8.GetString(decryptedBytes, 0, decryptedBytes.Length);

EDIT: Looks like for ECB, the IV is ignored. In the code provided by Nocolus. Will you please tell me how to change that.

  • 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-05-29T15:33:19+00:00Added an answer on May 29, 2026 at 3:33 pm

    Try this post. Although, it is for AES encryption, it might help in your situation.
    Bouncy Castle’s code supports Triple DES.

    Hope that helps.

    AFAIK, ECB does not need an Initialization Vector. Also, avoid ECB if you can, the alternatives are more secure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I am using TripleDESCryptoServiceProvider to encrypt a series of bytes in C#. The key
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange
Using android 2.3.3, I have a background Service which has a socket connection. There's
I have the following code to encrypt a value (listed below). Now I would
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
It is use to encrypt a string to create a unique fingerprint like 8FAC-5806-FF54-4174-F89E-43DE-97A6-5648.
I'm using DES encryption, and I want to store the key of TripleDESCryptoServiceProvider. But

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.