Skip to content

Drop crypto dependency and use libcrypto#17

Open
jnordberg wants to merge 4 commits intomasterfrom
only-libcrypto
Open

Drop crypto dependency and use libcrypto#17
jnordberg wants to merge 4 commits intomasterfrom
only-libcrypto

Conversation

@jnordberg
Copy link
Contributor

Closes #9

@jnordberg jnordberg added the WIP label Jan 25, 2018
@jnordberg jnordberg requested a review from goldibex January 25, 2018 11:49
second.update(sjcl.codec.arrayBuffer.toBits(nonce.buffer))

return second.digest()
return Buffer.from(sjcl.codec.arrayBuffer.fromBits(second.finalize()))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goldibex I'm having trouble producing the same hashes as before, narrowed it down to the second hash differing. I'm using the undocumented sjcl toBits method (in their latest online docs anyways, our vendored version maybe differs?) as you are doing in libcrypto. Any ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, apparently node Buffer instances can share memory so you need to copy out the parts needed from the underlying ArrayBuffer. Fixed with latest commit

@jnordberg jnordberg changed the title Only libcrypto Drop crypto dependency and use libcrypto Jan 25, 2018
@jnordberg
Copy link
Contributor Author

This is blocked by a secure replacement for crypto.randomBytes

steemit/libcrypto-js#17

@smoke-indica
Copy link

@jnordberg Hey, can we use https://github.com/crypto-browserify/randombytes to replace crypto.randomBytes ?

Seems millions of people use it so it should be a suitable drop in replacement.

@jnordberg
Copy link
Contributor Author

That should work yeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove crypto and replace with libcrypto primitives

2 participants