Updating digest to return buffer or string