You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Doug MacEachern <do...@pobox.com> on 1998/08/04 21:01:12 UTC

ap_uuencode()

We already have ap_uudecode() and the functionality for an ap_uuencode() in
util_digest.c:ap_md5contextTo64, about pulling that out?

-Doug

static char basis_64[] = 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 
 
API_EXPORT(char *) ap_uuencode(pool *a, char *string) 
{ 
    int i, len = strlen(string); 
    char *p; 
    char *encoded = (char *) ap_pcalloc(a, (len+2) / 3 * 4); 
 
    p = encoded; 
    for (i = 0; i < len; i += 3) { 
        *p++ = basis_64[string[i] >> 2]; 
        *p++ = basis_64[((string[i] & 0x3) << 4) | ((int) (string[i + 1] &
0xF0) >> 4)]; 
        *p++ = basis_64[((string[i + 1] & 0xF) << 2) | ((int) (string[i +
2] & 0xC0) >> 6)]; 
        *p++ = basis_64[string[i + 2] & 0x3F]; 
    } 
    *p-- = '\0'; 
    *p-- = '='; 
    *p-- = '='; 
    return encoded; 
} 


Re: ap_uuencode()

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Doug MacEachern wrote:
> 
> >Erm, what's the question again?
> 
> Should we move the base64 encoding code from
> util_digest.c:ap_md5contextTo64 into a new public ap_uuencode()
> function?
> 
> >And from whence did it come?
> 
> It seems a shame to have generic code buried in an md5-specific
> function.

Ah.  Well, if you're thinking of putting it in libap, it needs
to be sanitised.  Otherwise, breaking it out into a separate
function in util.c sounds good to me.

#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>

Re: ap_uuencode()

Posted by Doug MacEachern <do...@pobox.com>.
At 03:35 PM 8/4/98 -0400, Rodent of Unusual Size wrote:
>Doug MacEachern wrote:
>> 
>> We already have ap_uudecode() and the functionality for an
>> ap_uuencode() in util_digest.c:ap_md5contextTo64, about pulling that
>> out?
>
>Erm, what's the question again?  

Should we move the base64 encoding code from
util_digest.c:ap_md5contextTo64 into a new public ap_uuencode() function?

>And from whence did it come?

It seems a shame to have generic code buried in an md5-specific function.

-Doug

Re: ap_uuencode()

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Doug MacEachern wrote:
> 
> We already have ap_uudecode() and the functionality for an
> ap_uuencode() in util_digest.c:ap_md5contextTo64, about pulling that
> out?

Erm, what's the question again?  And from whence did it come?

#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>

Re: ap_uuencode()

Posted by Doug MacEachern <do...@pobox.com>.
At 10:22 AM 8/5/98 -0700, Dean Gaudet wrote:
>
>
>On Tue, 4 Aug 1998, Doug MacEachern wrote:
>
>> We already have ap_uudecode() and the functionality for an ap_uuencode() in
>> util_digest.c:ap_md5contextTo64, about pulling that out?
>> 
>> -Doug
>> 
>> static char basis_64[] = 
>> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 
>
>stick a const in there -- static const char basis_64.  Promote good
>forking. 

okay, this was just copy-n-paste from util_md5.c.  I haven't changed
ap_md5contextTo64() to use ap_uuencode() yet, I'll have to figure out how
to test that later, unless somebody else is up to it sooner.

-Doug

Re: ap_uuencode()

Posted by Dean Gaudet <dg...@arctic.org>.

On Tue, 4 Aug 1998, Doug MacEachern wrote:

> We already have ap_uudecode() and the functionality for an ap_uuencode() in
> util_digest.c:ap_md5contextTo64, about pulling that out?
> 
> -Doug
> 
> static char basis_64[] = 
> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 

stick a const in there -- static const char basis_64.  Promote good
forking. 

Dean