top | item 23524662

Stanford JavaScript Crypto Library

78 points| memexy | 5 years ago |bitwiseshiftleft.github.io | reply

29 comments

order
[+] buu700|5 years ago|reply
I would personally recommend libsodium.js as the default choice for a JS crypto library: https://github.com/jedisct1/libsodium.js

Fundamental issues with JS/web crypto aside, that is. You would still need something like WebSign (https://www.cyph.com/websign) or a framework like Electron that allows shipping your application outside of the browser.

[+] BiteCode_dev|5 years ago|reply
SJCL is 6.4KB gzipped, libsodium is 188KB.

If one plans to use the lib in the browser, it makes a huge difference.

Also, I'm not a crypto expert by any mean, but SJCL seems higher level, and hence, easier to use. Not to mention harder to missuse.

Projects like https://0bin.net have been using it for 7 years, with 500000 visitors in the last few months, so I'd say it's pretty battle tested too.

Not nearly has much as libsodium, of course. But I wouldn't discard SJCL, I think it has a place.

[+] traceroute66|5 years ago|reply
Agree on the libsodium recommendation. Stanford probably just suffering a little "not invented here" syndrome.

Libsodium is a solid crypto library with long history. It is also embedded in PHP,HHVM,Citrine and Factor "out of the box" and has bindings for many other languages, not just Javascript.

In my view, any competing crypto library would have to be something super special to outweigh all the pros of libsodium.

[+] arvinsim|5 years ago|reply
Hmm I am currently testing out node-forge for encrypting/decrypting AES-256.

Would you say that libsodium.js is better?

[+] kyledrake|5 years ago|reply
Having used SJCL before, I'll just say that it's quite old, and I'm not sure how well maintained it is at this point. It also is likely not using any of the new crypto browser APIs which can speed things up like pbkdf2 a ton. Recommend using something more modern and "on the rails" like libsodium if you have a choice.
[+] carterklein13|5 years ago|reply
Does this add anything that many of the more popular and widely-used crypto libraries offer? I haven't been able to find anything, but am always curious to try new tools.
[+] avmich|5 years ago|reply
What would those many libraries offer, deserving switching from SJCL? I particularly like the size of the library; having said that, there could be some more important features.
[+] memexy|5 years ago|reply
Found it while looking at TiddlyWiki developer documentation. This is used to make encrypted wiki pages that are decrypted on the client.
[+] dchest|5 years ago|reply
Don’t use it, just use WebCrypto API.
[+] BiteCode_dev|5 years ago|reply
It's way lower level, and easier to missuse.
[+] d0m|5 years ago|reply
not available in all js runtime
[+] hasa|5 years ago|reply
I'm thinking this from the security point of view. Unless you bring the crypto operations outside the battlefield of JS runtime, any js library is basically unsecure.
[+] mikece|5 years ago|reply
Why not just a C or C++ crypto library compiled to WASM?