Add a helper function to calculate the checksum. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>