Re: Encryption



Hi

On Fri, 27 Apr 2007 11:33:47 +0200
Andreas Moroder <andreas.moroder@xxxxxxxxxxxx> 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
.



Relevant Pages

  • Re: Access elements of a array of hases
    ... I have given a reference to this array in my script. ... I want to do some calculation with only one key of each hash. ... $ perl -le' ...
    (perl.beginners)
  • Re: Noob! Help required and would be really appreciated!
    ... You've read 60% of "Learning Perl"? ... On finding the keyword "New Order", it has to start building a hash. ... want to build a loop around this hash creation. ... transferred to %allOrders. ...
    (comp.lang.perl.misc)
  • Re: Passing an array to a sub routine
    ... but later you're using a hash. ... In Perl, these are very ... The LoadDataFile routine works correctly, ...
    (comp.lang.perl.misc)
  • Making Datatypes Constant and Emulating Const Correctness
    ... Being relatively new to Perl with Java and bits of C under my belt, ... I'm new to C+++, too, but remember a number of uses for the const keyword ... an array to some analizer function as a constant strongly signals that no ... some reference (e,g. a blessed hash reference) ...
    (comp.lang.perl.misc)
  • Re: taking references to functions
    ... > I'm building a diagnostic medical questionnaire using Perl Tk. ... > to create a reference to a named function but not for unnamed ones. ... Notice that %dispatch here is an actual hash variable. ...
    (perl.beginners)