This scratch project experimentally implements X25519 scalar multiplication, as defined in https://datatracker.ietf.org/doc/html/rfc7748 It takes about 250 milliseconds to compute in scratch-vm in Chrome, and ~10ms to compute in TurboWarp. Try out the test vectors from the RFC, you should get the same results. I can't really make any guarantees that this is actually secure (particularly with regards to timing sidechannels), but it does appear to work correctly. This code is moderately optimised. There's definitely room for a few % more perf, but nothing too groundbreaking.
As far as I know, this is the strongest usably-fast implementation of public key cryptography in Scratch. This implementation uses a 12-element list of Scratch's double-precision floating-point variables to represent a single 255-bit integer, using radix 21.25. This technique is the same approach to the one outlined in DJB's https://cr.yp.to/ecdh/curve25519-20060209.pdf