archive50.go
func checkPassword(b *readBuf, keys [][]byte) error {
	if len(*b) < 12 {
		return nil // not enough bytes, ignore for the moment
	}
	pwcheck := b.bytes(8)
	sum := b.bytes(4)
	csum := sha256.Sum256(pwcheck)
	if bytes.Equal(sum, csum[:len(sum)]) && !bytes.Equal(pwcheck, keys[2]) {
		return errBadPassword
	}
	return nil
}
func checkPassword(b *readBuf, keys [][]byte) error {
	if len(*b) < 12 {
		return nil // not enough bytes, ignore for the moment
	}
	pwcheck := b.bytes(8)
	sum := b.bytes(4)
	csum := sha256.Sum256(pwcheck)
	if bytes.Equal(sum, csum[:len(sum)]) && !bytes.Equal(pwcheck, keys[2]) {
		return errBadPassword
	}
	return nil
}
// checkPassword calculates if a password is correct given password check data and keys.