Hello friends,
I am new to Perl scripts.
Please help me out....
I am using crypt::CBC to encrypt my files...
during decryption process it goes through the code as follows
[CODE=perl]
if ($header_mode eq 'salt') {
my ($salt) = $$input_stream =~ /^Salted__(.{8})/s;
croak "Ciphertext does not begin with a valid header for 'salt' header mode" unless defined $salt;
$self->{salt} = $salt; # new salt
substr($$input_ stream,0,16) = '';
my ($key,$iv) = $self->_salted_key_an d_iv($self->{passphrase},$ salt);
$self->{iv} = $self->{civ} = $iv;
$self->{key} = $key;
}
[/CODE]
[CODE=perl]
my ($salt) = $$input_stream =~ /^Salted__(.{8})/s;
[/CODE]
Can anybody tell me what the above instruction means....
[CODE=perl]
sub _salted_key_and _iv {
my $self = shift;
my ($pass,$salt) = @_;
croak "Salt must be 8 bytes long" unless length $salt == 8;
my $key_len = $self->{keysize};
my $iv_len = $self->{blocksize};
my $desired_len = $key_len+$iv_le n;
my $data = '';
my $d = '';
while (length $data < $desired_len) {
$d = md5($d . $pass . $salt);
$data .= $d;
}
return (substr($data,0 ,$key_len),subs tr($data,$key_l en,$iv_len));
}
[/CODE]
How are they retrieve the password and the iv
Thanks,
Rajeev
I am new to Perl scripts.
Please help me out....
I am using crypt::CBC to encrypt my files...
during decryption process it goes through the code as follows
[CODE=perl]
if ($header_mode eq 'salt') {
my ($salt) = $$input_stream =~ /^Salted__(.{8})/s;
croak "Ciphertext does not begin with a valid header for 'salt' header mode" unless defined $salt;
$self->{salt} = $salt; # new salt
substr($$input_ stream,0,16) = '';
my ($key,$iv) = $self->_salted_key_an d_iv($self->{passphrase},$ salt);
$self->{iv} = $self->{civ} = $iv;
$self->{key} = $key;
}
[/CODE]
[CODE=perl]
my ($salt) = $$input_stream =~ /^Salted__(.{8})/s;
[/CODE]
Can anybody tell me what the above instruction means....
[CODE=perl]
sub _salted_key_and _iv {
my $self = shift;
my ($pass,$salt) = @_;
croak "Salt must be 8 bytes long" unless length $salt == 8;
my $key_len = $self->{keysize};
my $iv_len = $self->{blocksize};
my $desired_len = $key_len+$iv_le n;
my $data = '';
my $d = '';
while (length $data < $desired_len) {
$d = md5($d . $pass . $salt);
$data .= $d;
}
return (substr($data,0 ,$key_len),subs tr($data,$key_l en,$iv_len));
}
[/CODE]
How are they retrieve the password and the iv
Thanks,
Rajeev
Comment