Archive: Base64 decoder


Base64 decoder
  the location of a dropbox folder is stored in a plain text file, encoded in base64. since the only base64 decoder for nsis has no documentation at all, i'm wondering how i can decode the file. for a smaller footprint, i wouldn't mind an alternative to decode only.


there's a readme.txt in the original download?


I wouldn't use that plug-in as it has a MSVCRT80 dependency (comes with .NET 3.5).

Stu


actually msvcr80 is down to the plug-in having been built with dynamic linking in VS2005 and doesn't relate to .NET. however using it (no idea in respect to the original question) wouldn't be nice unless you make sure the dependency dll is in the same folder as the plug-in before it is then used.

-daz


Yes of course but the dist comes with .NET (2.0 not 3.5) and that can be a good indicator as whether or not it is installed on the destination machine.

Stu


well, there is the alternative linked to from that wiki.. and I think the original had the source code included, so could be recompiled to get rid of the dependency as well?

there's also plenty of code on the internet for base64 decoding in scripting languages.. presumably one of those could be adapted for NSIS use.

edit: in fact.. just do what this does.. but in reverse ;) http://nsis.sourceforge.net/Base64


I posted a step by step on how to build a non MSVCRT dependant DLL in VS2008/VS2010 here:
http://forums.winamp.com/showpost.ph...4&postcount=60

However, that plug-in would still need some mods to get it to build. For example, the way the the variables (such as string_to_encode) are being initialized to an empty string will cause the compiler to want to link memset. You can't use ZeroMemory either (again, memset) but a for loop would do the job.

Stu


SecureZeroMemory(..) should do an inline version of memset from what i remember.

-daz


Figured it'd be a fun coding exercise... I've updated http://nsis.sourceforge.net/Base64 to include the decoding function.

I haven't tested it rigorously - if there's an actual error in it (I know it uses more variables than it would strictly need, that's just for clarity), let me know or just edit the WiKi, of course.

Here's a further testbed, though:


SectionEnd 

>
As far as I can tell, the URLDecode variant works correctly as well - but difficult to find actual use examples via Google.

so far it worked without a flaw. thank you, animaether!


good to hear :) I guess it works on the dropbox folder location storage bit as well, then :)