zig/lib/std
Frank Denis b8c019ef49 std/base64: cleanups & support url-safe and other non-padded variants
This makes a few changes to the base64 codecs.

* The padding character is optional. The common "URL-safe" variant, in
particular, is generally not used with padding. This is also the case for
password hashes, so having this will avoid code duplication with bcrypt,
scrypt and other functions.
* The URL-safe variant is added. Instead of having individual constants
for each parameter of each variant, we are now grouping these in a
struct. So, `standard_pad_char` just becomes `standard.pad_char`.
* Types are not `snake_case`'d any more. So, `standard_encoder` becomes
`standard.Encoder`, as it is a type.
* Creating a decoder with ignored characters required the alphabet and
padding. Now, `standard.decoderWithIgnore(<ignored chars>)` returns a
decoder with the standard parameters and the set of ignored chars.
* Whatever applies to `standard.*` obviously also works with `url_safe.*`
* the `calcSize()` interface was inconsistent, taking a length in the
encoder, and a slice in the encoder. Rename the variant that takes a
slice to `calcSizeForSlice()`.
* In the decoder with ignored characters, add `calcSizeUpperBound()`,
which is more useful than the one that takes a slice in order to size
a fixed buffer before we have the data.
* Return `error.InvalidCharacter` when the input actually contains
characters that are neither padding nor part of the alphabet. If we
hit a padding issue (which includes extra bits at the end),
consistently return `error.InvalidPadding`.
* Don't keep the `char_in_alphabet` array permanently in a decoder;
it is only required for sanity checks during initialization.
* Tests are unchanged, but now cover both the standard (padded) and
the url-safe (non-padded) variants.
* Add an error set, rename `OutputTooSmallError` to `NoSpaceLeft`
to match the `hex2bin` equivalent.
2021-03-28 14:32:34 +02:00
..
atomic std: Swap arguments in Thread.spawn 2021-02-28 14:03:19 +01:00
build Merge pull request #7763 from kivikakk/zig-elf-parse 2021-03-04 11:56:31 -08:00
c translate-c: fix __builtin_object_size 2021-03-17 09:06:47 +02:00
compress Convert inline fn to callconv(.Inline) everywhere 2021-02-10 20:06:12 -07:00
crypto std/crypto/chacha20: add round-reduced versions & cleanup internals 2021-03-17 11:25:51 -07:00
event std: Swap arguments in Thread.spawn 2021-02-28 14:03:19 +01:00
fmt Reject bare +/- input when parsing floats 2021-03-05 13:11:20 +01:00
fs std: Fix std.fs.path.joinZ 2021-03-18 14:33:38 +02:00
hash Specify type in autoHash error message 2021-03-21 23:07:02 +02:00
heap std.GeneralPurposeAllocator: logging improvements 2021-01-30 20:15:26 -07:00
io make std.c.getErrno() return same type as _errno() aka c_int 2021-03-12 15:04:36 +01:00
json HashMap.put returns !void, not a !bool 2021-02-27 13:11:47 +02:00
math replace ArrayList.shrinkAndFree by ArrayList.shrinkRetainingCapacity 2021-02-21 11:56:14 +02:00
mem std: Clear old memory on free 2021-02-25 22:20:30 +02:00
meta Add some enum utilities 2021-03-18 14:05:01 -07:00
net std: Swap arguments in Thread.spawn 2021-02-28 14:03:19 +01:00
os boot_services: implement locateDevicePath 2021-03-25 16:45:43 +02:00
rand
special std.build: make Builder.install_prefix non optional 2021-03-24 12:29:50 +01:00
target target: map zig ppc32 → llvm ppc 2021-02-04 14:22:38 -08:00
testing
Thread std: Swap arguments in Thread.spawn 2021-02-28 14:03:19 +01:00
time
unicode
valgrind
zig zig fmt: don't add trailing whitespace on switch case 2021-03-16 09:26:28 +01:00
array_hash_map.zig array_hash_map: decrement entries slice len after popping from entries in pop() to prevent oob 2021-03-28 11:02:37 +02:00
array_list.zig
ascii.zig std.ascii: add lessThanIgnoreCase and orderIgnoreCase 2021-02-27 01:21:01 -07:00
atomic.zig
base64.zig std/base64: cleanups & support url-safe and other non-padded variants 2021-03-28 14:32:34 +02:00
bit_set.zig Add some enum utilities 2021-03-18 14:05:01 -07:00
buf_map.zig
buf_set.zig HashMap.put returns !void, not a !bool 2021-02-27 13:11:47 +02:00
build.zig std.build: make Builder.install_prefix non optional 2021-03-24 12:29:50 +01:00
builtin.zig stage1: switch from inline fn to callconv(.Inline) 2021-02-10 20:06:13 -07:00
c.zig std: support optional getaddrinfo arguments 2021-03-16 01:10:32 +01:00
child_process.zig
coff.zig zig fmt the std lib 2021-02-24 21:29:23 -07:00
compress.zig
comptime_string_map.zig
crypto.zig std/crypto/chacha20: add round-reduced versions & cleanup internals 2021-03-17 11:25:51 -07:00
cstr.zig
debug.zig zld: use zld when linking aarch64 by default and cross-comp 2021-03-18 00:37:13 +01:00
dwarf.zig zig fmt the std lib 2021-02-24 21:29:23 -07:00
dwarf_bits.zig
dynamic_library.zig
elf.zig elf: make EM non-exhaustive 2021-03-11 10:09:51 +11:00
enums.zig Add some enum utilities 2021-03-18 14:05:01 -07:00
event.zig
fifo.zig std.fifo.LinearFifo - Expose reader and writer type. 2021-02-22 00:22:46 +02:00
fmt.zig Implement fmtDuration using Formatter (#8137) 2021-03-07 15:00:15 +02:00
fs.zig std/base64: cleanups & support url-safe and other non-padded variants 2021-03-28 14:32:34 +02:00
hash.zig
hash_map.zig stage2 cbe: non pointer optionals 2021-03-08 00:33:56 +02:00
heap.zig
io.zig std: remove io.AutoIndentingStream 2021-02-16 23:20:46 +01:00
json.zig HashMap.put returns !void, not a !bool 2021-02-27 13:11:47 +02:00
leb128.zig
linked_list.zig
log.zig zig fmt the std lib 2021-02-24 21:29:23 -07:00
macho.zig zld: fix GOT loads and indirection on x86_64 2021-03-17 19:59:57 +01:00
math.zig zig fmt the std lib 2021-03-01 20:04:28 -07:00
mem.zig std: Add reset to TokenIterator 2021-03-20 22:01:09 -07:00
meta.zig translate-c: improve std.meta.cast 2021-03-17 00:05:42 +02:00
multi_array_list.zig std: Handle empty MultiArrayList in items() 2021-03-12 00:17:35 +01:00
net.zig replace ArrayList.shrinkAndFree by ArrayList.shrinkRetainingCapacity 2021-02-21 11:56:14 +02:00
once.zig std: Swap arguments in Thread.spawn 2021-02-28 14:03:19 +01:00
os.zig os/linux: handle ECONNRESET for recv 2021-03-25 12:41:51 -07:00
packed_int_array.zig
pdb.zig Don't read more bytes than exist in MsfStream (#7839) 2021-02-01 15:27:39 -05:00
priority_queue.zig HashMap.put returns !void, not a !bool 2021-02-27 13:11:47 +02:00
process.zig initial support for haiku continue clean up 2021-02-25 16:41:42 -07:00
Progress.zig std: Use more common escape sequences in Progress 2021-03-12 19:31:59 -05:00
rand.zig
SemanticVersion.zig
sort.zig
start.zig Convert inline fn to callconv(.Inline) everywhere 2021-02-10 20:06:12 -07:00
start_windows_tls.zig
std.zig Add some enum utilities 2021-03-18 14:05:01 -07:00
target.zig haiku: minor fixups 2021-02-25 16:54:32 -07:00
testing.zig std/base64: cleanups & support url-safe and other non-padded variants 2021-03-28 14:32:34 +02:00
Thread.zig make std.c.getErrno() return same type as _errno() aka c_int 2021-03-12 15:04:36 +01:00
time.zig
unicode.zig
valgrind.zig
wasm.zig Ensure function indices are correct and fix a memory leak 2021-02-05 18:06:25 +01:00
zig.zig Merge remote-tracking branch 'origin/master' into ast-memory-layout 2021-02-11 23:45:40 -07:00