make public interface take Buffers, not numbers

Original patch from Danny Coates, extracted from PR #9.

This puts a converting wrapper around the internal functions. A later
refactoring will move this conversion down into the functions and get
rid of the wrapper.