npm install
npm run build | wc
# => 24 1092 36499 == 36KB
npm run build-nacl | wc
# => 5 225 28459 == 28KB
Created
April 23, 2024 16:08
-
-
Save paulmillr/f655a39d7144481e1bc0a374fb65689d to your computer and use it in GitHub Desktop.
noble vs tweetnacl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export { box_keyPair, sign_detached_verify, sign, box, box_open } from 'tweetnacl-ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export { xchacha20poly1305 } from '@noble/ciphers/chacha'; | |
export { concatBytes } from '@noble/ciphers/utils'; | |
export { ed25519 } from '@noble/curves/ed25519'; | |
export { hkdf } from '@noble/hashes/hkdf'; | |
export { sha512 } from '@noble/hashes/sha512'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "nacl", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"build": "npx esbuild --bundle inp.mjs --minify", | |
"build-nacl": "npx esbuild --bundle inp-nacl.mjs --minify" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"@noble/ciphers": "0.5.2", | |
"@noble/curves": "1.4.0", | |
"@noble/hashes": "1.4.0", | |
"tweetnacl": "1.0.3" | |
}, | |
"devDependencies": { | |
"esbuild": "0.20.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a ton - your answers really help.
I'm really thinking high-level here and can't get why you say I can't do it. encryption / decryption and signing / verifying are 2 different tasks in my system, same as exposed in nacl api. I don't need a shared private key between these 2 tasks. I use this approach to give you a bit more of context:
And the question really is: I don't care about what to use, I just need the simplest and the most tiny crypto primitives to do sign+verify and asymmetric encrypt/decrypt as separate tasks. nacl has everything I need: and I'm unsure what minimal set of primitives I need to take from noble to make it happen.