Algorithm-IRCSRP2

 view release on metacpan or  search on metacpan

lib/Algorithm/IRCSRP2/Exchange.pm  view on Meta::CPAN


BEGIN {
    $Algorithm::IRCSRP2::Exchange::VERSION = '0.501';
}

# ABSTRACT: utility functions

use Moose::Role;

# core
use Scalar::Util qw(blessed);

foreach my $k (qw(I x a A b B S u K1 K2 M1 M2 P s v)) {
    has $k => (
        'isa'     => 'Any',
        'is'      => 'rw',
        'default' => undef,
        'trigger' => sub {
            my ($self, $new, $old) = @_;

            my $str = "Changing IRCSRP exchange $k from %s to %s";

            my ($oldstr, $newstr);

            my $formatstr = sub {
                my ($string) = @_;

                my $retstr;

                if (blessed($string)) {
                    $retstr = (blessed($string) eq 'Math::BigInt') ? $string->bstr : $retstr;
                }
                elsif (!defined($string)) {
                    $retstr = 'undef';
                }
                else {
                    if ($string =~ /[[:^ascii:]]/) {
                        $retstr = Algorithm::IRCSRP2::bytes2int($string);
                    }
                    else {
                        $retstr = $string;



( run in 1.140 second using v1.01-cache-2.11-cpan-de7293f3b23 )