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

  • Home
  • SEARCH
  • 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 4111220
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:02:18+00:00 2026-05-20T22:02:18+00:00

I am just becoming familiar with encryption and the .NET framework. After looking at

  • 0

I am just becoming familiar with encryption and the .NET framework. After looking at many examples I am seeing a repeated pattern that confuses when using the .NET Class Rfc2898DeriveBytes. When using this class to obtain an encryption key and an initialization vector the same method seems to be used.

Here is some code from an MSDN blog that demonstrates obtaining a key and an initialization vector.

byte[] salt = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 };
Rfc2898DeriveBytes pwdGen = new Rfc2898DeriveBytes("P@$$w0rd", salt, 1000);

// generate an RC2 key
byte[] key = pwdGen.GetBytes(16);
byte[] iv = pwdGen.GetBytes(8);

I have seen this used in other places also. I guess I would have thought it would be something like this …

// generate an RC2 key
byte[] key = pwdGen.GetKey();
byte[] iv = pwdGen.GetInitializationVector();

I MUST be missing something here. If the Key and Initialization Vector (IV) are just random numbers how are they obtained again when using the proper password and salt?

  • 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-20T22:02:19+00:00Added an answer on May 20, 2026 at 10:02 pm

    The RFC2898 key derivation algorithm is deterministic. When you run it with the same inputs, you’ll get the same outputs.

    So as long as you call GetBytes() in the same order, requesting the same number of bytes, you’ll get the same key and IV.

    Don’t forget that in a real system the salt should be randomly generated at encryption time (and stored so that it can be retrieved at decryption time).

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

Sidebar

Related Questions

I'm just becoming dive into php after ages working in vb.net. I wanna write
Just looking for the first step basic solution here that keeps the honest people
I'm just starting to learn about jQuery and am becoming familiar with how jQuery
I'm biting the bullet and becoming a Web Designer, there are just too many
I just realized something: Nearly everything in D is becoming templated. That' awesome for
G'day, I have been involved in a project that has required my becoming familiar
I'm working on becoming as familiar with C# as I am with VB.NET (the
Just how much slower are events? I have written a streaming XML parser (that
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview
I'm importing data from an excel file and I just noticed that some cells

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.