コード例 #1
0
ファイル: util.py プロジェクト: GrandyB/aoc-mgz
 def __init__(self, find, max_length):
     """Initiallize."""
     Construct.__init__(self)
     if not isinstance(find, list):
         find = [find]
     self.find = find
     self.max_length = max_length
コード例 #2
0
def _header_digest(header: c.Container,
                   header_type: c.Construct,
                   hash_function: Callable = blake2s) -> bytes:
    stripped_header = header.copy()
    stripped_header.sigmask = 0
    stripped_header.signature = b"\0" * 64
    stripped_header.v1_key_indexes = [0, 0, 0]
    stripped_header.v1_signatures = [b"\0" * 64] * 3
    header_bytes = header_type.build(stripped_header)
    return hash_function(header_bytes).digest()
コード例 #3
0
ファイル: firmware.py プロジェクト: trezor/python-trezor
def _header_digest(
    header: c.Container,
    header_type: c.Construct,
    hash_function: Callable = pyblake2.blake2s,
) -> bytes:
    stripped_header = header.copy()
    stripped_header.sigmask = 0
    stripped_header.signature = b"\0" * 64
    stripped_header.v1_key_indexes = [0, 0, 0]
    stripped_header.v1_signatures = [b"\0" * 64] * 3
    header_bytes = header_type.build(stripped_header)
    return hash_function(header_bytes).digest()
コード例 #4
0
def _header_digest(header: c.Container, header_type: c.Construct) -> bytes:
    stripped_header = header.copy()
    stripped_header.sigmask = 0
    stripped_header.signature = b"\0" * 64
    header_bytes = header_type.build(stripped_header)
    return pyblake2.blake2s(header_bytes).digest()
コード例 #5
0
ファイル: test.py プロジェクト: r614/PokeBlocks
from construct import Construct
from player import Player

player = Player("Ash")
world = Construct()
world.join(player)
for i in range(0,10):
    world.travel(player)
コード例 #6
0
 def __init__(self, find, max_length):
     """Initiallize."""
     Construct.__init__(self)
     self.find = find
     self.max_length = max_length
コード例 #7
0
ファイル: util.py プロジェクト: aheadley/python-diva
 def __init__(self, name, factoryfunc):
     Construct.__init__(self, name, self.FLAG_COPY_CONTEXT)
     self.factoryfunc = factoryfunc
     self._set_flag(self.FLAG_DYNAMIC)
コード例 #8
0
 def __init__(self, name, factoryfunc):
     Construct.__init__(self, name, self.FLAG_COPY_CONTEXT)
     self.factoryfunc = factoryfunc
     self._set_flag(self.FLAG_DYNAMIC)
コード例 #9
0
ファイル: util.py プロジェクト: coffenbacher/aoc-mgz
	def __init__(self, name):
		Construct.__init__(self, name)
コード例 #10
0
ファイル: util.py プロジェクト: coffenbacher/aoc-mgz
	def __init__(self, name, find, maxLength):
		Construct.__init__(self, name)
		self.find = find
		self.maxLength = maxLength
コード例 #11
0
ファイル: test_core.py プロジェクト: near/borsh-py
def test_serde(obj_type: Construct, obj_input: Any, expected: Any) -> None:
    """Tests that inputs are serialized and deserialized as expected."""
    serialized = obj_type.build(obj_input)
    assert list(serialized) == expected
    deserialized = obj_type.parse(serialized)
    assert deserialized == obj_input
コード例 #12
0
ファイル: misc.py プロジェクト: palewithout/createfile
 def __init__(self, length=None, length_func=None, cons=None):
     Construct.__init__(self, None)
     self.length_func = length_func
     self.length = length
     self.cons = cons
コード例 #13
0
ファイル: misc.py プロジェクト: palewithout/createfile
 def __init__(self, length=None, length_func=None, cons=None):
     Construct.__init__(self, None)
     self.length_func = length_func
     self.length = length
     self.cons = cons