crchack icon indicating copy to clipboard operation
crchack copied to clipboard

Split into a dynamic lib and a CLI interface to it

Open KOLANICH opened this issue 6 years ago • 1 comments

Usually it is beneficial to split CLI software into 2 layers: * a shared lib doing the stuff * a CLI to it

The benefit is that the lib can be used in other software, of course.

KOLANICH avatar Aug 13 '19 06:08 KOLANICH

A major interface overhaul is coming soon in order to add support for streaming CRC calculation (#5) and a more efficient forging algorithm (#2). Let's consider splitting crchack into a dynamic library after that. However, offering a user-friendly library is probably not going to be trivial due to cumbersome bigints required for arbitrary precision CRC calculation (crc() & forge() wrappers for common CRC sizes is the obvious, altough ugly, solution).

Anyway, it must be noted that embedding crchack is already very easy. All CLI-related logic is in crchack.{c,h} so adding the other source files (i.e., bigint.{c,h} crc.{c,h} forge.{c,h}) into another project provides crchack's CRC computation and forging functionality without unnecessary extra baggage. A shared library has few advantages over this approach.

resilar avatar Aug 14 '19 18:08 resilar