# Copyright (C) 2002 # robin-david hammond KB3IEN ( PERL AT KB3IEN DOT ORG ) # distributed under the GPL and also under the perl license, you can # redistribute it and modify it under teh same terms as Perl. # # use strict; package Convert::base91; use vars qw{ $VERSION }; $VERSION = "0.00"; # VERSION # 0.0 entered 2002.10.23 # ABSTRACT # these two reciprical functions are used to for encoding and decoding compressed lat/long # coordinates according the the base 91 algorithm as publish by tapr.org in the APRS specification. sub b91e { # arg(0) a scalar (numberic value) to return a scalar value # (text of MIMETYPE : text/plain ; Encoding=base91 local ($a) = shift ; if ($a == 0 ) { return () } ; return( &b91e(int( $a / 91) ) . chr(33+( $a % 91) ) ); } sub b91d { # aka b91e**-1 local ($a) = shift; if ($a eq '') { return (0) } return ( ord(substr($a,length($a)-1,1) )-33 +91* &b91d(substr($a,0,length($a)-1) ) ); } 1;