Uhaw Pa Sa Camel

 
d'Doc
Alabang, Muntinlupa City, Philippines
Beer-loving Gunner extraordinaire, perennial vocalist, guitarist, dog person, and wet kisser in one neat li'l package.

>> VIEW MY COMPLETE PROFILE

 

Subscribe to
Posts [Atom]  

Previous Posts

Powered by Blogger

 
Wednesday, November 03, 2010

Python Short Hacking Tip #1: Plain Auth Base 64 Encoding

 
auth_string = base64.encodestring( '\x00%s\x00%s' % (username, password) )

If you don't want the new line at the end feel free to remove it:
auth_string = base64.encodestring( '\x00%s\x00%s' % (username, password) )[0:-1]

Reading from
http://stackoverflow.com/questions/2620975/strange-n-in-base64-encoded-string-in-ruby

I learned that:

"The reason content-free newlines are added at the encode stage is because base64 was originally devised as an encoding mechanism for sending binary content in e-mail, where the line length is limited. Feel free to replace them away if you don't need them."

Subscribe to
Posts [Atom]

 
 

3 Comments:

Anonymous Anonymous said...

Gooday Sir!

Ito na ang pinakahihintay ko Doc Jav, Maraming salamat dito.

Sa wakas makakagawa na rin ako ng Uzzap ID Encrypter through my mobile phone based on PyS60.

I'll try kasi this module base64 but meron i know talaga na merong kulang ayan na nga kulang ko, buti ni-share mo Sir.

Salamat talaga Sir.

MasterJEO

4:05 PM  
Blogger d'Doc said...

Haha. Thanks Master Jeo. Hope you make more PyS60 apps for Uzzap!

4:14 PM  
Anonymous Anonymous said...

Doc Jav, i made it!

Sa wakas, tagumpay Sir..
Lalala.. Hahaha..

Success! Tama na siya!

I implement your codes, with base64 codecs on pys60 i have successfully made it!

Maraming Salamat talaga sa inyo Sir, It's an honor for me to have a mentor like you, sana wag kayo magsawa magshare ng iyong kaalaman.

Thank you!

MasterJEO

4:49 PM  

Post a Comment

<< Home