X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fbase224.h;h=fded9f4c841a1c526eda3fa6122858e0d95658d9;hb=ac5c029143b60498116adbea326eb7b3ce6fa160;hp=7e815d8c3b864f16795ce1d535e6b716ea2bb271;hpb=031256ad2e123eec58521f8e3eb9496c197641d2;p=libucw.git diff --git a/ucw/base224.h b/ucw/base224.h index 7e815d8c..fded9f4c 100644 --- a/ucw/base224.h +++ b/ucw/base224.h @@ -7,12 +7,28 @@ * of the GNU Lesser General Public License. */ +#ifdef CONFIG_UCW_CLEAN_ABI +#define base224_decode ucw_base224_decode +#define base224_encode ucw_base224_encode +#endif + +/** + * Encodes @len bytes of data pointed to by @src by base224 encoding. + * Stores them in @dest and returns the number of bytes the output + * takes. + */ uns base224_encode(byte *dest, const byte *src, uns len); +/** + * Decodes @len bytes of data pointed to by @src from base224 encoding. + * All invalid characters are ignored. The result is stored into @dest + * and length of the result is returned. + */ uns base224_decode(byte *dest, const byte *src, uns len); -/* - * Warning: when encoding, at least 4 bytes of extra space are needed. - * Better use this macro to calculate buffer size. +/** + * Use this macro to calculate @base224_encode() output buffer size. + * It can happen 4 more bytes would be needed, this macro takes care + * of that. */ #define BASE224_ENC_LENGTH(x) (((x)*8+38)/39*5) @@ -21,5 +37,5 @@ uns base224_decode(byte *dest, const byte *src, uns len); * always BASE224_OUT_CHUNK bytes long. If a longer block is split * to such chunks, the result will be identical. */ -#define BASE224_IN_CHUNK 39 -#define BASE224_OUT_CHUNK 40 +#define BASE224_IN_CHUNK 39 /** Chunk size on the un-encoded side. **/ +#define BASE224_OUT_CHUNK 40 /** Chunk size on the encoded side. **/