File: zonetypes.py

package info (click to toggle)
dnspython 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,556 kB
  • sloc: python: 37,194; sh: 7; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license

"""Common zone-related types."""

# This is a separate file to avoid import circularity between dns.zone and
# the implementation of the ZONEMD type.

import hashlib

import dns.enum


class DigestScheme(dns.enum.IntEnum):
    """ZONEMD Scheme"""

    SIMPLE = 1

    @classmethod
    def _maximum(cls):
        return 255


class DigestHashAlgorithm(dns.enum.IntEnum):
    """ZONEMD Hash Algorithm"""

    SHA384 = 1
    SHA512 = 2

    @classmethod
    def _maximum(cls):
        return 255


_digest_hashers = {
    DigestHashAlgorithm.SHA384: hashlib.sha384,
    DigestHashAlgorithm.SHA512: hashlib.sha512,
}