From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e710f7d3f890e76b X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!newsfeed0.kamp.net!newsfeed.kamp.net!news.buerger.net!news.uni-stuttgart.de!not-for-mail From: Stefan Bellon Newsgroups: comp.lang.ada Subject: Re: Base64-Encoding Date: Fri, 19 Oct 2007 08:59:34 +0200 Organization: Comp.Center (RUS), U of Stuttgart, FRG Message-ID: <20071019085934.7c1a525f@cube.tz.axivion.com> References: <20071015161229.3f439230@cube.tz.axivion.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: infosun2.rus.uni-stuttgart.de 1192777193 15384 129.69.226.25 (19 Oct 2007 06:59:53 GMT) X-Complaints-To: news@news.uni-stuttgart.de NNTP-Posting-Date: Fri, 19 Oct 2007 06:59:53 +0000 (UTC) X-Newsreader: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; i486-pc-linux-gnu) X-URL: http://www.axivion.com/ Xref: g2news2.google.com comp.lang.ada:2494 Date: 2007-10-19T08:59:34+02:00 List-Id: 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