Algorithm-IRCSRP2
view release on metacpan or search on metacpan
lib/Algorithm/IRCSRP2.pm view on Meta::CPAN
}
sub encrypt_message {
my ($self, $who, $msg) = @_;
my $times = pack('L>', int(time()));
# info = len(username) || username || timestamp
my $infos = chr(length($who)) . $who . $times;
# ctext = IV || AES-CBC(sessionkey, IV, "M" || info || plaintext)
my $ctext = $self->cbc_encrypt(padto('M' . $infos . $msg, 16));
# cmac = HM(mackey, ctext)
my $cmac = hmac_sha256_128($self->mac_key, $ctext);
# ircmessage = "*" || Base64(cmac || ctext)
return '*' . MIME::Base64::encode_base64($cmac . $ctext, '');
}
no Moose;
lib/Algorithm/IRCSRP2.pm view on Meta::CPAN
=back
=head1 ATTRIBUTES
=head2 Optional Attributes
=over
=item * B<am_i_dave> (ro, Bool) - Child class will set this.
=item * B<cbc_blocksize> (ro, Int) - CBC blocksize. Defaults to '16'.
=item * B<debug_cb> (rw, CodeRef) - Debug callback. Defaults to C<print()>
=item * B<error> (rw, Str) - If set, there was an error.
=item * B<nickname> (rw, Str) - Child class will set this. Defaults to 'unknown'.
=back
=head1 PUBLIC API METHODS
( run in 0.511 second using v1.01-cache-2.11-cpan-9bca49b1385 )