3 ms·
Hi there! I think JavaScript is a great way to teach, since it's such an accessible language. It also allows you to ship your code to run easily for your users.
by simpaticoder 3y ago
Hi there! I think JavaScript is a great way to teach, since it's such an accessible language. It also allows you to ship your code to run easily for your users.
The OP's code needed a little help; there were some missing functions, misnamed calls, and he didn't use js BigInts (which are built-in to the browser, and you can use them as literals by appending 'n' to a number.)
See (and run) the fixed up code here: https://simpatico.io/crypto.md#rsafromscratch https://simpatico.io/crypto.md#rsafromscratch
EDIT: for my own crypto needs in the browser I use `subtle.crypto` with ECDH - https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93...
- zelphirkalt 3y agoI think many people here object to the statement, that using JS is a good way of teaching, since there are many people here with in-depth knowledge about programming language theory and knowledge about the far too many bad parts of JS. I myself would recommend conceptually richer and yet syntactically simpler languages than JS or Python, with the note, that it depends on what you want to learn. If you want to learn to make a website with dynamic features, sure, learn some JS. If you want to learn computer programming and grasp important concepts well, you are better off learning other languages.
- simpaticoder 3y agoPeople have strong preferences in this area, as to be expected. After all, good programming pedagogy itself is weakened because it is, by nature, partitioned by language (and often further, by framework). I prefer to zoom out and realize that everyone wants all tutorials to be written in their favorite language, and realizing this makes me a little less attached to mine, and more accepting of others, even if they are not for me.
- zelphirkalt 3y agoThis is true, but it is also true, that some concepts cannot be taught well in languages, that do not support them well and will get the wrong message to the learner. Many learn, that recursion is something dangerous for example, because their learning vehicle language has no good implementation for it. Another example is memory allocation. You wouldn't teach that in Python probably. Or a concept like ownership, which would be good to teach in Rust, where the language has that concept explicitly and visibly built into it.