Current Path : /usr/local/lib/perl5/site_perl/5.8.9/mach/Crypt/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/local/lib/perl5/site_perl/5.8.9/mach/Crypt/IDEA.pm |
#! /usr/local/bin/perl -w # # Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/) # All rights reserved. # package Crypt::IDEA; require Exporter; require DynaLoader; @ISA = (Exporter, DynaLoader); # Items to export into callers namespace by default @EXPORT = qw(); # Other items we are prepared to export if requested @EXPORT_OK = qw(); bootstrap Crypt::IDEA; package IDEA; $VERSION="1.08"; use strict; use Carp; sub usage { my ($mess, $package, $filename, $line, $subr); ($mess) = @_; ($package, $filename, $line, $subr) = caller(1); $Carp::CarpLevel = 2; croak "Usage: $package\::$subr - $mess"; } sub blocksize { 8; } sub keysize { 16; } sub new { usage("new IDEA key") unless @_ == 2; my $type = shift; my $self = {}; bless $self, $type; $self->{'ks'} = Crypt::IDEA::expand_key(shift); $self; } sub encrypt { usage("encrypt data[8 bytes]") unless @_ == 2; my $self = shift; my $data = shift; Crypt::IDEA::crypt($data, $data, $self->{'ks'}); $data; } sub decrypt { usage("decrypt data[8 bytes]") unless @_ == 2; my $self = shift; my $data = shift; # # Cache Decrypt key schedule # $self->{'dks'} = Crypt::IDEA::invert_key($self->{'ks'}) unless exists $self->{'dks'}; Crypt::IDEA::crypt($data, $data, $self->{'dks'}); $data; } 1;