nistbeacon/nistbeaconcrypto.py
def verify(
            cls,
            timestamp: int,
            message_hash: SHA512Hash,
            signature: bytes,
    ) -> bool:
        """
        Verify a given NIST message hash and signature for a beacon value.

        :param timestamp: The timestamp of the record being verified.
        :param message_hash:
            The hash that was carried out over the message.
            This is an object belonging to the `Crypto.Hash` module.
        :param signature: The signature that needs to be validated.
        :return: True if verification is correct. False otherwise.
        """

        # Determine verifier type to use based on timestamp.
        if timestamp < 1496176860:
            verifier = cls._VERIFIER_20130905
        elif timestamp < 1502202360:
            verifier = None
        else:
            verifier = cls._VERIFIER_20170808

        # If a verifier exists to handle this problem, use it directly.
        # Else, we cannot verify the record and must mark it invalid.
        if verifier:
            result = verifier.verify(
                message_hash,
                signature,
            )
        else:
            result = False

        # Convert 1 to 'True', 'False' otherwise
        if isinstance(result, int):
            result = True if result == 1 else False

        return result
def verify(
            cls,
            timestamp: int,
            message_hash: SHA512Hash,
            signature: bytes,
    ) -> bool:
        """
        Verify a given NIST message hash and signature for a beacon value.

        :param timestamp: The timestamp of the record being verified.
        :param message_hash:
            The hash that was carried out over the message.
            This is an object belonging to the `Crypto.Hash` module.
        :param signature: The signature that needs to be validated.
        :return: True if verification is correct. False otherwise.
        """

        # Determine verifier type to use based on timestamp.
        if timestamp < 1496176860:
            verifier = cls._VERIFIER_20130905
        elif timestamp < 1502202360:
            verifier = None
        else:
            verifier = cls._VERIFIER_20170808

        # If a verifier exists to handle this problem, use it directly.
        # Else, we cannot verify the record and must mark it invalid.
        if verifier:
            result = verifier.verify(
                message_hash,
                signature,
            )
        else:
            result = False

        # Convert 1 to 'True', 'False' otherwise
        if isinstance(result, int):
            result = True if result == 1 else False

        return result
def verify ( cls , timestamp : int , message_hash : SHA512Hash , signature : bytes , ) -> bool : # Determine verifier type to use based on timestamp. if timestamp < 1496176860 : verifier = cls . _VERIFIER_20130905 elif timestamp < 1502202360 : verifier = None else : verifier = cls . _VERIFIER_20170808 # If a verifier exists to handle this problem, use it directly. # Else, we cannot verify the record and must mark it invalid. if verifier : result = verifier . verify ( message_hash , signature , ) else : result = False # Convert 1 to 'True', 'False' otherwise if isinstance ( result , int ) : result = True if result == 1 else False return result
Verify a given NIST message hash and signature for a beacon value.

        :param timestamp: The timestamp of the record being verified.
        :param message_hash:
            The hash that was carried out over the message.
            This is an object belonging to the `Crypto.Hash` module.
        :param signature: The signature that needs to be validated.
        :return: True if verification is correct. False otherwise.
Verify a given NIST message hash and signature for a beacon value .