本文整理汇总了Python中pyndn.name.Name.appendImplicitSha256Digest方法的典型用法代码示例。如果您正苦于以下问题:Python Name.appendImplicitSha256Digest方法的具体用法?Python Name.appendImplicitSha256Digest怎么用?Python Name.appendImplicitSha256Digest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyndn.name.Name
的用法示例。
在下文中一共展示了Name.appendImplicitSha256Digest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getFullName
# 需要导入模块: from pyndn.name import Name [as 别名]
# 或者: from pyndn.name.Name import appendImplicitSha256Digest [as 别名]
def getFullName(self, wireFormat = None):
"""
Get the Data packet's full name, which includes the final
ImplicitSha256Digest component based on the wire encoding for a
particular wire format.
:param wireFormat: (optional) A WireFormat object used to encode
this object. If omitted, use WireFormat.getDefaultWireFormat().
:type wireFormat: A subclass of WireFormat
:return: The full name. You must not change the Name object - if you
need to change it then make a copy.
:rtype: Name
"""
if wireFormat == None:
# Don't use a default argument since getDefaultWireFormat can change.
wireFormat = WireFormat.getDefaultWireFormat()
# The default full name depends on the default wire encoding.
if (not self.getDefaultWireEncoding().isNull() and
self._defaultFullName.size() > 0 and
self.getDefaultWireEncodingFormat() == wireFormat):
# We already have a full name. A non-null default wire encoding
# means that the Data packet fields have not changed.
return self._defaultFullName
fullName = Name(self.getName())
sha256 = hashes.Hash(hashes.SHA256(), backend=default_backend())
sha256.update(self.wireEncode(wireFormat).toBytes())
fullName.appendImplicitSha256Digest(
Blob(bytearray(sha256.finalize()), False))
if wireFormat == WireFormat.getDefaultWireFormat():
# wireEncode has already set defaultWireEncodingFormat_.
self._defaultFullName = fullName
return fullName