[ 
http://issues.apache.org/jira/browse/JAMES-334?page=comments#action_12318291 ] 

Daniel Perry commented on JAMES-334:
------------------------------------

This is an SHA hash but not in the format you'd expect.
It's a base64 encoded rather than hex (reduces the size).
Its then trimmed of padding.
Some php code to do this is as follows:

function hashPassword($in){
    $pwd=base64_encode(hex2bin(sha1($in)));
    $pwd=substr($pwd,0,strlen($pwd)-4);
    return $pwd;
}

function hex2bin($source) {
    $strlen = strlen($source);
    for ($i=0;$i<strlen($source);$i=$i+2) {
        $bin .= chr(hexdec(substr ($source, $i,2)));
    }
    return $bin;
}


> SHA hash incompatable with common generation methods
> ----------------------------------------------------
>
>          Key: JAMES-334
>          URL: http://issues.apache.org/jira/browse/JAMES-334
>      Project: James
>         Type: Bug
>   Components: UsersStore & UsersRepository
>     Versions: 2.2.0
>  Environment: FreeBSD, JDK 1.4.2, MySQL via. C-JDBC
>     Reporter: Brill Pappin
>     Priority: Minor

>
> This ticket is related to: JAMES-332
> It appears the SHA password hash is not compatable with all other methods of 
> generating an SHA hash I've tried. For example:
> SELECT SHA("test") in MySQL
> a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
> generates what I'd expect, however:
> the remote manager tool sets:
> CY9rzUYh03PK3k6DJie0
> which doesn't even "look" like SHA.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to