add checksum function

Fixed #2
If checksum wrong, will return false