Debian Codegraph @

dns/zonetypes.py

raw
1 # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
2
3 """Common zone-related types."""
4
5 # This is a separate file to avoid import circularity between dns.zone and
6 # the implementation of the ZONEMD type.
7
8 import hashlib
9
10 import dns.enum
11
12
13 class DigestScheme(dns.enum.IntEnum):
14 """ZONEMD Scheme"""
15
16 SIMPLE = 1
17
18 @classmethod
19 def _maximum(cls):
20 return 255
21
22
23 class DigestHashAlgorithm(dns.enum.IntEnum):
24 """ZONEMD Hash Algorithm"""
25
26 SHA384 = 1
27 SHA512 = 2
28
29 @classmethod
30 def _maximum(cls):
31 return 255
32
33
34 _digest_hashers = {
35 DigestHashAlgorithm.SHA384: hashlib.sha384,
36 DigestHashAlgorithm.SHA512: hashlib.sha512,
37 }