You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Poly1305 / ChaCha20Poly1305 throw "full width integer not supported" on web (dart2js) in 4.0.0 #265
Poly1305 — and therefore ChaCha20Poly1305 — cannot be used when compiled to JavaScript. The constructors call Platform.instance.assertFullWidthInteger() (lib/macs/poly1305.dart, lines 20 and 25 in 4.0.0), which throws full width integer not supported on this platform on dart2js.
This was raised in comments on #126 (2022, 2023). That issue was about Argon2, which has since gained a Register64-based implementation for the web, but Poly1305 still has the guard, so I'm opening a focused issue with a current reproduction.
dart2js (dart compile js then run in node with globalThis.self = globalThis; same result in Chrome via dart test -p chrome):
Poly1305(): full width integer not supported on this platform
ChaCha20Poly1305: full width integer not supported on this platform
Expected
Either a web-compatible Poly1305, as was done for Argon2 (Poly1305 only needs 26-bit limbs × 32-bit multiplies, as in the poly1305-donna 32-bit variant, so it fits within JS integer precision), or documentation that Poly1305 / ChaCha20Poly1305 are VM-only.
Context
Found while adding ChaCha20-Poly1305 support to a library that targets the VM, dart2js and dart2wasm. dart2wasm is unaffected (it has 64-bit integers); only dart2js fails.
Activity