PasswordMaker Forums

Other Editions => Other Editions - Feature Requests / Enhancements => Topic started by: richbeales on November 12, 2008, 07:29:49 AM

Title: Patch for Python port
Post by: richbeales on November 12, 2008, 07:29:49 AM
Hi All,

This is my first post on the forums, I really like the project and the firefox extension is excellent, however I'm more interested in getting a Python port up to date and more functional for everyday usage.

To that end I'm submitting this patch in the hope that it's useful to others and can be committed to the project.   This is the product of a couple of hours yesterday, and although i'm a developer I'm still learning Python so please forgive any non-pythonisms!  Hopefully if I have time it'll be the first patch of many.

The main changes are:
1) file split into two modules - passwordmaker.py and pwmlib.py
2) settings class added with initial support for saving/retrieving
settings to a file (pwm.settings) (in gui mode only)
3) a few minor typos fixed

This has been tested with Python 2.4/Windows, Python 2.6/Windows and Python 2.6/Linux.

Files located at: http://www.richbeales.net/passwordmaker-patch20081112.zip

Regards,

Rich.
Title: Re: Patch for Python port
Post by: Eric H. Jung on November 12, 2008, 06:27:21 PM
Rich,

Thanks very much for the patch. I had a look through it briefly, and it looks good. I'll need to generate a diff/patch file so it can be submitted to Subversion, though. Miquel, have you had a look at it? Tanstaafl?

Eric
Title: Re: Patch for Python port
Post by: Miquel 'Fire' Burns on November 12, 2008, 09:48:43 PM
Actually, a diff is not really needed. I took a quick peak at it already, just waiting until I have time to check on one thing, if we need to include the setting file or not.
Title: Re: Patch for Python port
Post by: richbeales on November 13, 2008, 01:25:15 AM
Hi,

The settings file will be generated automatically if it is not found.

Regards,

Rich.
Title: Re: Patch for Python port
Post by: Eric H. Jung on November 13, 2008, 03:17:16 AM
miquel, feel free to commit this before me if you agree the changes are OK. I still haven't gotten a diff to see more precisely what's changed. My SVN client is hosed, gotta find 15 spare minutes to figure out why and/or reinstall.
Title: Re: Patch for Python port
Post by: Miquel 'Fire' Burns on November 13, 2008, 04:25:44 AM
The diff would basically show most of the code leaving passwordmaker.py and being put into pwmlib.py, which happens to cause it to have the same config setup as the PHP version now. Then there's the saving of the changes as well.

It's committed now.
Title: Re: Patch for Python port
Post by: Eric H. Jung on November 13, 2008, 04:05:08 PM
Thanks, Miquel. Rich, we look forward to more contributions.

Eric
Title: Re: Patch for Python port
Post by: tanstaafl on November 14, 2008, 06:03:51 PM
Thanks very much for the patch. I had a look through it briefly, and it looks good. I'll need to generate a diff/patch file so it can be submitted to Subversion, though. Miquel, have you had a look at it? Tanstaafl?
Looks good to me... but since I'm not a programmer, any code looks 'good' to me... ;)
Title: Re: Patch for Python port
Post by: Eric H. Jung on November 15, 2008, 03:14:42 AM
Thanks very much for the patch. I had a look through it briefly, and it looks good. I'll need to generate a diff/patch file so it can be submitted to Subversion, though. Miquel, have you had a look at it? Tanstaafl?
Looks good to me... but since I'm not a programmer, any code looks 'good' to me... ;)

How's this (http://www0.us.ioccc.org/2004/omoikane.c) look then?
Title: Re: Patch for Python port
Post by: Miquel 'Fire' Burns on November 15, 2008, 05:24:56 AM
How's this (http://www0.us.ioccc.org/2004/omoikane.c) look then?
Wow!
Title: Re: Patch for Python port
Post by: Eric H. Jung on November 15, 2008, 04:13:03 PM
Do we need to issue a new python release now?
Title: Re: Patch for Python port
Post by: tanstaafl on November 15, 2008, 05:40:19 PM
How's this (http://www0.us.ioccc.org/2004/omoikane.c) look then?

Ha! 'tis a thing of beauty...
Title: Re: Patch for Python port
Post by: Miquel 'Fire' Burns on November 16, 2008, 01:02:00 AM
Do we need to issue a new python release now?
Never had an official release to begin with actually.
Title: Re: Patch for Python port
Post by: richbeales on May 21, 2012, 07:38:17 PM
Sorry to drag this one up, but I had an email appear in my inbox asking for improvements to the UI of the python port, so being a glutton for punishment, I agreed, and have opened a git repository with my new changes at https://github.com/richbeales/passwordmaker-python

However in doing so, the user has discovered an issue in the underlying implementation, which was (I believe) ported straight from the PHP version, and other than refactoring I haven't touched this code.  I would be grateful if anyone could answer why the python version starts getting passwords "wrong" when the length requested is > 19 characters?
Title: Re: Patch for Python port
Post by: Miquel 'Fire' Burns on May 21, 2012, 08:28:56 PM
The length before the password is wrong depends on the algorithm and character set actually.

But if that is the case, then the code to make passwords long enough need to be double checked against one of the JS based versions at least.
Title: Re: Patch for Python port
Post by: Miquel 'Fire' Burns on May 21, 2012, 09:10:22 PM
BTW, fixed the PHP version (Just need someone to version bump it in SVN, as I don't know how to do it in command line, as I don't have TSVN installed).

Ignore the var_dump lines, didn't save the file before commiting: http://passwordmaker.svn.sourceforge.net/viewvc/passwordmaker/trunk/php/passwordmaker_class.php?r1=429&r2=487&view=patch

Note: Might want to test a few more characters in your tests, as I found an issue in which the 20th character was correct but the 21st was wrong. Add a test for 22 characters.