On 29/01/2015 5:51 p.m., Amos Jeffries wrote:
RFC 4648 (https://tools.ietf.org/html/rfc4648) standardizes two Base-64 alphabets. Nettle currently only supports the traditional base-64 alphabet from section 4.
There is growing use amongst new protocol definitions and extensions, particularly in the HTTP area for the URL-safe extension alphabet instead of the classical Base-64 alphabet.
The attached patch implements a proposed API/ABI extension adding support for RFC 4648 section 5 "Base 64 Encoding with URL and Filename Safe Alphabet"
For the standardized alphabets external code simply calls the init() function relevant to the alphabet it is needing to encode/decode with. The library internally uses the context to select which lookup table to use for later base64 function calls.
For custom or non-standard alphabets a pointer to the alphabet lookup table is included in the encode/decode contexts. External code can memset() a context to empty and provide the alphabet lookup table pointer.
Amos Jeffries Treehouse Networks Ltd.
PS, I have also removed the dead code wrappend in "#if 0" rather than updating it.
Meh Nix that earlier patch. Here is an updated version without the stupid syntax errors.
This passes the base64 unit tests, but there are no specific tests for the difference in lookup tables (and no test vectors in the RFC either). If you want some added I can look at adding some.
Amos