Implement phogen.encode() to encode Bhashes to phogen strings. This commit also adds unit tests for the above function.