-
-
Save emilbayes/f93cc288cca2458f76708874c6b1701f to your computer and use it in GitHub Desktop.
Browserify Buffer bug?
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
$ browserify bug.js | browser-run | |
in U3iVZVfIGlCmd9SXTxb3YIclM2+vpRr+zUm2AbKrsT/p45H+hkFfB5SRX9cbLFso17Z5YsfonOPnf0xtuP/aPA== | |
out U3jvv71lV++/vRpQ77+9d9SXTxbvv71g77+9JTNv77+977+9Gu+/ve+/vUnvv70B77+977+977+9P++/ve+/vQ== |
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
var TAG_LENGTH = 8 | |
var buf = Buffer.from('U3iVZVfIGlCmd9SXTxb3YIclM2+vpRr+zUm2AbKrsT/p45H+hkFfB5SRX9cbLFso17Z5YsfonOPnf0xtuP/aPA==.ed25519') | |
console.log('from', buf.slice(0, buf.length - TAG_LENGTH).toString()) | |
// Not being able to read part of the buffer in a specific encoding is weird | |
var secretKey = Buffer.alloc(64, buf.slice(0, buf.length - TAG_LENGTH).toString(), 'base64') | |
console.log('sk', secretKey.toString('base64')) |
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
$ node bug.js | |
in U3iVZVfIGlCmd9SXTxb3YIclM2+vpRr+zUm2AbKrsT/p45H+hkFfB5SRX9cbLFso17Z5YsfonOPnf0xtuP/aPA== | |
out U3iVZVfIGlCmd9SXTxb3YIclM2+vpRr+zUm2AbKrsT/p45H+hkFfB5SRX9cbLFso17Z5YsfonOPnf0xtuP/aPA== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment