Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to generate 64-character length lines in base64?

by thundergnat (Deacon)
on Mar 19, 2013 at 13:45 UTC ( #1024301=note: print w/ replies, xml ) Need Help??


in reply to How to generate 64-character length lines in base64?

Specify a blank eol character when you encode it, then break it up however you want.

Update: oops, removed bogus double quotes

use MIME::Base64; my $str = 'Whatever'; my $encoded = encode_base64($str, ''); $encoded =~ s/(.{1,64})/$1\n/g; print $encoded;


Comment on Re: How to generate 64-character length lines in base64?
Download Code
Re^2: How to generate 64-character length lines in base64?
by rmichael (Initiate) on Mar 19, 2013 at 16:31 UTC

    Thank you!

    I did wonder about this, but was unsure about '=' padding if/when required. encode with the default EOL would handle that for me, I believe. Perhaps breaking it up myself could necessitate change some line endings?

    I'll read a few more spec details and play with this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024301]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2014-07-30 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (230 votes), past polls