how do i decrypt this? =(

Last post 08-22-2007 4:44 AM by klaus_b. 2 replies.

Sort Posts:

  • how do i decrypt this? =(

    08-22-2007, 2:59 AM
    • Member
      point Member
    • zookie
    • Member since 02-08-2007, 6:36 AM
    • Posts 3

     hi there..i was given this function....

     

    public static string EncryptSHA256(string plainMessage)
    {
    	byte[] data = Encoding.UTF8.GetBytes(plainMessage);
    	using (HashAlgorithm sha = new SHA256Managed())
    	{
    		byte[] encryptedBytes = sha.TransformFinalBlock(data, 0, data.Length);
    		return Convert.ToBase64String(sha.Hash);
    	}
    }

      

    how do i decrypt the value returned by this function and get the original value(plainMessage string)?

    thanks 

    Filed under: ,
  • Re: how do i decrypt this? =(

    08-22-2007, 4:05 AM
    Answer
    • Participant
      1,340 point Participant
    • Imco
    • Member since 06-24-2007, 2:35 AM
    • Posts 191

    Hi zookie,

    You're creating a hash with the code as opposed to encrypting something.

    Hashes are not reversible, so you won't be able to determine the original value from the output.

    With weaker hashes your best hope for recovery is a 'reverse lookup' (as a hash for a given input is consistent) from a pre-existing dictionary, but I'm not aware of any for any algorithm other than md5. Failing that the only real option is a "brute force" approach where you create hashes until you find a match. With SHA256 that would likely take a very a long time.

    I hope that helps.
     

  • Re: how do i decrypt this? =(

    08-22-2007, 4:44 AM
    Answer
    • Contributor
      2,847 point Contributor
    • klaus_b
    • Member since 05-03-2006, 9:11 AM
    • Bavaria, Germany
    • Posts 566

    Hi zookie,

    say it short, noway. Like Imco allready explained is it from very hard to impossible to get the origibal value from a hash.

    A hash is not a method to encrypt and decrypt data. It is similar a fingerprint, to verify a given file or a email adress is not modified or corrupted from a third person. Normally you get a hash value, or sometimes called checksum, and the algorithm to create your own hash and then compare this two values to verify the integrity of the data you've get.

    Here is a more detailed explanation about the hash functions.

    Hope could help clarify your question.

     

    Servus,
    Klaus

    I haven't the faintest idea, but great many therefrom.
    klaus_b@.NET
Page 1 of 1 (3 items)