Which code should you use?

DRAG DROP
You have the following code.
string MessageString = ?his is the original message!?
You need to store the SHA1 hash value of MessageString in a variable named HashValue.
Which code should you use? Develop the solution by selecting and arranging the required code blocks in the correct order. You may not need all of the code blocks.


Select and Place:

microsoft-exams

2 thoughts on “Which code should you use?

  1. static void Main(string[] args)
    {
    string message = “Bismillahirrahmanirrahim”;
    UnicodeEncoding ue = new UnicodeEncoding();
    byte[] messageBytes = ue.GetBytes(message);
    SHA1Managed sh = new SHA1Managed();
    byte[] hasedMessage = sh.ComputeHash(messageBytes);

    Console.ReadLine();

    }

  2. the correct answer should be:
    1. UnicodeEncoding UE = new UnicodeEncoding();
    2. SHA1Managed SHhash = new SHA1Managed();
    3. byte[] MessageBytes = UE.GetBytes(MessageString);
    4. byte[] HashValue = SHhash.ComputeManaged(MessageBytes);

    because GetHashCode function is only for internal use

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.