added template method to dec
added template method to enc
rn data to string