Added a decoder and a digest struct for external ussage

* I modified tests