1748123 Members
3303 Online
108758 Solutions
New Discussion юеВ

Re: Base64 Converter

 
Tommy_6
Regular Advisor

Base64 Converter

Hi everyone. I was wondering whether someone has a way to convert text to Base64 in HPUX 11. Thanks in advanced. Tommy
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: Base64 Converter

I'm reading into this that you are dealing with MIME octet-stream base64 encoding.

Have a look at the mpack/mumpack utility available from any of the HP-UX Porting Centre's.

http://gatekeep.cs.utah.edu/hppd/hpux/Users/mpack-1.5/
If it ain't broke, I can fix that.
H.Merijn Brand (procura
Honored Contributor

Re: Base64 Converter

# perl -MMIME::Base64 -e ....

MIME::Base64(3pm) Perl Programmers Reference Guide MIME::Base64(3pm)

NAME
MIME::Base64 - Encoding and decoding of base64 strings

SYNOPSIS
use MIME::Base64;

$encoded = encode_base64('Aladdin:open sesame');
$decoded = decode_base64($encoded);

DESCRIPTION
This module provides functions to encode and decode strings into the
Base64 encoding specified in RFC 2045 - MIME (Multipurpose Internet
Mail Extensions). The Base64 encoding is designed to represent arbi-
trary sequences of octets in a form that need not be humanly readable.
A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used, enabling 6
bits to be represented per printable character.

The following functions are provided:

encode_base64($str, [$eol])
Encode data by calling the encode_base64() function. The first
argument is the string to encode. The second argument is the line
ending sequence to use (it is optional and defaults to "\n"). The
returned encoded string is broken into lines of no more than 76
characters each and it will end with $eol unless it is empty. Pass
an empty string as second argument if you do not want the encoded
string broken into lines.

decode_base64($str)
Decode a base64 string by calling the decode_base64() function.
This function takes a single argument which is the string to decode
and returns the decoded data.

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Tommy_6
Regular Advisor

Re: Base64 Converter

Actually, I need just a regular string converted to base64 as described in RFC 1521.
H.Merijn Brand (procura
Honored Contributor

Re: Base64 Converter

Which is done with MIME::Base64

see http://search.cpan.org/author/ERYQ/MIME-tools-5.411a/lib/MIME/Head.pm

--8<---
DESCRIPTION

A class for parsing in and manipulating RFC-822 message headers, with some methods geared towards standard (and not so standard) MIME fields as specified in RFC-1521, Multipurpose Internet Mail Extensions.
-->8---

Enter 1521 in http://search.cpan.org/

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn