| 1 | package ACME::Base64::Hexagram; | ||
| 2 | |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | ▶ | use MIME::Base64 qw{ encode_base64 decode_base64 }; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 1 | ▶ | use Exporter qw{ import }; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | our @EXPORT = qw{ encode_base64h decode_base64h }; | |
| 11 | |||
| 12 | 1 | our $VERSION = '0.002'; | |
| 13 | |||
| 14 | 1 | ▶ | sub encode_base64h { |
|
Subroutine
encode_base64h: called CC=1 SCAR=0.0
Pod
documented
| |||
| 15 | 1 | my ($string) = @_; | |
| 16 | 1 | my $encoded = encode_base64($string); | |
| 17 | 1 | $encoded =~ tr{A-Za-z0-9+/=}{䷀䷁䷂䷃䷄䷅䷆䷇䷈䷉䷊䷋䷌䷍䷎䷏䷐䷑䷒䷓䷔䷕䷖䷗䷘䷙䷚䷛䷜䷝䷞䷟䷠䷡䷢䷣䷤䷥䷦䷧䷨䷩䷪䷫䷬䷭䷮䷯䷰䷱䷲䷳䷴䷵䷶䷷䷸䷹䷺䷻䷼䷽䷾䷿·}; | |
| 18 | 1 | $encoded | |
| 19 | } | ||
| 20 | |||
| 21 | 1 | ▶ | sub decode_base64h { |
|
Subroutine
decode_base64h: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 1 | my ($encoded) = @_; | |
| 23 | 1 | $encoded =~ tr{䷀䷁䷂䷃䷄䷅䷆䷇䷈䷉䷊䷋䷌䷍䷎䷏䷐䷑䷒䷓䷔䷕䷖䷗䷘䷙䷚䷛䷜䷝䷞䷟䷠䷡䷢䷣䷤䷥䷦䷧䷨䷩䷪䷫䷬䷭䷮䷯䷰䷱䷲䷳䷴䷵䷶䷷䷸䷹䷺䷻䷼䷽䷾䷿·}{A-Za-z0-9+/=}; | |
| 24 | 1 | my $decoded = decode_base64($encoded); | |
| 25 | 1 | $decoded | |
| 26 | } | ||
| 27 | |||
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | ACME::Base64::Hexagram - Base64 encoding using I Ching hexagrams | ||
| 32 | |||
| 33 | =head1 SYNOPSIS | ||
| 34 | |||
| 35 | use ACME::Base64::Hexagram qw{ decode_base64h encode_base64h }; | ||
| 36 | |||
| 37 | my $encoded = encode_base64h('The Book of Changes'); | ||
| 38 | |||
| 39 | =head1 FUNCTIONS | ||
| 40 | |||
| 41 | =over 4 | ||
| 42 | |||
| 43 | =item encode_base64h($string) | ||
| 44 | |||
| 45 | Returns the $string encoded in hexagrams. | ||
| 46 | |||
| 47 | =item decode_base64h($encoded) | ||
| 48 | |||
| 49 | Returns the decoded string back. | ||
| 50 | |||
| 51 | =back | ||
| 52 | |||
| 53 | =head1 ORDER | ||
| 54 | |||
| 55 | The module uses King Wen order. | ||
| 56 | |||
| 57 | =head1 THANKS | ||
| 58 | |||
| 59 | #perl on Libera.chat | ||
| 60 | thrig: there are 64 hexagrams. just saying. | ||
| 61 | |||
| 62 | =head1 AUTHOR | ||
| 63 | |||
| 64 | E. Choroba <chorobaE<64>matfyz.cz> | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | 1 | __PACKAGE__ | |