Crypt::Random::Source::Base::RandomDevice - Base class for random devices


Crypt-Random-Source documentation Contained in the Crypt-Random-Source distribution.

Index


Code Index:

NAME

Top

Crypt::Random::Source::Base::RandomDevice - Base class for random devices

SYNOPSIS

Top

    use Moose;

    extends qw(Crypt::Random::Source::Base::RandomDevice);

    sub default_path { "/dev/myrandom" }

DESCRIPTION

Top

This is a base class for random device sources.

See Crypt::Random::Source::Strong::devrandom and Crypt::Random::Source::Weak::devurandom for actual implementations.

AUTHOR

Top

  Yuval Kogman <nothingmuch@woobling.org>

COPYRIGHT AND LICENSE

Top


Crypt-Random-Source documentation Contained in the Crypt-Random-Source distribution.

package Crypt::Random::Source::Base::RandomDevice;
BEGIN {
  $Crypt::Random::Source::Base::RandomDevice::AUTHORITY = 'cpan:NUFFIN';
}
BEGIN {
  $Crypt::Random::Source::Base::RandomDevice::VERSION = '0.07';
}
# ABSTRACT: Base class for random devices

use Any::Moose;

extends qw(Crypt::Random::Source::Base::File);

sub rank { 100 } # good quality, pretty fast

has '+path' => (
    builder => "default_path",
);

sub available {
    -r shift->default_path;
}

sub seed {
    my ( $self, @args ) = @_;

    my $fh = $self->open_handle("w+");

    print $fh @args;

    close $fh;
}

sub default_path {
    die "abstract";
}

1;


# ex: set sw=4 et:

__END__