Need Help with base64

Terry Reedy tjreedy at udel.edu
Mon Jul 23 13:07:57 EDT 2007


"pycraze" <dennis.varghese at wipro.com> wrote in message 
news:1185193741.420611.302290 at z28g2000prd.googlegroups.com...
| Hi ,
|
|  I am currently trying to implement base64 encoding and decoding
| scheme in C . Python has a module , base64 , that will  do the
| encoding and decoding with ease . I am aware of OpenSSL having support
| for base64 encoding and decoding , but i will have to now implement
| both in C without using the openssl libraries .
|
|    I was able to download a code w.r.t. base 64 encoding and
| decoding . I am attaching the code below .

[C coce snipped]

|          But this code gives different hex values as compared to the
| python base64.encodestring and base64.decodestring respectively .
|
|         I need some help on this matter . I need some pointers on
| where is the mistake for the above file .

Looking at the source code for those functions might tell you why you get 
different outputs. The python code for base64 is in /Lib.  Those two 
functions are thin wrappers around corresponding C-coded binascii 
functions.  You can access that module via this source tree directory:
http://svn.python.org/view/python/trunk/Modules/

The current binascii code is
http://svn.python.org/view/python/trunk/Modules/binascii.c?rev=55205&view=auto

The interpreter is open source with a liberal license that should allow you 
to pluck the functions for use elsewhere as long as the add a copyright 
notice.

Otherwise, I agree with Diez that this is OT here.

tjr






More information about the Python-list mailing list