Add to/refactor NSData encoding extension, add related tests.