Skip to content
Advertisement

XOR with crypto’s randomBytes

I want to create a master key where I XOR 3 random keys (generated with crypto.randomBytes).

JavaScript

I am not sure how to make this work in Javascript. randomBytes returns a Buffer. I’m not sure if I have to do a .toString() on it or just perform the XOR as a Buffer?

Advertisement

Answer

This should do:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement