We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The IV should be random and unique for every run of your encryption method. so best to provide a method to generate IV. maybe anther method to generate Key.
The text was updated successfully, but these errors were encountered:
Here you go: 256 key and 128 iv
function getRandomKey(): Uint8Array { return getRandomBlock(32); } function getIV(): Uint8Array { return getRandomBlock(16); } function getRandomBlock(size: number): Uint8Array { const block: number[] = []; for (let i = 0; i < size; i++) { block.push(Math.floor(Math.random() * 256)); } return new Uint8Array(block); }
Sorry, something went wrong.
Thanks @webdevelopland! Here's the JS equivalent for those who need it:
function getRandomKey() { return getRandomBlock(32); } function getRandomIV() { return getRandomBlock(16); } function getRandomBlock(size) { const block = []; for (let i = 0; i < size; i++) { block.push(Math.floor(Math.random() * 256)); } return new Uint8Array(block); }
No branches or pull requests
The IV should be random and unique for every run of your encryption method.
so best to provide a method to generate IV.
maybe anther method to generate Key.
The text was updated successfully, but these errors were encountered: