Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Encode::Base32::CrockfUser3Contributed Perl DocumeEncode::Base32::Crockford(3)

NAME
       Encode::Base32::Crockford - encode/decode numbers using Douglas
       Crockford's Base32 Encoding

VERSION
       version 2.112991

DESCRIPTION
       Douglas Crockford describes a Base32 Encoding at
       <http://www.crockford.com/wrmg/base32.html>. He says: "[Base32 Encoding
       is] a 32-symbol notation	for expressing numbers in a form that can be
       conveniently and	accurately transmitted between humans and computer
       systems."

       This module provides methods to convert numbers to and from that
       notation.

SYNOPSIS
	   use Encode::Base32::Crockford qw(:all); # import all	methods

       or

	   use Encode::Base32::Crockford qw(base32_decode); # your choice of methods

	   my $decoded = base32_decode_with_checksum("16JD");
	   my $encoded = base32_encode_with_checksum(1234);

METHODS
   base32_encode
	   print base32_encode(1234); #	prints "16J"

       Encode a	base 10	number.	Will die on inappropriate input.

   base32_encode_with_checksum
	   print base32_encode_with_checksum(1234); # prints "16JD"

       Encode a	base 10	number with a checksum symbol appended.	See the	spec
       for a description of the	checksum mechanism. Wraps the previous method
       so will also die	on bad input.

   base32_decode
	   print base32_decode("16J"); # prints	"1234"

	   print base32_decode("IO", { mode => "warn"	}); # print "32" but warn
	   print base32_decode("IO", { mode => "strict"	}); # dies

       Decode an encoded number	into base 10. Will die on inappropriate	input.
       The function is case-insensitive, and will strip	any hyphens in the
       input (see "normalize()"). A hashref of options may be passed, with the
       only valid option being "mode". If set to "warn", normalization will
       produce a warning; if set to "strict", requiring	normalization will
       cause a fatal error.

   base32_decode_with_checksum
	   print base32_decode_with_checksum("16JD"); #	prints "1234"

       Decode an encoded number	with a checksum	into base 10. Will die if the
       checksum	isn't correct, and die on inappropriate	input. Takes the same
       "mode" option as	"base32_decode".

   normalize
	   my $string =	"ix-Lb-Ko";
	   my $clean = normalize($string);

	   # $string is	now '1X1BK0'.

       The spec	allows for certain symbols in encoded strings to be read as
       others, to avoid	problems with misread strings. This function will
       perform the following conversions in the	input string:

       o   "i" or "I" to 1

       o   "l" or "L" to 1

       o   "o" or "O" to 0

       It will also remove any instances of "-"	in the input, which are
       permitted by the	spec as	chunking symbols to aid	human reading of an
       encoded string, and uppercase the output.

AUTHOR
       Graham Barr <gbarr@cpan.org>

CREDITS
       The original module was written by Earle	Martin <hex@cpan.org>

COPYRIGHT
       This code is free software; you can redistribute	it and/or modify it
       under the same terms as Perl itself.

REPOSITORY
       The git repository for this distribution	is available at
       <https://github.com/gbarr/Encode-Base32-Crockford>

perl v5.32.1			  2011-10-26	  Encode::Base32::Crockford(3)

NAME | VERSION | DESCRIPTION | SYNOPSIS | METHODS | AUTHOR | CREDITS | COPYRIGHT | REPOSITORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Encode::Base32::Crockford&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help