Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SHA1 Hashing in asp.net...

  • 26-03-2009 11:41am
    #1
    Closed Accounts Posts: 7,097 ✭✭✭


    Hi all,

    I'm using the following lines of code to convert a string called newstring into an SHA1 string called password and display it back to the screen:

    string hashMethod = "";

    hashMethod = "SHA1";


    string password = FormsAuthentication.HashPasswordForStoringInConfigFile(newstring, hashMethod);
    Response.Write(password);
    Label2.Text = password.ToString();


    It does exactly what it says on the tin, the only thing is that the hashed result I get is all in uppercase, but when I put the same contents of the newstring variable through several 3rd party websites that offer free SHA1 hashing through their website, I get the same string back, but it is all in lowercase. The only reason I want to keep the results in lowercase is because I have to concatenate another lowercase string onto the hashed
    result I get through the above (which should be in lowercase), and hash it using SHA1 again, so I'm reckoning if one part of the string is not all in lowercase, I could end up with any result...

    I'm wondering is there anyway I can stick in a bit of code to what I have above, to make the value of password all lowercase or to convert it to lowercase without too much of a fuss???

    :confused::confused::confused:


Comments

  • Closed Accounts Posts: 7,097 ✭✭✭Darragh29


    I have it sorted, I use:

    Label2.Text = password.ToLower();

    Instead of

    Label2.Text = password.ToString();

    Thanks anyone for reading...


Advertisement