Hi

On Fri, 27 Apr 2007 11:33:47 +0200
Andreas Moroder <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I have to calculate a hash of username and password in perl.
> The calculation should be done this way:
> 

first the easy stuff, I think you already know that answers to that:

> 1. Concatenate the username and the password to produce a plaintext string;
$username . $password;

> 2. Convert the plaintext string to uppercase characters;
uc();


> 3. Convert the plaintext string to multi-byte storage format; ASCII 
> characters have the
> high byte set to 0x00;

I am not sure, but i think that could help you:
http://search.cpan.org/~dankogai/Encode-2.20/

> 4. Encrypt the plaintext string (padded with 0s if necessary to the next 
> even block length)
> using the DES algorithm in cipher block chaining (CBC) mode with a fixed 
> key value of
> 0x0123456789ABCDEF;

hava a look at:
http://search.cpan.org/~dparis/Crypt-DES-2.05/DES.pm#NOTES
they say that the Encryption is done by 8byte blockes.
your key is 8byte long, that sounds quite good :)

> 5. Encrypt the plaintext string again with DES-CBC, but using the last 
> block of the output
> of the previous step (ignoring parity bits) as the encryption key. The 
> last block of the
> output is converted into a printable string to produce the password hash 
> value.
> 
> Is it possible to implement this in perl ?

It should work :)

HTH Martin

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to