#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Questioner's home
    Posts
    89
    Rep Power
    12

    Beginner's encryption


    I would like to encrypt the password for my program so that users cant easily open it up and change it. Also, I want to learn how to write it myself instead of using some library file, can someone be kind enough to do a simple demonstration on how to encrypt and decrypt?
    What can change the nature of a man?
  2. #2
  3. onCsdfeu
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Canada
    Posts
    100
    Rep Power
    12
    Well there are literally dozens of encryption methods, from the very simple Caesar cypher (A = B, B = C, C = D, etc.) to RSA.

    You could use the md5 or sha modules ; just look at Python's library reference under section 15: cryptographic services.

    If you really want to code your own, though, you should look for the Handbook of Applied Cryptography which is completely free. Not a beginner's book, though, but a precious resource nonetheless.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Questioner's home
    Posts
    89
    Rep Power
    12
    Interesting, I'd read the doc and md5 looks like a nice choice, I think I'll use that first b4 I write myself one, but how do you decrypt/undigest the encrypted/digested passwords?
    What can change the nature of a man?
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    MD5 is nice, definatly one of the most well used encryptions.. the bad (or good depending on how you look at it) thing about this being there is no decryption, MD5 purly one way!

    So if your working with passwords you're actually gonna need to compare rather than decrypt

    Mark.
    programming language development: www.netytan.com Hula

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    35
    Rep Power
    12
    I've used this before, it works pretty well: http://home.pacific.net.au/~twhitema/des.html

    This implementation is written in pure python, there is another written in C floating around somewhere, but I found the one I listed above to be a little easier to use. I think the C one implements other algorithms than DES and 3DES.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Questioner's home
    Posts
    89
    Rep Power
    12
    Or maybe I'll use rotor, is that a bad choice?
    What can change the nature of a man?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    325
    Rep Power
    12
    yes rotor is bad choice

    Use md5 if it is for securing passwords.
    It's one of most secure things. And that is due to the fact that you can't unencrypt it (unless you for a very long time anyway). Only compare the md5'ed inputted password to the stored md5-ed password
  14. #8
  15. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Add that to the fact that rotor was found to be insecure and was depreciated in Python 2.3 and i'm with Yogi on this one . Stick with md5...

    Mark.
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo