View Source BitcoinLib.Key.HD.Hmac (BitcoinLib v0.4.3)

Computes HMAC on either a public or a private key in the aim of computing a child key

Link to this section Summary

Functions

Computes HMAC on either a public or a private key in the aim of computing a child key

Link to this section Functions

Link to this function

compute(private_key, index, hardened? \\ false)

View Source
@spec compute(
  %BitcoinLib.Key.PrivateKey{
    chain_code: term(),
    depth: term(),
    fingerprint: term(),
    index: term(),
    key: term(),
    parent_fingerprint: term()
  }
  | %BitcoinLib.Key.PublicKey{
      chain_code: term(),
      depth: term(),
      fingerprint: term(),
      index: term(),
      key: term(),
      parent_fingerprint: term(),
      uncompressed_key: term()
    },
  integer(),
  boolean()
) :: {bitstring(), bitstring()}

Computes HMAC on either a public or a private key in the aim of computing a child key

examples

Examples

iex> %BitcoinLib.Key.PrivateKey {
...>   key: <<0xE8F32E723DECF4051AEFAC8E2C93C9C5B214313817CDB01A1494B917C8436B35::256>>,
...>   chain_code: <<0x873DFF81C02F525623FD1FE5167EAC3A55A049DE3D314BB42EE227FFED37D508::256>>
...> }
...> |> BitcoinLib.Key.HD.Hmac.compute(0)
{
  <<0x6539AE80B3618C22F5F8CC4171D04835570BDA8DB11B5BF1779AFAE7EC7C79C3::256>>,
  <<0xD323F1BE5AF39A2D2F08F5E8F664633849653DBE329802E9847CFC85F8D7B52A::256>>
}