poseidonBn254Hash method

  1. @override
BuBytes poseidonBn254Hash(
  1. List<int> inputs
)
override

circomlib-compatible Poseidon over BN254 Fr (Sui zkLogin / Aptos keyless). inputs is concatenated 32-byte LE Fr elements (1..64); returns the 32-byte LE digest. Native backends built without the Rust poseidon-bn254 feature throw unsupported.

Implementation

@override
BuBytes poseidonBn254Hash(List<int> inputs) {
  if (inputs.length % 32 != 0 || inputs.isEmpty || inputs.length > 64 * 32) {
    throw CoreErrors.cryptoFailed(
      'poseidonBn254Hash',
      reason: 'inputs must be 1..64 concatenated 32-byte LE Fr elements',
    );
  }
  final n = inputs.length ~/ 32;
  final parts = List<BuBytes>.generate(
    n,
    (i) => inputs.sublist(i * 32, (i + 1) * 32).asBytes,
  );
  return api.poseidonBn254Hash(inputs: parts).unwrapOrThrowCryptoError();
}