ADDED: fast methods to write binary and hexadecimal strings