本文整理汇总了Python中armoryengine.BinaryUnpacker.BinaryUnpacker.get方法的典型用法代码示例。如果您正苦于以下问题:Python BinaryUnpacker.get方法的具体用法?Python BinaryUnpacker.get怎么用?Python BinaryUnpacker.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类armoryengine.BinaryUnpacker.BinaryUnpacker
的用法示例。
在下文中一共展示了BinaryUnpacker.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: unserialize
# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
def unserialize(self, toUnpack):
bu = BinaryUnpacker(toUnpack)
self.messageType = bu.get(VAR_STR)
self.rejectCode = bu.get(INT8)
self.message = bu.get(VAR_STR)
self.data = bu.get(BINARY_CHUNK, bu.getRemainingSize())
self.serializedData = toUnpack
return self
示例2: unserialize
# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
def unserialize(self, toUnpack):
if isinstance(toUnpack, BinaryUnpacker):
blkData = toUnpack
else:
blkData = BinaryUnpacker( toUnpack )
self.version = blkData.get(UINT32)
self.prevBlkHash = blkData.get(BINARY_CHUNK, 32)
self.merkleRoot = blkData.get(BINARY_CHUNK, 32)
self.timestamp = blkData.get(UINT32)
self.diffBits = blkData.get(BINARY_CHUNK, 4)
self.nonce = blkData.get(UINT32)
self.theHash = hash256(self.serialize())
return self
示例3: unserialize
# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
def unserialize(self, toUnpack):
if isinstance(toUnpack, BinaryUnpacker):
msgData = toUnpack
else:
msgData = BinaryUnpacker( toUnpack )
self.magic = msgData.get(BINARY_CHUNK, 4)
self.cmd = msgData.get(BINARY_CHUNK, 12).strip('\x00')
length = msgData.get(UINT32)
chksum = msgData.get(BINARY_CHUNK, 4)
payload = msgData.get(BINARY_CHUNK, length)
payload = verifyChecksum(payload, chksum)
self.payload = PayloadMap[self.cmd]().unserialize(payload)
if self.magic != MAGIC_BYTES:
raise NetworkIDError, 'Message has wrong network bytes!'
return self
示例4: executeScript
# 需要导入模块: from armoryengine.BinaryUnpacker import BinaryUnpacker [as 别名]
# 或者: from armoryengine.BinaryUnpacker.BinaryUnpacker import get [as 别名]
def executeScript(self, binaryScript, stack=[]):
self.stack = stack
self.stackAlt = []
scriptData = BinaryUnpacker(binaryScript)
self.lastOpCodeSepPos = None
while scriptData.getRemainingSize() > 0:
opcode = scriptData.get(UINT8)
exitCode = self.executeOpCode(opcode, scriptData, self.stack, self.stackAlt)
if not exitCode == SCRIPT_NO_ERROR:
if exitCode==OP_NOT_IMPLEMENTED:
LOGERROR('***ERROR: OpCodes OP_IF, OP_NOTIF, OP_ELSE, OP_ENDIF,')
LOGERROR(' have not been implemented, yet. This script')
LOGERROR(' could not be evaluated.')
if exitCode==OP_DISABLED:
LOGERROR('***ERROR: This script included an op code that has been')
LOGERROR(' disabled for security reasons. Script eval')
LOGERROR(' failed.')
return exitCode
return SCRIPT_NO_ERROR