entangled icon indicating copy to clipboard operation
entangled copied to clipboard

common/{curl-p, kerl} - provide streaming abstraction layer

Open th0br0 opened this issue 6 years ago • 0 comments
trafficstars

At the moment for absorb/squeeze the caller is required to provide the full input (or output) trit arrays even though we're processing them in chunks of 243 trits at a time.

We can improve this by providing a somewhat generic 'sponge' abstraction layer. Using code-generation akin to our hash_arrays we can have an interface like

retcode_t {NAME}_absorb_stream({NAME}_t* inst, flex_trit_t* input, size_t trit_len);
retcode_t {NAME}_squeeze_stream({NAME}_t* inst, flex_trit_t* output, size_t trit_len);

The implementation then (de)serialises e.g. the input in chunks of 243 trit_t and calls absorb with this. This leads to greatly reduced total memory requirements at a miniscule amount of processing overhead.

th0br0 avatar Mar 01 '19 05:03 th0br0