Chroma-Hash implementation in Python

I’ve just read an experiment by mattt.me about creating a multi-colored area beside the password area in order to let people who have extremely long passwords know that their passwords matches.

http://mattt.me/2009/07/chroma-hash-a-belated-introduction/

Personally I thought that this is an extremely neat concept, but of course, also extremely unsafe (unless the passwords aren’t hashed when they are stored…)

So now I got to thinking, what if we can implement this feature into the login box? Basically, the user types in his username and the chromahashed password is automatically visualized and the user can match it up with the chroma-hashed visualization? So in order to do that, the server could return segments of secure html color codes hashed from the user’s password and display it onto the screen so users can make sure that their passwords are correct.

Since I’m mostly a python developer, I’ve decided to create a port of Chroma-Hash for python (You have to admit, django’s pretty popular these days and who knows who else is going to be needing this) And so without further delays, I present to you pyChroma – A python port of Chroma-Hash

http://github.com/leegao/pyChroma/

Here’s the class __doc__

"""
@author: Lee Gao
@contact: http://6.dot.ch/
@note:
    This is a re-implementation of mattt*'s Chroma-Hash calculator.

http://mattt.me/2009/07/chroma-hash-a-belated-introduction/

@param param:
    password: The password to chroma-hash
    default: The number of colors to return
    _hash: If the password is already hashed by another algorithm or is
           already a MD5 hash, then the _hash function (which takes only one parameter)
           will return a MD5 compatible hash
           SHA1 will be implemented when mattt decides to update his Chroma-Hash specs
@return:
    chroma object with 1-4 HTML color items.
@ivar ivar:
    chroma.colors - array of the chroma-hashed colors
Example:
    from Chroma import chroma
    myColors = chroma("password")
"""
This entry was posted in Programming, Python, Snippets and tagged , , , , , , , , , , , , . Bookmark the permalink.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>