1# This file is dual licensed under the terms of the Apache License, Version 
    2# 2.0, and the BSD License. See the LICENSE file in the root of this repository 
    3# for complete details. 
    4 
    5from __future__ import annotations 
    6 
    7from cryptography.hazmat.bindings._rust import asn1 
    8from cryptography.hazmat.primitives import hashes 
    9 
    10decode_dss_signature = asn1.decode_dss_signature 
    11encode_dss_signature = asn1.encode_dss_signature 
    12 
    13 
    14class Prehashed: 
    15    def __init__(self, algorithm: hashes.HashAlgorithm): 
    16        if not isinstance(algorithm, hashes.HashAlgorithm): 
    17            raise TypeError("Expected instance of HashAlgorithm.") 
    18 
    19        self._algorithm = algorithm 
    20        self._digest_size = algorithm.digest_size 
    21 
    22    @property 
    23    def digest_size(self) -> int: 
    24        return self._digest_size