1 2---------------------------------------- 3RAW 4---------------------------------------- 5 6If you are pulling this from github, please run `./bootstrap.sh` to do 7all the gnu-isms. 8 9 10Mac Users: 11 12```bash 13brew install m4 autoconf automake libtool 14``` 15 16(maybe more?) 17 18---------------------------------------- 19PLAIN INSTALL 20---------------------------------------- 21 22 23EXPORT CFLAGS='your optimization flags' 24 25 gcc defaults to "-O2 -g" you probably want "-O3 -Wall" 26 27./configure 28 29make 30 31make check 32 33make install 34 will produce a shared and static library and put in the right places. 35 it will also install the include files. 36 37---------------------------------------- 38CHANGING THE b64 web/url SAFE ALPHABET 39---------------------------------------- 40 41If you are using base 64 encoding for use IN A URL, you 42CAN NOT use the standard mod_b64. You MUST use modp_b64w 43(the w is for "web"). Unfortunately this is not standardized 44and if you are working with a third party, you might need to 45change the "alphabet" (chars). 46 47You can change char 62,63 and the padding char with 48 49./configure --with-b64wchars='-_.' 50 51where "-" is char 62, "_" is char 63 and "." is the padding char. 52 53You can change this if you know what you are doing. 54 55---------------------------------------- 56IF YOU DON'T WANT TO DEAL WITH A LIBRARY 57---------------------------------------- 58 59Base64 and base85 functions are so small, you might just want to 60directly add them into your existing project. That's fine, it's all 61under the BSD license, so go ahead. 62 63 64For b64: 65-------- 66After doing a "./configure && make", copy 67 * src/modp_b64.c 68 * src/modp_b64.h 69 * modp_b64_data.h 70 71***** BUT, there is an IMPORTANT GOTCHA! ***** 72 73This code has special versions that are -endian- dependant. This 74means different code is used on an Intel CPU than it is on a Motorola, 75IBM, or Sun CPU. 76 77**** IF you are using autoconf, just add AC_C_BIGENDIAN to your 78configure.in script and everything will work. 79 80**** IF NOT, edit modp_b64.c, and replace the 81#include "config.h" 82with 83#define WORDS_BIGENDIAN /* for Sun, Ibm, Motorola */ 84OR 85#undef WORDS_BIGENDIAN /* For intel, amd */ 86 87see the source code for details. Likewise you can pass in 88-DWORDS_BIGENDIAN or -DNWORDS_BIGENDIAN during compilation. 89 90For b85: 91-------- 92There are no endian issues. Just copy 93 94 * src/modp_b85.c 95 * src/modp_b85.h 96 * modp_b85_data.h 97 98---------------------------------------- 99UNIT TESTS 100---------------------------------------- 101 102Two unit tests are included that are not installed. They are built 103automatically and can be run with "make test" 104 105./speedtest tests performance of b64 and b85 106./unittest tests correctness of b64 107./b85test test correectness of b75 108 109 110If you are changing the base64 alphabet, just edit the b64gen.c program 111and type 'make'. 112 113If you are changing the base85 alphabet, edit the b85gen.c program and 114type 'make'. 115 116ALWAYS UNIT TEST ANY CHANGES. The current unittests depend on the 117standard alphabet, so you might need to tweek them if to make custom 118alterations. 119 120