shiro has a Hex helper, may want to consider using it instead of codec... though IIRC these behave slightly differently.