PGP::Words::Tiny - Convert data to/from the PGP word list
use PGP::Words::Tiny qw/encode_pgp_hex decode_pgp_hex/; say join " ", encode_pgp_hex("0xe582"); # "topmost Istanbul" say decode_pgp_hex("topmost Istanbul"); # "0xe582"
This module converts octets to or from the PGP word list, allowing a byte sequence to be conveyed via easily readable words.
The following functions are available for import. None are imported by default.
@words = encode_pgp( $octets );
Returns a list of words drawn from the PGP word list corresponding to each octet in the input string. Even-position octets (starting at octet zero) are drawn from the even word list. Odd-position octets are drawn from the odd word list.
Proper nouns are capitalized as per the official word list.
@words = encode_pgp_hex( $hex_string );
Converts a string of hex digits (with or without leading "0x") to an octet string and returns the result of passing that octet string to
$octets = decode_pgp( @words ); # qw/topmost Istanbul/ $octets = decode_pgp( $string ); # qq/topmost Istanbul/
Returns a string of octets decoded from a list of PGP words or from a space-separated string of PGP words. An exception is thrown if a word is not in the PGP word list or is not in the correct even/odd position.
Input words are not case sensitive.
$hex_string = decode_pgp_hex( @words ); $hex_string = decode_pgp_hex( $string );
Returns a string of lowercase hex digits (preceded by "0x") decoded from a list of PGP words. It otherwise functions like
Please report any bugs or feature requests through the issue tracker at https://github.com/dagolden/PGP-Words-Tiny/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
David Golden <firstname.lastname@example.org>
This software is Copyright (c) 2012 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004