Binary encoder and decoder from/to decimal or text