remove config.mode, allow algo to be a function

Fixes #10, #11 

Or better yet, we can just accept negative values for the `length` as well. This does not break back-compat in any way and you just have to replace `substr` with `slice`.