Why are there LFs in my base64?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Why are there LFs in my base64?
# 1  
Old 02-20-2010
Why are there LFs in my base64?

And is there a good way of taking them out?

I've been playing around a bit with using b64 to embed images in HTML (and trying to stay within the spec). I've noticed that with openssl's base64 encoder, the output files have newline characters @ every 65th column or so. This renders them useless, at least in Firefox and SeaMonkey (where this method usually works). After pasting the base64 from the output file into an HTML document, and adding the appropriate HTML tags, instead of a visible image I get a broken thumbnail. I already know why this is, having had some user-end experience with base64 (before either Outlook or Netscape knew how to decode it on the fly). My perception, phrased as a rule-of-thumb for the benefit of some who might argue its finer points, has always been the following:
Quote:
Originally Posted by Code Gods of the 1990s
Base64 encoding must be one continuous code stream or else it is invalid.
So what happened? Did someone find an application of this particular encoding where broken streams were more useful? Or even crucial?

At any rate, a sed or awk one-liner seems appropriate here. Anyone have a good one for this situation? One to remove newline characters?

BZT.

Last edited by SilversleevesX; 02-20-2010 at 03:40 PM.. Reason: Syntax (English, not code)
# 2  
Old 02-20-2010
simply can you give us some input and specify your output? its diffucult to read things sorry.
# 3  
Old 02-20-2010
Found my mistake.

So much for keeping to specification and syntax!
Openssl output files in base64, with the newlines, work perfectly well when embedding images in html...

...if you remember to suffix the base64 code with double-quotes and a square close bracket.

Sometimes the most obvious things elude you. How yellow is the egg on my face, btw?

BZT

Last edited by SilversleevesX; 02-20-2010 at 04:14 PM.. Reason: Noun-verb agreement (and missing a descriptive clause)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Base64 conversion in awk overlaps

hi, problem: output is not consistent as expected using external command in AWK description: I'm trying to convert $2 into a base64 string for later decoding, and for this when I use awk , I'm getting overlapped results , or say it results are not 100% correct. my code is: gawk... (9 Replies)
Discussion started by: busyboy
9 Replies

2. UNIX for Beginners Questions & Answers

Ldapsearch returning base64 encoded results

So my ldapsearch works great, except for some results I found today. My search is: /usr/lib64/mozldap/ldapsearch -T -h 10.1.1.1 -p 3891 -D "uid=datapower,ou=People,dc=blah,dc=com" -w xxxxxx -b "ou=Certs,dc=blah,dc=com"... (0 Replies)
Discussion started by: primerib
0 Replies

3. BSD

LFS-like thing, but with *BSD?

Hi, do you know, is there any thing like Linux From Scratch, but for a BSD operating system? A tutorial or guide to learn (and build) the system inside out? Would be pretty cool IMO. :D Blackbird (1 Reply)
Discussion started by: Blackbird
1 Replies

4. UNIX for Dummies Questions & Answers

mailx saved messages are unreadable (base64)

I am trying to parse emails sent from a blackberry. I am using fetchmail to download email through IMAP from my exchange server and then forward to local Linux mail. (This part works fine.) When viewing and saving messages sent as plain text from Outlook, everything works fine. However, when... (1 Reply)
Discussion started by: Squeakygoose
1 Replies

5. UNIX for Dummies Questions & Answers

not able to run base64 exe

Hi, I have copied base64.exe under base64-1.3 folder and i am trying to run base64.exe from another folder called Request. But i am getting the following error message. mga.ksh: base64: not found Please let me know how to execute the base64.exe from a directory where it is not installed. ... (0 Replies)
Discussion started by: lotus123
0 Replies

6. UNIX for Dummies Questions & Answers

I'm looking for someone who have Base64 binary

I need to install the base64 encryption method on a UNIX machine under AIX5.2. I've received a tar file but it is only C source , can you help me please. (sending me a binary base64 or to compile my source) Thanks by advance (3 Replies)
Discussion started by: Bruno_LAMOUR
3 Replies

7. Programming

gunzip and base64 decode a string

I am writing a C program to get messages from a JMS queue into a string variable and then write them to a database. The messages are compressed (gzip) and encoded (base64), so I need to be able to perform gunzip and base64 decode inside the C. I don't want to write any of the messages to file so... (2 Replies)
Discussion started by: handak9
2 Replies
Login or Register to Ask a Question