Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C++ MFC Dialog Password encryption Vs2005 [moved]

C++ MFC Dialog Password encryption Vs2005 [moved]

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpmysqlsecurityregex
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WinterC
    wrote on last edited by
    #1

    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

    N L 2 Replies Last reply
    0
    • W WinterC

      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

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • W WinterC

        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

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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[^].

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups