View Source BitcoinLib.Key.HD.Fingerprint (BitcoinLib v0.4.1)

A fingerprint is a small hash of a public key

Link to this section Summary

Functions

Adds a fingerprint to a public key

Compute a private key's fingerprint

Link to this section Functions

@spec append(%BitcoinLib.Key.PrivateKey{
  chain_code: term(),
  depth: term(),
  fingerprint: term(),
  index: term(),
  key: term(),
  parent_fingerprint: term()
}) :: %BitcoinLib.Key.PrivateKey{
  chain_code: term(),
  depth: term(),
  fingerprint: term(),
  index: term(),
  key: term(),
  parent_fingerprint: term()
}
@spec append(%BitcoinLib.Key.PublicKey{
  chain_code: term(),
  depth: term(),
  fingerprint: term(),
  index: term(),
  key: term(),
  parent_fingerprint: term(),
  uncompressed_key: term()
}) :: %BitcoinLib.Key.PublicKey{
  chain_code: term(),
  depth: term(),
  fingerprint: term(),
  index: term(),
  key: term(),
  parent_fingerprint: term(),
  uncompressed_key: term()
}

Adds a fingerprint to a public key

examples

Examples

iex> %BitcoinLib.Key.PrivateKey {
...>   key: <<0xE8F32E723DECF4051AEFAC8E2C93C9C5B214313817CDB01A1494B917C8436B35::256>>,
...>   chain_code: <<0x873DFF81C02F525623FD1FE5167EAC3A55A049DE3D314BB42EE227FFED37D508::256>>
...> }
...> |> BitcoinLib.Key.HD.Fingerprint.append()
%BitcoinLib.Key.PrivateKey {
  fingerprint: <<0x3442193E::32>>,
  key: <<0xE8F32E723DECF4051AEFAC8E2C93C9C5B214313817CDB01A1494B917C8436B35::256>>,
  chain_code: <<0x873DFF81C02F525623FD1FE5167EAC3A55A049DE3D314BB42EE227FFED37D508::256>>
}

iex> %BitcoinLib.Key.PublicKey{
...>   key: <<0x252C616D91A2488C1FD1F0F172E98F7D1F6E51F8F389B2F8D632A8B490D5F6DA9::264>>,
...>   chain_code: <<0x463223AAC10FB13F291A1BC76BC26003D98DA661CB76DF61E750C139826DEA8B::256>>
...> }
...> |> BitcoinLib.Key.HD.Fingerprint.append()
%BitcoinLib.Key.PublicKey{
  fingerprint: <<0x18C1259::32>>,
  key: <<0x252C616D91A2488C1FD1F0F172E98F7D1F6E51F8F389B2F8D632A8B490D5F6DA9::264>>,
  chain_code: <<0x463223AAC10FB13F291A1BC76BC26003D98DA661CB76DF61E750C139826DEA8B::256>>
}
@spec compute(%BitcoinLib.Key.PrivateKey{
  chain_code: term(),
  depth: term(),
  fingerprint: term(),
  index: term(),
  key: term(),
  parent_fingerprint: term()
}) :: binary()
@spec compute(%BitcoinLib.Key.PublicKey{
  chain_code: term(),
  depth: term(),
  fingerprint: term(),
  index: term(),
  key: term(),
  parent_fingerprint: term(),
  uncompressed_key: term()
}) :: binary()

Compute a private key's fingerprint

examples

Examples

iex> %BitcoinLib.Key.PrivateKey {
...>   key: <<0xE8F32E723DECF4051AEFAC8E2C93C9C5B214313817CDB01A1494B917C8436B35::256>>,
...>   chain_code: <<0x873DFF81C02F525623FD1FE5167EAC3A55A049DE3D314BB42EE227FFED37D508::256>>
...> }
...> |> BitcoinLib.Key.HD.Fingerprint.compute()
<<0x3442193E::32>>

iex> %BitcoinLib.Key.PublicKey{
...>   key: <<0x252C616D91A2488C1FD1F0F172E98F7D1F6E51F8F389B2F8D632A8B490D5F6DA9::264>>,
...>   chain_code: <<0x463223AAC10FB13F291A1BC76BC26003D98DA661CB76DF61E750C139826DEA8B::256>>
...> }
...> |> BitcoinLib.Key.HD.Fingerprint.compute()
<<0x18C1259::32>>