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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:34:16+00:00 2026-05-28T01:34:16+00:00

So this is how I am doing encryption right now: public static byte[] Encrypt(byte[]

  • 0

So this is how I am doing encryption right now:

public static byte[] Encrypt(byte[] Data, string Password, string Salt)
        {
            char[] converter = Salt.ToCharArray();
            byte[] salt = new byte[converter.Length];
            for (int i = 0; i < converter.Length; i++)
            {
                salt[i] = (byte)converter[i];
            }

            PasswordDeriveBytes pdb = new PasswordDeriveBytes(Password, salt);
            MemoryStream ms = new MemoryStream();
            Aes aes = new AesManaged();
            aes.Key = pdb.GetBytes(aes.KeySize / 8);
            aes.IV = pdb.GetBytes(aes.BlockSize / 8);
            CryptoStream cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write);

            cs.Write(Data, 0, Data.Length); 
            cs.Close();

            return ms.ToArray();
        }

I am using this algorithm on data streaming over a network. The problem is it is a bit slow for what I am trying to do. So I was wondering if anyone has better way of doing it? I am no expert on encryption this method was pieced together from different sources. I am not entirely sure how it works.

I have clocked it at about 0.5-1.5ms and I need to get it down to about 0.1ms any ideas?

  • 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-28T01:34:17+00:00Added an answer on May 28, 2026 at 1:34 am

    I’m pretty sure that performance is the least of your problems here.

    Is the salt re-used for each packet? If so, you’re using a strong cypher in a weak fashion. You’re starting each packet with the cypher in exactly the same state. This is a security flaw. Someone skilled in cryptography would be able to crack your encryption after only a couple thousand packets.

    I’m assuming you’re sending a stream of packets to the same receiver. In that case, your use of AES will be much stronger if you keep the Aes object around and re-use it. That will make your use of the cypher much, much stronger and speed things up greatly.

    As to the performance question, most of your time is being spent initializing the cypher. If you don’t re-initialize it every time, you’ll speed up quite a lot.

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

Sidebar

Related Questions

I have a .NET method for doing DES encryption on a string: public static
I am doing connection string encryption . we use our own encryption key with
I've come up with this little routine for doing encryption using the SHA-2 (in
I am doing an encryption decryption of file in android, for this purpose I
I am doing RSA encryption and I have to split my long string into
I am looking to encrypt data. I want to generate encryption keys based on
Im doing this project where i need to download files through a webservice (images,
This is my first time doing this sort of project so apologies if the
I'm doing this system Stacked and I am creating the search function. And in
I am doing this in groovy. Input: hip_abc_batch hip_ndnh_4_abc_copy_from_stgig abc_copy_from_stgig hiv_daiv_batch hip_a_de_copy_from_staging abc_a_de_copy_from_staging I

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.