The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
#!/usr/local/bin/perl

# Usage:
#    encrypt input.txt > output.enc
#    encrypt output.enc > file.dec
#
# input.txt should be the same as file.dec

use diagnostics;
use strict;
use warnings;
use Crypt::Rabbit;

my $key = pack "H32", "00112233445566778899aabbccddeeff";
my $cipher = new Crypt::Rabbit $key;

chomp $ARGV[0];
open INFILE, $ARGV[0];

while (read(INFILE, my $buffer, 4096)) {
    print $cipher->encrypt($buffer);
}

close INFILE;