C++ MFC Dialog Password encryption Vs2005 [moved]
-
i have done my insertion code for the registration form but now i have to do password encryption after register which i totally have no idea on how to do it in C++ MFC dialog application. please help me if u have any source files. just encrypt the password part.
UpdateData();
MYSQL \*ssock; ssock = (MYSQL \*)malloc(sizeof(MYSQL)); mysql\_init(ssock); conn = mysql\_init(NULL); if (conn == NULL) { printf("Error %u: %s\\n", mysql\_errno(conn), mysql\_error(conn)); exit(1); } if (mysql\_real\_connect(conn, "127.0.0.1", "root", "Root", "inomatic", 0, NULL, 0) == NULL) { printf("Error %u: %s\\n", mysql\_errno(conn), mysql\_error(conn)); exit(1); } int tmp = atoi((LPSTR)(LPCTSTR)m\_Contact); if(m\_Password != m\_CfmPassword) { MessageBox("Both Password do not match! Please enter again."); m\_EditPassword.SetFocus(); } if(m\_Username == "" || m\_Password=="" || m\_CfmPassword =="" || m\_Email =="" || m\_Contact =="" || m\_Company == "") { MessageBox("Please fill in all the blanks."); } else if (m\_Password == m\_CfmPassword) { Insert(conn,(LPSTR)(LPCTSTR)m\_Username,(LPSTR)(LPCTSTR)m\_Password,(LPSTR)(LPCTSTR)m\_Email,tmp,(LPSTR)(LPCTSTR)m\_Company,"User"); MessageBox("Thank You! You have successfully registed into People Counter Application."); } UpdateData(FALSE); mysql\_close(conn); //Clear text after register ====================================================================================================================================== m\_EditUsername.SetSel(0,-1),m\_EditPassword.SetSel(0,-1),m\_EditCfmPassword.SetSel(0,-1),m\_EditEmail.SetSel(0,-1),m\_EditContact.SetSel(0,-1),m\_EditCompany.SetSel(0,-1); m\_EditUsername.Clear(); m\_EditPassword.Clear(); m\_EditCfmPassword.Clear(); m\_EditEmail.Clear(); m\_EditContact.Clear(); m\_EditCompany.Clear();
Winter
-
i have done my insertion code for the registration form but now i have to do password encryption after register which i totally have no idea on how to do it in C++ MFC dialog application. please help me if u have any source files. just encrypt the password part.
UpdateData();
MYSQL \*ssock; ssock = (MYSQL \*)malloc(sizeof(MYSQL)); mysql\_init(ssock); conn = mysql\_init(NULL); if (conn == NULL) { printf("Error %u: %s\\n", mysql\_errno(conn), mysql\_error(conn)); exit(1); } if (mysql\_real\_connect(conn, "127.0.0.1", "root", "Root", "inomatic", 0, NULL, 0) == NULL) { printf("Error %u: %s\\n", mysql\_errno(conn), mysql\_error(conn)); exit(1); } int tmp = atoi((LPSTR)(LPCTSTR)m\_Contact); if(m\_Password != m\_CfmPassword) { MessageBox("Both Password do not match! Please enter again."); m\_EditPassword.SetFocus(); } if(m\_Username == "" || m\_Password=="" || m\_CfmPassword =="" || m\_Email =="" || m\_Contact =="" || m\_Company == "") { MessageBox("Please fill in all the blanks."); } else if (m\_Password == m\_CfmPassword) { Insert(conn,(LPSTR)(LPCTSTR)m\_Username,(LPSTR)(LPCTSTR)m\_Password,(LPSTR)(LPCTSTR)m\_Email,tmp,(LPSTR)(LPCTSTR)m\_Company,"User"); MessageBox("Thank You! You have successfully registed into People Counter Application."); } UpdateData(FALSE); mysql\_close(conn); //Clear text after register ====================================================================================================================================== m\_EditUsername.SetSel(0,-1),m\_EditPassword.SetSel(0,-1),m\_EditCfmPassword.SetSel(0,-1),m\_EditEmail.SetSel(0,-1),m\_EditContact.SetSel(0,-1),m\_EditCompany.SetSel(0,-1); m\_EditUsername.Clear(); m\_EditPassword.Clear(); m\_EditCfmPassword.Clear(); m\_EditEmail.Clear(); m\_EditContact.Clear(); m\_EditCompany.Clear();
Winter
As you were said in the previous post, this is the wrong forum for such questions. Please search the right forum and post it there. Here is to post about the internal things of the site
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
-
i have done my insertion code for the registration form but now i have to do password encryption after register which i totally have no idea on how to do it in C++ MFC dialog application. please help me if u have any source files. just encrypt the password part.
UpdateData();
MYSQL \*ssock; ssock = (MYSQL \*)malloc(sizeof(MYSQL)); mysql\_init(ssock); conn = mysql\_init(NULL); if (conn == NULL) { printf("Error %u: %s\\n", mysql\_errno(conn), mysql\_error(conn)); exit(1); } if (mysql\_real\_connect(conn, "127.0.0.1", "root", "Root", "inomatic", 0, NULL, 0) == NULL) { printf("Error %u: %s\\n", mysql\_errno(conn), mysql\_error(conn)); exit(1); } int tmp = atoi((LPSTR)(LPCTSTR)m\_Contact); if(m\_Password != m\_CfmPassword) { MessageBox("Both Password do not match! Please enter again."); m\_EditPassword.SetFocus(); } if(m\_Username == "" || m\_Password=="" || m\_CfmPassword =="" || m\_Email =="" || m\_Contact =="" || m\_Company == "") { MessageBox("Please fill in all the blanks."); } else if (m\_Password == m\_CfmPassword) { Insert(conn,(LPSTR)(LPCTSTR)m\_Username,(LPSTR)(LPCTSTR)m\_Password,(LPSTR)(LPCTSTR)m\_Email,tmp,(LPSTR)(LPCTSTR)m\_Company,"User"); MessageBox("Thank You! You have successfully registed into People Counter Application."); } UpdateData(FALSE); mysql\_close(conn); //Clear text after register ====================================================================================================================================== m\_EditUsername.SetSel(0,-1),m\_EditPassword.SetSel(0,-1),m\_EditCfmPassword.SetSel(0,-1),m\_EditEmail.SetSel(0,-1),m\_EditContact.SetSel(0,-1),m\_EditCompany.SetSel(0,-1); m\_EditUsername.Clear(); m\_EditPassword.Clear(); m\_EditCfmPassword.Clear(); m\_EditEmail.Clear(); m\_EditContact.Clear(); m\_EditCompany.Clear();
Winter
Do not use encryption for passwords. You should add a salt value and use the two pieces of data to create a one-way hash which you store in your database. Remember, encrypted data can be decrypted, hashes cannot. There are many articles and samples explaining this in detail, including Secure Password Authentication Explained Simply[^].