1 2 3 4 5 6 7 8 9 10 11 12 | DELIMITER //
CREATE FUNCTION django_password(
pass VARCHAR(32)
) RETURNS VARCHAR(128)
DETERMINISTIC
BEGIN
DECLARE salt char(5);
DECLARE hash VARCHAR(40);
SET salt = MID(RAND(), 3, 5);
SET hash = SHA(CONCAT(salt, pass));
RETURN CONCAT('sha1$', salt, '$', hash);
END//
|
More like this
- Debug middleware for displaying sql queries and template loading info when ?debug=true by SEJeff 10 months, 1 week ago
- Basic Auth Middleware by joshsharp 7 months, 3 weeks ago
- MoinMoin auth backend by yourcelf 1 year, 4 months ago
- Trigger a user password change by jedie 4 years, 5 months ago
- Unusable passwords for LDAP users by rob.ward 3 years ago
Comments
Note the deterministic behaviour from the manual:
#
How would you make use of this inside of Django (and Django Admin) i.e. where would you add the SQL?
#