Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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;

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024301]
[choroba]: I've moved away from nvidia
[davido]: I have nvidia (1050ti) in one system at home. My work laptop came with a radeon/amd video system that is no longer supported by debian/ubuntu. So that being the case I'm in the "prefer nvidia even if proprietary" camp
[davido]: Especially since the laptop is only a couple years old.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2017-05-26 14:24 GMT
Find Nodes?
    Voting Booth?