MCPcopy Create free account
hub / github.com/secdev/scapy / make_checksum

Method make_checksum

scapy/libs/rfc3961.py:1334–1351  ·  view source on GitHub ↗

Create a checksum using the current Key. :param keyusage: the key usage :param text: the text to create a checksum from :param cksumtype: (optional) override the checksum type

(self, keyusage, text, cksumtype=None, **kwargs)

Source from the content-addressed store, hash-verified

1332 return self.ep.prf(self, string)
1333
1334 def make_checksum(self, keyusage, text, cksumtype=None, **kwargs):
1335 # type: (int, bytes, Optional[int], **Any) -> bytes
1336 """
1337 Create a checksum using the current Key.
1338
1339 :param keyusage: the key usage
1340 :param text: the text to create a checksum from
1341 :param cksumtype: (optional) override the checksum type
1342 """
1343 if cksumtype is not None and cksumtype != self.cksumtype:
1344 # Clone key and use a different cksumtype
1345 return Key(
1346 cksumtype=cksumtype,
1347 key=self.key,
1348 ).make_checksum(keyusage=keyusage, text=text, **kwargs)
1349 if self.cksumtype is None:
1350 raise ValueError("cksumtype not specified !")
1351 return self.cp.checksum(self, keyusage, text, **kwargs)
1352
1353 def verify_checksum(self, keyusage, text, cksum, cksumtype=None):
1354 # type: (int, bytes, bytes, Optional[int]) -> None

Callers 1

_resign_ticketMethod · 0.45

Calls 2

KeyClass · 0.85
checksumMethod · 0.45

Tested by

no test coverage detected