Bip38 Functions

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.

Parameters:
  • bytes – Private key to use.
  • bytes_len – Size of bytes in bytes. Must be EC_PRIVATE_KEY_LEN.
  • pass – Password for the encoded private key.
  • pass_len – Length of pass in bytes.
  • flagsBIP38_KEY_ flags indicating desired behavior.
  • bytes_out – Destination for the resulting raw BIP38 address.
  • len – Size of bytes_out in bytes. Must be BIP38_SERIALIZED_LEN.
Returns:

See Error Codes

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.

Parameters:
  • bytes – Private key to use.
  • bytes_len – Size of bytes in bytes. Must be EC_PRIVATE_KEY_LEN.
  • pass – Password for the encoded private key.
  • pass_len – Length of pass in bytes.
  • flagsBIP38_KEY_ flags indicating desired behavior.
  • output – Destination for the resulting BIP38 address.
Returns:

See Error Codes

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.

Parameters:
  • bytes – Raw BIP 38 address to decode.
  • bytes_len – Size of bytes in bytes. Must be BIP38_SERIALIZED_LEN.
  • pass – Password for the encoded private key.
  • pass_len – Length of pass in bytes.
  • flagsBIP38_KEY_ flags indicating desired behavior.
  • bytes_out – Destination for the resulting private key.
  • len – Size of bytes_out in bytes. Must be EC_PRIVATE_KEY_LEN.
Returns:

See Error Codes

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.

Parameters:
  • bip38 – BIP 38 address to decode.
  • pass – Password for the encoded private key.
  • pass_len – Length of pass in bytes.
  • flagsBIP38_KEY_ flags indicating desired behavior.
  • bytes_out – Destination for the resulting private key.
  • len – Size of bytes_out in bytes. Must be EC_PRIVATE_KEY_LEN.
Returns:

See Error Codes

int bip38_raw_get_flags(const unsigned char *bytes, size_t bytes_len, size_t *written)

Get compression and/or EC mult flags.

Parameters:
  • bytes – Raw BIP 38 address to get the flags from.
  • bytes_len – Size of bytes in bytes. Must be BIP38_SERIALIZED_LEN.
  • writtenBIP38_KEY_ flags indicating behavior.
Returns:

See Error Codes

int bip38_get_flags(const char *bip38, size_t *written)

Get compression and/or EC mult flags.

Parameters:
  • bip38 – BIP 38 address to get the flags from.
  • writtenBIP38_KEY_ flags indicating behavior.
Returns:

See Error Codes