#!/usr/bin/perl # # skipjack.pl - Skipjack encrypt a file. # use strict; use warnings; use diagnostics; use Getopt::Std; use Crypt::CBC; my %opts; getopt( 'kio', \%opts ); my ( $key, $infile, $outfile ) = ( $opts{"k"}, $opts{"i"}, $opts{"o"}); die "Usage: $0 -k KEY -i INFILE -o OUTFILE\n" unless($key && $infile && $outfile); my $cipher = Crypt::CBC->new( -key => $key, -cipher => 'Skipjack', ); $cipher->start('encrypting'); open (INFILE, $infile) || die "Can't read '$infile': $!\n"; open (OUTFILE, ">$outfile") || die "Can't write to '$outfile': $!\n"; while (read(INFILE,my $plaintext,1024)) { print OUTFILE $cipher->crypt($plaintext); } print OUTFILE $cipher->finish; close OUTFILE; close INFILE;