implement encode and decode
Merge pull request #2 from muayyad-alsadi/master

basic implementation of encode/decode