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

NAME

Crypt::Role::CheckerboardCipher - guts of the Polybius square cipher implementation

DESCRIPTION

Attributes

The following attributes exist. All of them have defaults, and should not be provided to the constructors of consuming classes.

square

An arrayref of arrayrefs of letters.

square_size

The length of one side of the square, as an integer.

encipher_hash

Hashref used by the encipher method.

decipher_hash

Hashref used by the decipher method.

Object Methods

encipher($str)

Enciphers a string and returns the ciphertext.

decipher($str)

Deciphers a string and returns the plaintext.

_build_square_size

Calculates the optimum square size for the alphabet. An alphabet of 25 letters can fill a five by five square, so this method would return 5. An alphabet of 26 characters would partly fill a six by six square, so this method would return 6.

This method is not expected to be called by end-users but is documented for people writing classes consuming this role.

_build_square

Allocates the letters of the alphabet into a square (an arrayref of arrayrefs of letters), returning the square.

This method is not expected to be called by end-users but is documented for people writing classes consuming this role.

Required Methods

Classes consuming this role must provide the following methods:

preprocess($str)

Expected to return a string more suitable for enciphering.

alphabet

Expected to returns an arrayref of the known alphabet.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Crypt-Polybius.

SEE ALSO

http://en.wikipedia.org/wiki/Polybius_square.

Crypt::Polybius, Crypt::Polybius::Greek.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2014 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.