Detecting password encryption type --can I import them into Django?
I have a legacy system with passwords that look like this 115c28e0578f262bde08e3de39ee9066
. Im not quite sure if they were created with md5 or crypt or... It was a java application that created them.
My new system is in Python (Django) and I tried to run a comparison check on a known password using md5(), sha1() and crypt(). None of them came back with an identical result of what this legacy system has given me.
Assuming the passwords were created开发者_开发知识库 within java, is is possible for Pythons equivalent modules to read/convert them so I may import that into a Django project? I'd love to not have to bug my users to reset their passwords.
In general, you will need to know the exact algorithm used by the Java program. Then you would be able to recreate the same results in Python. (You cannot get the plain-text password from the hash, without using brute-force, but you should be able to recreate the same hashing algorithm, so you can verify a user's password against the hash).
It is very possible that the passwords where hashed with something called a salt when they where stored in the Java application. This is a bit of random information added to the password, and the purpose is to defeat dictionary attacks. If this is the case, you will need to know what data was used for salt.
精彩评论