generate p2pkh address. if script dose not p2pkh, return nil.
439122
def p2pkh_addr
      return nil unless p2pkh?
      hash160 = chunks[2].pushed_data.bth
      return nil unless hash160.htb.bytesize == 20
      Bitcoin.encode_base58_address(hash160, Bitcoin.chain_params.address_version)
    end
337218
def private_key_to_address(self, pk):
        
        pub = privtopub(pk)
        pub_byte, priv_byte = get_magic_bytes(self.crypto)

        if priv_byte >= 128:
            priv_byte -= 128 #pybitcointools bug

        return pubtoaddr(pub, pub_byte)
867017
def p2pkh?
      return false unless chunks.size == 5
      [OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG] ==
          (chunks[0..1]+ chunks[3..4]).map(&:ord) && chunks[2].bytesize == 21
    end
771527
def make_sh_address(script_string, witness=False, cashaddr=True):
    '''
    
    '''
    script_bytes = script_ser.serialize(script_string)

    return _ser_script_to_sh_address(
        script_bytes=script_bytes,
        witness=witness,
        cashaddr=cashaddr)
102068
def make_multisig_segwit_address_from_witness_script(script):
    
    script_hash = hashing.bin_sha256(script.decode('hex')).encode('hex')
    scriptsig_script = '0020' + script_hash
    addr = btc_make_p2sh_address(scriptsig_script)
    return addr
1038724
function generatePskSecret(ecdhForLocalDevice, remotePeerPublicKey,
                                  pskIdentityField) {
  var sxy = ecdhForLocalDevice.computeSecret(remotePeerPublicKey);
  return HKDF(module.exports.SHA256, sxy, pskIdentityField)
    .derive('', module.exports.AES_256_KEY_SIZE);
}
294497
def generate_by_hash(hashcode):
    """"""
    img = Image.new(IMAGE_MODE, IMAGE_SIZE, BACKGROUND_COLOR)
    if len(hashcode) < 32:
        print ("hashcode must have lenght >= 32, %s" % hashcode)
        raise FalseHashError

    allowed = "0123456789abcdef"
    hashcheck = [c in allowed for c in hashcode]
    if False in hashcheck:
        print ("hashcode has not allowed structure %s" % hashcode)
        raise FalseHashError

    pixelmap = setup_pixelmap(hashcode)
    draw_image(pixelmap, img)
    return img
499986
def GetAddress(self):
        
        script = b'21' + self.PublicKey.encode_point(True) + b'ac'
        script_hash = Crypto.ToScriptHash(script)
        address = Crypto.ToAddress(script_hash)
        return address
932442
def btc_is_p2sh_address( address ):
    
    vb = keylib.b58check.b58check_version_byte( address )
    if vb == multisig_version_byte:
        return True
    else:
        return False
378722
def btc_is_p2pkh_address( address ):
    
    vb = keylib.b58check.b58check_version_byte( address )
    if vb == version_byte:
        return True
    else:
        return False
1316408
def script
      raise ArgumentError, "BTC::ScriptHashAddress: invalid data length (must be 20 bytes)" if self.data.bytesize != 20
      BTC::Script.new << OP_HASH160 << self.data << OP_EQUAL
    end
161510
def make_pkh_output(value, pubkey, witness=False):
    '''
    
    '''
    return _make_output(
        value=utils.i2le_padded(value, 8),
        output_script=make_pkh_output_script(pubkey, witness))
421614
def p2pkh(self, s):
        
        data = self.parse_b58_hashed(s)
        if data is None or not data.startswith(self._address_prefix):
            return None
        size = len(self._address_prefix)
        script = self._network.contract.for_p2pkh(data[size:])
        script_info = self._network.contract.info_for_script(script)
        return Contract(script_info, self._network)
443551
public static boolean isP2WPKH(Script script) {
        if (!isP2WH(script))
            return false;
        List<ScriptChunk> chunks = script.chunks;
        if (!chunks.get(0).equalsOpCode(OP_0))
            return false;
        byte[] chunk1data = chunks.get(1).data;
        return chunk1data != null && chunk1data.length == SegwitAddress.WITNESS_PROGRAM_LENGTH_PKH;
    }
1216737
def output(self):
        
        hash160 = self._script_info.get("hash160", None)
        if hash160:
            yield ("hash160", b2h(hash160), None)

        address = self.address()
        yield ("address", address, "%s address" % self._network.network_name)
        yield ("%s_address" % self._network.symbol, address, "legacy")
83471
def create_transaction_output(address, output_value):
    
    bitcoin_address = CBitcoinAddress(address)
    tx_out = CMutableTxOut(output_value, bitcoin_address.to_scriptPubKey())
    return tx_out
1330657
def address_from_vm_code(code: str):
        
        script_hash = Address.to_script_hash(bytearray.fromhex(code))[::-1]
        return Address(script_hash)