Have you checked out Bruce Fisk's password change utility? I believe it's posted in the dev community downloads and on Gidd Calden's site,
www.buoyantsolutions.net in the download section. Look for "Strong Passwords" or something to that effect.
If nothing else, you can use those as examples if you choose not to install their code.
Enjoy,