comp.lang.ada
 help / color / mirror / Atom feed
From: Stefan Bellon <sbellon@sbellon.de>
Subject: Re: Base64-Encoding
Date: Fri, 19 Oct 2007 08:59:34 +0200
Date: 2007-10-19T08:59:34+02:00	[thread overview]
Message-ID: <20071019085934.7c1a525f@cube.tz.axivion.com> (raw)
In-Reply-To: eRURi.236438$ax1.167125@bgtnsc05-news.ops.worldnet.att.net

On Fr, 19 Okt, anon wrote:

>   function To_Base64 is new Ada.Unchecked_Conversion 
>                              ( Source => Unsigned_8, 
>                                Target => base64_descriptor ) ;
> 
>   function From_Base64 is new Ada.Unchecked_Conversion 
>                              ( Target => Unsigned_8, 
>                                Source => base64_descriptor ) ;

But this only converts one whole byte (aka Unsigned_8) into a Six_Bits
by ignoring the two top-bits. This does not help with my original idea
of overlaying a packed array of 6-bit elements over an array of 8-bit
characters and then looping over the 6-bit elements to do the
conversion in a simple loop, character by character.

> In 2001 Tom Moran created a Ada BASE64 package which is archived at 
> 
> http://www.adapower.com/index.php?Command=Class&ClassID=Algorithms&CID=257
> 
> have a look at it. I a quick look it kind of suggest that the endian
> for Six_Bits is not important.

Yes, I know this package. But it handles three bytes in the original in
one go and always encodes three bytes into four 6-bits.

As I mentioned in my first posting, I am aware of the solutions to do
the actual conversion that exist (and already have been discussed a
few times here in the group). I was just wondering whether my idea
of overlaying the two arrays could be easily "fixed" so that it works.

But thanks for your ideas!

-- 
Stefan Bellon



  parent reply	other threads:[~2007-10-19  6:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-15 14:12 Base64-Encoding Stefan Bellon
2007-10-15 14:46 ` Base64-Encoding Jacob Sparre Andersen
2007-10-15 14:54   ` Base64-Encoding Stefan Bellon
2007-10-15 15:14     ` Base64-Encoding Jacob Sparre Andersen
2007-10-15 15:37       ` Base64-Encoding Robert A Duff
2007-10-15 15:40     ` Base64-Encoding Jean-Pierre Rosen
2007-10-15 16:39       ` Base64-Encoding Stefan Bellon
2007-10-16 10:42         ` Base64-Encoding Stephen Leake
2007-10-17 14:07           ` Base64-Encoding Stefan Bellon
2007-10-17 15:09             ` Base64-Encoding Adam Beneschan
2007-10-17 18:15               ` Base64-Encoding Larry Kilgallen
2007-10-15 18:24 ` Base64-Encoding Adam Beneschan
2007-10-19  2:43 ` Base64-Encoding anon
2007-10-19  4:33   ` Base64-Encoding anon
2007-10-19  7:35     ` Base64-Encoding Jean-Pierre Rosen
2007-10-19  6:59   ` Stefan Bellon [this message]
2007-10-19 19:40     ` Base64-Encoding anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox