PasswordDeriveBytes Question

Posted on 2009-02-22
Last Modified: 2012-06-27

I'm experimenting with this code (trying to get an understanding of how encryption works).

I was expecting this code to output a password based upon the parameters that I've placed into it.  The actual output from this code is:

Press any key to continue . . .

Is this correct?  Or is there a method of PasswordDeriveBytes that I need to call?

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Security.Cryptography;

namespace PasswordDerive


    class Program


        static void Main(string[] args)


            string passPhrase = "testphase";

            string saltValue = "salt";

            string hashAlgorithm = "SHA1";

            int passwordIterations = 2;

            byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue);

            PasswordDeriveBytes password = new PasswordDeriveBytes(









Open in new window

Question by:andyw27
    1 Comment
    LVL 19

    Accepted Solution

    Depending on what you are trying to do you can review the available member methods of the PasswordDeriveBytes object

    The key it generates is not really readable in the normal sense, you could for example output a base64 encoded string to see some sample output like in the code snippet below (simply replace line 28 above). Its real purpose is to generate a secure key for an ecryption algorithm, you can see good examples and references of its intended usage at:


    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now