---------------------------------------- RAW ---------------------------------------- If you are pulling this from github, please run `./bootstrap.sh` to do all the gnu-isms. Mac Users: ```bash brew install m4 autoconf automake libtool ``` (maybe more?) ---------------------------------------- PLAIN INSTALL ---------------------------------------- EXPORT CFLAGS='your optimization flags' gcc defaults to "-O2 -g" you probably want "-O3 -Wall" ./configure make make check make install will produce a shared and static library and put in the right places. it will also install the include files. ---------------------------------------- CHANGING THE b64 web/url SAFE ALPHABET ---------------------------------------- If you are using base 64 encoding for use IN A URL, you CAN NOT use the standard mod_b64. You MUST use modp_b64w (the w is for "web"). Unfortunately this is not standardized and if you are working with a third party, you might need to change the "alphabet" (chars). You can change char 62,63 and the padding char with ./configure --with-b64wchars='-_.' where "-" is char 62, "_" is char 63 and "." is the padding char. You can change this if you know what you are doing. ---------------------------------------- IF YOU DON'T WANT TO DEAL WITH A LIBRARY ---------------------------------------- Base64 and base85 functions are so small, you might just want to directly add them into your existing project. That's fine, it's all under the BSD license, so go ahead. For b64: -------- After doing a "./configure && make", copy * src/modp_b64.c * src/modp_b64.h * modp_b64_data.h ***** BUT, there is an IMPORTANT GOTCHA! ***** This code has special versions that are -endian- dependant. This means different code is used on an Intel CPU than it is on a Motorola, IBM, or Sun CPU. **** IF you are using autoconf, just add AC_C_BIGENDIAN to your configure.in script and everything will work. **** IF NOT, edit modp_b64.c, and replace the #include "config.h" with #define WORDS_BIGENDIAN /* for Sun, Ibm, Motorola */ OR #undef WORDS_BIGENDIAN /* For intel, amd */ see the source code for details. Likewise you can pass in -DWORDS_BIGENDIAN or -DNWORDS_BIGENDIAN during compilation. For b85: -------- There are no endian issues. Just copy * src/modp_b85.c * src/modp_b85.h * modp_b85_data.h ---------------------------------------- UNIT TESTS ---------------------------------------- Two unit tests are included that are not installed. They are built automatically and can be run with "make test" ./speedtest tests performance of b64 and b85 ./unittest tests correctness of b64 ./b85test test correectness of b75 If you are changing the base64 alphabet, just edit the b64gen.c program and type 'make'. If you are changing the base85 alphabet, edit the b85gen.c program and type 'make'. ALWAYS UNIT TEST ANY CHANGES. The current unittests depend on the standard alphabet, so you might need to tweek them if to make custom alterations.