mysql hash generator in python

Discussion in 'Python' started by Matías Hernández, Dec 16, 2008.

  1. (sorry for my english, but i'm speak spanish)
    Hi list.. this is my first post... and obviously if for help..

    I try to implement the password function of mysql in a python script.

    I read that the password function of mysql was implemented with a double
    sha1()

    I python i try this:
    example1:
    if __name__=="__main__":
    s = hashlib.sha1()
    s.update('test')
    s2 = hashlib.sha1()
    s2.update(s.digest()
    print s2.hexdigest()

    This script show me the same hash that password function of mysql, but
    when i implement this in a class the hash is different??? why???

    And if is posible??? can you show a example code of old_password
    function of mysql in python???

    THNX
    Matías Hernández, Dec 16, 2008
    #1
    1. Advertising

  2. Matías Hernández

    News123 Guest

    Hi Matias.


    Could you show us the 'class implementation'?


    Whether class or not the result should be the same.
    If it isn't, then there should be a small error.
    If we have both code versions to look at it's easier to help you.


    bye


    N


    Matías Hernández wrote:
    > (sorry for my english, but i'm speak spanish)
    > Hi list.. this is my first post... and obviously if for help..
    >
    > I try to implement the password function of mysql in a python script.
    >
    > I read that the password function of mysql was implemented with a double
    > sha1()
    >
    > I python i try this:
    > example1:
    > if __name__=="__main__":
    > s = hashlib.sha1()
    > s.update('test')
    > s2 = hashlib.sha1()
    > s2.update(s.digest()
    > print s2.hexdigest()
    >
    > This script show me the same hash that password function of mysql, but
    > when i implement this in a class the hash is different??? why???
    >
    > And if is posible??? can you show a example code of old_password
    > function of mysql in python???
    >
    > THNX
    News123, Dec 17, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Maurer
    Replies:
    3
    Views:
    4,782
    Peter
    Apr 19, 2006
  2. Robert Oschler
    Replies:
    2
    Views:
    1,003
  3. Matías Hernández

    python mysql hash generator

    Matías Hernández, Dec 19, 2008, in forum: Python
    Replies:
    0
    Views:
    388
    Matías Hernández
    Dec 19, 2008
  4. rp
    Replies:
    1
    Views:
    498
    red floyd
    Nov 10, 2011
  5. Srijayanth Sridhar
    Replies:
    19
    Views:
    598
    David A. Black
    Jul 2, 2008
Loading...

Share This Page