Whether post requires password and correct password has been provided.

Signature

post_password_required( $post = null )
post
 (int|WP_Post) An optional post. Global $post used if not provided.
Default: null

Return

(boolean) false if a password is not required or the correct password cookie is present, true otherwise.

Source

function post_password_required( $post = null ) {
	$post = get_post($post);

	if ( empty( $post->post_password ) )
		return false;

	if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
		return true;

	require_once ABSPATH . WPINC . '/class-phpass.php';
	$hasher = new PasswordHash( 8, true );

	$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
	if ( 0 !== strpos( $hash, '$P$B' ) )
		return true;

	return ! $hasher->CheckPassword( $post->post_password, $hash );
}
WP Trac GitHub

Link here