findGroupHash<T extends JubJubScalar<T> , E extends BaseJubJubPoint<T, E> > static method
E
findGroupHash<T extends JubJubScalar<T> , E extends BaseJubJubPoint<T, E> >({})
Implementation
static E
findGroupHash<T extends JubJubScalar<T>, E extends BaseJubJubPoint<T, E>>({
required List<int> message,
required List<int> personalization,
required E Function(List<int> bytes) fromBytes,
}) {
if (personalization.length != 8) {
throw ArgumentException.invalidOperationArguments(
"findGroupHash",
reason: 'Invalid personalization bytes length.',
);
}
final tag = List<int>.from(message);
final i = tag.length;
tag.add(0);
while (true) {
final gh = SaplingKeyUtils.groupHash<T, E>(
tag: tag,
personalization: personalization,
fromBytes: fromBytes,
);
if (tag[i] == BinaryOps.mask8) {
throw PedersenHashException.failed(
"findGroupHash",
reason: "tag counter overflow.",
);
}
tag[i]++;
if (gh != null) {
return gh;
}
}
}