Bip38 Functions =============== .. c:function:: int bip38_raw_from_private_key(const unsigned char *bytes, size_t bytes_len, const unsigned char *pass, size_t pass_len, uint32_t flags, unsigned char *bytes_out, size_t len) Encode a private key in raw BIP 38 address format. :param bytes: Private key to use. :param bytes_len: Size of ``bytes`` in bytes. Must be `EC_PRIVATE_KEY_LEN`. :param pass: Password for the encoded private key. :param pass_len: Length of ``pass`` in bytes. :param flags: :ref:`bip38-flags` indicating desired behavior. :param bytes_out: Destination for the resulting raw BIP38 address. :param len: Size of ``bytes_out``. Must be `BIP38_SERIALIZED_LEN`. :return: See :ref:`error-codes` .. c:function:: int bip38_from_private_key(const unsigned char *bytes, size_t bytes_len, const unsigned char *pass, size_t pass_len, uint32_t flags, char **output) Encode a private key in BIP 38 address format. :param bytes: Private key to use. :param bytes_len: Size of ``bytes`` in bytes. Must be `EC_PRIVATE_KEY_LEN`. :param pass: Password for the encoded private key. :param pass_len: Length of ``pass`` in bytes. :param flags: :ref:`bip38-flags` indicating desired behavior. :param output: Destination for the resulting BIP38 address. :return: See :ref:`error-codes` .. c:function:: int bip38_raw_to_private_key(const unsigned char *bytes, size_t bytes_len, const unsigned char *pass, size_t pass_len, uint32_t flags, unsigned char *bytes_out, size_t len) Decode a raw BIP 38 address to a private key. :param bytes: Raw BIP 38 address to decode. :param bytes_len: Size of ``bytes`` in bytes. Must be `BIP38_SERIALIZED_LEN`. :param pass: Password for the encoded private key. :param pass_len: Length of ``pass`` in bytes. :param flags: :ref:`bip38-flags` indicating desired behavior. :param bytes_out: Destination for the resulting private key. :param len: Size of ``bytes_out``. Must be `EC_PRIVATE_KEY_LEN`. :return: See :ref:`error-codes` .. c:function:: int bip38_to_private_key(const char *bip38, const unsigned char *pass, size_t pass_len, uint32_t flags, unsigned char *bytes_out, size_t len) Decode a BIP 38 address to a private key. :param bip38: BIP 38 address to decode. :param pass: Password for the encoded private key. :param pass_len: Length of ``pass`` in bytes. :param flags: :ref:`bip38-flags` indicating desired behavior. :param bytes_out: Destination for the resulting private key. :param len: Size of ``bytes_out``. Must be `EC_PRIVATE_KEY_LEN`. :return: See :ref:`error-codes` .. c:function:: int bip38_raw_get_flags(const unsigned char *bytes, size_t bytes_len, size_t *written) Get compression and/or EC mult flags. :param bytes: Raw BIP 38 address to get the flags from. :param bytes_len: Size of ``bytes`` in bytes. Must be `BIP38_SERIALIZED_LEN`. :param written: :ref:`bip38-flags` indicating behavior. :return: See :ref:`error-codes` .. c:function:: int bip38_get_flags(const char *bip38, size_t *written) Get compression and/or EC mult flags. :param bip38: BIP 38 address to get the flags from. :param written: :ref:`bip38-flags` indicating behavior. :return: See :ref:`error-codes` Bip38 Constants --------------- .. _bip38-flags: BIP38 conversion flags ^^^^^^^^^^^^^^^^^^^^^^ .. c:macro:: BIP38_KEY_NETWORK_MASK Mask for the bottom 8 bitflags which hold the network .. c:macro:: BIP38_KEY_MAINNET Address is for main network .. c:macro:: BIP38_KEY_TESTNET Address is for test network .. c:macro:: BIP38_KEY_COMPRESSED Public key is compressed .. c:macro:: BIP38_KEY_EC_MULT EC-Multiplied key (FIXME: Not implemented) .. c:macro:: BIP38_KEY_QUICK_CHECK Check structure only (no password required) .. c:macro:: BIP38_KEY_RAW_MODE Treat bytes in as raw data .. c:macro:: BIP38_KEY_SWAP_ORDER Hash comes after encrypted key .. c:macro:: BIP38_SERIALIZED_LEN Length of a raw BIP38 key in bytes