ckdPriv function

Keys ckdPriv(
  1. Keys keys,
  2. int index
)

Implementation

Keys ckdPriv(Keys keys, int index) {
  final buffer = Uint8List(4);
  ByteData.sublistView(buffer).setUint32(0, index);
  final indexBytes = buffer;
  final zero = Uint8List.fromList([0]);
  final data = <int>[];
  data.addAll(zero);
  data.addAll(keys.key!);
  data.addAll(indexBytes);
  final I = hmacSha512(keys.chainCode!, Uint8List.fromList(data));
  final IL = I.sublist(0, 32);
  final IR = I.sublist(32);
  return Keys(key: IL, chainCode: IR);
}