kylecharlesbotha / SEN381-Project

Software Engineering 381 Project/Belgium Campus
0 stars 0 forks source link

Please Finish Methods for Login Screen #75

Closed DarrenOosthuizen closed 3 years ago

DarrenOosthuizen commented 3 years ago

Hi There

Please finish all the methods needed on the frmLoginScreen

Please implement the following

So when you retrieve the user salt from tblUser run the CreateSH256Hash with the password and salt as input

Then take the return string and match it against the password in the record

public String CreateSHA256Hash(string input, string salt)
        {
            byte[] bytes = Encoding.UTF8.GetBytes(input + salt);
            SHA256Managed sha256hashstring = new SHA256Managed();
            byte[] hash = sha256hashstring.ComputeHash(bytes);

            return ByteArrayToStrng(hash);
        }
```
private static string ByteArrayToStrng(byte[] ba)
    {
        StringBuilder hex = new StringBuilder(ba.Length * 2);
        foreach (byte b in ba)
        {
            hex.AppendFormat("{0:x2}", b);
        }
        return hex.ToString();
    }
DarrenOosthuizen commented 3 years ago

PS!! Remeber to go from presentation layer ---> Business Access Layer -->Data Access Layer

Plage25 commented 3 years ago

Hey,

all done.