using System.Security.Cryptography;
using System.Text;
1
2
3
| protected void btnLogin_Click(object sender, EventArgs e) { } |
1
2
3
4
5
6
7
8
9
10
11
| public string EncryptionBySHA512(string Password) { SHA512 d_EncryptionSHA512 = new SHA512Managed(); byte[] ByteHasEncryption = d_EncryptionSHA512.ComputeHash(Encoding.Default.GetBytes(Password)); StringBuilder StrBuilderStringEncryption = new StringBuilder(); for (int i = 0; i < ByteHasEncryption.Length; i++) { StrBuilderStringEncryption.Append(ByteHasEncryption[i].ToString( "x2" )); } return StrBuilderStringEncryption.ToString(); } |
1
2
3
4
5
6
| string pass = EncryptionBySHA512(txtPassword.Text); if (pass == "c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec" && txtUserName.Text == "quantri" ) { } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| protected void btnLogin_Click(object sender, EventArgs e) { string pass = EncryptionBySHA512(txtPassword.Text); if (pass == "c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec" && txtUserName.Text == "quantri" ) { } } public string EncryptionBySHA512(string Password) { SHA512 d_EncryptionSHA512 = new SHA512Managed(); byte[] ByteHasEncryption = d_EncryptionSHA512.ComputeHash(Encoding.Default.GetBytes(Password)); StringBuilder StrBuilderStringEncryption = new StringBuilder(); for (int i = 0; i < ByteHasEncryption.Length; i++) { StrBuilderStringEncryption.Append(ByteHasEncryption[i].ToString( "x2" )); } return StrBuilderStringEncryption.ToString(); } |
Comments[ 0 ]
Đăng nhận xét