this should also get the correct hash function:

import re, base64
a =
"pbkdf2_sha256$10000$FL21dN1vykVF$SUkANu/eKdKeUeT5lYr06aMpC5/T0vrBDo/iSy+ExyI="

def convert(p):
    a,b,c,d = p.split('$')
    df, h = a.split('_')
    c = base64.b16encode(base64.b64decode(c)).lower()
    d = base64.b16encode(base64.b64decode(d)).lower()
    n = len(d)
    return "%s(%s,%s,%s)$%s$%s" % (df,b,n,h,c,d)

print convert(a)



2013/11/4 Massimo Di Pierro <[email protected]>

> In web2py they look like:
>
>
> "pbkdf2(1000,20,sha512)$99f92ea3b8cdb79f$788117d26668f147cd8f10652cb61e51532d4e04"
>
> "alg(parameters)$salt$base16encoded"
>
> Try this:
>
> import re, base64
> a =
>  
> "pbkdf2_sha256$10000$FL21dN1vykVF$SUkANu/eKdKeUeT5lYr06aMpC5/T0vrBDo/iSy+ExyI="
>
> def convert(p):
>     a,b,c,d = p.split('$')
>     c = base64.b16encode(base64.b64decode(c)).lower()
>     d = base64.b16encode(base64.b64decode(d)).lower()
>     n = len(d)
>     return "pbkdf2(%s,%s,sha512)$%s$%s" % (b,n,c,d)
>
> print convert(a)
>
> I cannot test it without knowing the password.
>
>
>
> On Monday, 4 November 2013 08:16:13 UTC-6, Andy B wrote:
>>
>> I have a legacy Django app that is due for a major overhaul. Instead of
>> continuing to use Django I would really like to make the switch to use
>> web2py instead. The only thing that's holding me back is the existing app
>> has several hundred Django user accounts that need to be migrated. I'm
>> unable to figure out how to have web2py authenticate passwords generated by
>> Django.
>>
>> From what I could find, Django saves passwords in the following format:
>> algorithm + iterations + salt + base64 encoded hash
>>
>> ex: "pbkdf2_sha256$10000$FL21dN1vykVF$SUkANu/eKdKeUeT5lYr06aMpC5/T0vrBDo/
>> iSy+ExyI="
>>
>> Does anyone have any suggestions as to how I can get web2py to
>> authenticate user accounts with passwords in this format?
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to