Beispiel #1
0
    def from_extended_seed(extended_seed: bytes):
        if len(extended_seed) != 51:
            raise Exception('Extended seed should be 51 bytes long')

        descr = QRLDescriptor.fromBytes(extended_seed[0:3])
        if descr.getSignatureType() != pyqrllib.XMSS:
            raise Exception('Signature type nor supported')

        height = descr.getHeight()
        hash_function = descr.getHashFunction()
        tmp = XmssFast(extended_seed[3:], height, hash_function)
        return XMSS(tmp)
Beispiel #2
0
 def ParseAddress(self, request: qrl_pb2.ParseAddressReq, context) -> qrl_pb2.ParseAddressResp:
     response = qrl_pb2.ParseAddressResp()
     response.is_valid = QRLHelper.addressIsValid(request.address)
     descriptor = QRLDescriptor.fromBytes(request.address[:3])
     hf_dict = {0: 'SHA2-256', 1: 'SHAKE-128', 2: 'SHAKE-256', 3: 'RESERVED'}
     ss_dict = {0: 'XMSS', 1: 'XMSS-MT'}
     af_dict = {0: 'SHA2-256', 1: 'RESERVED', 3: 'RESERVED'}
     response.desc.hash_function = hf_dict[descriptor.getHashFunction()]
     response.desc.tree_height = descriptor.getHeight()
     response.desc.signatures = 2**response.desc.tree_height
     response.desc.signature_scheme = ss_dict[descriptor.getSignatureType()]
     response.desc.address_format = af_dict[descriptor.getAddrFormatType()]
     return response
Beispiel #3
0
def qrladdress(address_seed_str: str) -> bytes:
    extended_seed = QRLDescriptor(SHA2_256, pyqrllib.pyqrllib.XMSS, 4, 0).getBytes() + \
                    shake128(48, address_seed_str.encode())
    return bytes(QRLHelper.getAddress(extended_seed))