by kkikta
23. January 2008 06:13
I wrote this a while ago with the intention of releasing it but never could find out where it would fit best. Anyway its a .NET implementation of Poul-Henning Kamp md5crypt routine for generating passwords. I personally am using it for creating passwords in a PostgreSQL database that is being used by a FreeBSD mail server. Its pretty easy to use and pretty safe too, word on the street is this is the same routine that cisco uses to encrypt passwords on routers and obviously its still used to create passwords in FreeBSD.
Koolwired.Cryptography.zip (4.82 kb)
Since its a static method in a static object there is no need to create an instance of the class just call it as such:
string newpass = Koolwired.Cryptography.md5crypt.crypt("password");
The example above creates a new password, this can also be used to verify existing passwords once you know the "salt/magic". The format is for this type of password is $[magic]$[salt]$[encrypted password] so its pretty easy to seperate. If you didn't know one if the benefits of salt is that two users could have the exact same passwords but the encrypted passwords would be different because the most likely do not have the same salt string.
string verify = Koolwired.Cryptography.md5crypt.crypt("password", "$1$salt");
1ae4e5bc-a4c1-4001-a174-72f6c334d7b7|0|.0
Tags:
.NET