PrepAway - Latest Free Exam Questions & Answers

Which code should you use?

DRAG DROP
You have the following code.
string MessageString = “This 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:

PrepAway - Latest Free Exam Questions & Answers

Answer:

2 Comments on “Which code should you use?

  1. bmvr says:

    /*Variable Declaration*/
    UnicodeEnconding UE = new UnicodeEnconding();
    SHA1Managed SHhash = new SHA1Managed();

    /*msg bytes*/
    byte[] MessageBytes = UE.GetBytes(MessageString);

    /*compute hash*/
    byte[] HashValue = SHhash.ComputeHash(MessageBytes);

    Answer:
    UnicodeEnconding UE = new UnicodeEnconding();
    SHA1Managed SHhash = new SHA1Managed();
    byte[] MessageBytes = UE.GetBytes(MessageString);
    byte[] HashValue = SHhash.ComputeHash(MessageBytes);

    Note:
    Variables can be declared above everything, or can be declared right before the method usage.

    UnicodeEnconding UE = new UnicodeEnconding();
    byte[] MessageBytes = UE.GetBytes(MessageString);

    SHA1Managed SHhash = new SHA1Managed();
    byte[] HashValue = SHhash.ComputeHash(MessageBytes);




    23



    0

Leave a Reply