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. Encrypt password

Encrypt password

Scheduled Pinned Locked Moved C / C++ / MFC
comalgorithmscryptographyquestionlearning
5 Posts 4 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
    Wim Jans
    wrote on last edited by
    #1

    Hello all, Does anyone of you know of a simple class to encrypt my password before I write it to a file? And of course decrypt it again so I can use it ;) I had a look at the 2 articles in system/cryptography, but they don't fit my needs. I also looked at an app using crypto++[^], but that seemed like a bit of overkill too. So basically I'm looking for a simple class that encrypts/decrypts my password using whatever algorithm (MD5, PKI, ...). Or any pointers how I can start my own class. tia Wim

    M R 2 Replies Last reply
    0
    • W Wim Jans

      Hello all, Does anyone of you know of a simple class to encrypt my password before I write it to a file? And of course decrypt it again so I can use it ;) I had a look at the 2 articles in system/cryptography, but they don't fit my needs. I also looked at an app using crypto++[^], but that seemed like a bit of overkill too. So basically I'm looking for a simple class that encrypts/decrypts my password using whatever algorithm (MD5, PKI, ...). Or any pointers how I can start my own class. tia Wim

      M Offline
      M Offline
      Mike Nordell
      wrote on last edited by
      #2

      Wim Jans wrote: Does anyone of you know of a simple class to encrypt my password before I write it to a file? And of course decrypt it again so I can use it Cryptography isn't simple. Period. If you had a look at some real cryptography but you deemed it "a bit of overkill", perhaps what you want isn't anything cryptographically safe? What about xor'ing the password with some known value and the just hash it? Maybe even a plain SHA or even a CRC32 could be fine...

      W 1 Reply Last reply
      0
      • M Mike Nordell

        Wim Jans wrote: Does anyone of you know of a simple class to encrypt my password before I write it to a file? And of course decrypt it again so I can use it Cryptography isn't simple. Period. If you had a look at some real cryptography but you deemed it "a bit of overkill", perhaps what you want isn't anything cryptographically safe? What about xor'ing the password with some known value and the just hash it? Maybe even a plain SHA or even a CRC32 could be fine...

        W Offline
        W Offline
        Wim Jans
        wrote on last edited by
        #3

        Hi Mike, Thanks for the answer. I will have a look at the CRC32 or SHA stuff. With 'a bit of overkill' I meant that they offer a wealth of encryption algorithms in one library, while I just needed one. So it would be nice of one had a class with only eg. a MD5 algorithm in it. Thanks again Wim

        K 1 Reply Last reply
        0
        • W Wim Jans

          Hi Mike, Thanks for the answer. I will have a look at the CRC32 or SHA stuff. With 'a bit of overkill' I meant that they offer a wealth of encryption algorithms in one library, while I just needed one. So it would be nice of one had a class with only eg. a MD5 algorithm in it. Thanks again Wim

          K Offline
          K Offline
          karl_w
          wrote on last edited by
          #4

          If you want to decrypt your password again, you can't use SHA (Secure Hash Algorithm) or MD5 (Message Digest 5) because they are hashing-algorithms. Hashing algorithms are one-way-functions. That means that one direction is (very) easy to do ("encrypt") but the other ("decrypt") is nealy impossible. Look up for a definition of hashing algorithms in the internet and you wil see you can't use them. What you want is an encryption/decryption algorithm like RSA, DES, AES and so on. Some of them are built in to the CryptoAPI integrated in Windows. -- karl

          1 Reply Last reply
          0
          • W Wim Jans

            Hello all, Does anyone of you know of a simple class to encrypt my password before I write it to a file? And of course decrypt it again so I can use it ;) I had a look at the 2 articles in system/cryptography, but they don't fit my needs. I also looked at an app using crypto++[^], but that seemed like a bit of overkill too. So basically I'm looking for a simple class that encrypts/decrypts my password using whatever algorithm (MD5, PKI, ...). Or any pointers how I can start my own class. tia Wim

            R Offline
            R Offline
            Rickard Andersson20
            wrote on last edited by
            #5

            Search your MSDN Library! There is good examples there in how you encrypt/decrypt. Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!

            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