I'm not programmer, but how about SHA-256 library which use WebAssembly such as
https://github.com/Daninet/hash-wasm? Although i don't know whether such library would work on all browser or CPU.
So basically everything made in the last decade should work fine.
I see, i must've missed that earlier.
WebAssembly doesn't have to worry about supporting x86 or ARM architectures itself, the browser implementations take care of that.
I'd say this is even better than my suggestion to use a different language. I mean, this is literally assembly language after all, it just runs on the browser's engine instead of on an OS.
Weird it doesn't have to worry about CPU architecture, even though the name contain word assembly. Anyway, that means it should fulfill OP needs.