Help language development. Donate to The Perl Foundation

Crypt::CAST5 cpan:KAIEPI last updated on 2020-03-26

=begin pod

[![Build Status](](

=head1 NAME

Crypt::CAST5 - CAST5 encryption library


  use Crypt::CAST5;

  my Crypt::CAST5 $cast5   .= new: 'ayy lmao'.encode;
  my Str          $in       = 'sup my dudes';
  my Blob         $encoded  = $cast5.encode: $in.encode;
  my Blob         $decoded  = $cast5.decode: $encoded;
  my Str          $out      = $decoded.decode;

  say $out; # OUTPUT: sup my dudes


B<Warning: this implementation is naive and is not implemented in constant
time, thus it is vulnerable to side channel attacks. Do not use this library
for any serious applications as it stands now!>

Crypt::CAST5 is a library that handles encryption and decryption using the
CAST5 algorithm. Currently, only the ECB block cipher mode is supported.

=head1 METHODS

=item B<new>(Blob I<$key>)

Constructs a new instance of Crypt::CAST5 using the given block cipher mode and
key. The key must be 5-16 bytes in length.

=item B<encode>(Blob I<$plaintext> --> Blob)

Encodes C<$plaintext> using CAST5 encryption.

=item B<decode>(Blob I<$ciphertext> --> Blob)

Decodes C<$ciphertext> using CAST5 encryption.

=head1 AUTHOR

Ben Davies (Kaiepi)


Copyright 2018 Ben Davies

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

=end pod