Skip to content
New issue

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

reset IV method #28

Open
moteus opened this issue Apr 25, 2013 · 0 comments
Open

reset IV method #28

moteus opened this issue Apr 25, 2013 · 0 comments

Comments

@moteus
Copy link
Contributor

moteus commented Apr 25, 2013

Now we can not effective implement CTR algorithm with custom counter.
But if we implement resetiv method then we can write:

local aes = crypto.encrypt.new('aes-256-ctr', KEY)
local IV = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
for b, e in ichunks(msg, block_size) do
  inc_iv(IV)
  aes:resetiv(IV)
  local chunk = string.sub(msg, b, e)
  chunk = aes:update(chunk) -- or even better aes:update(msg, b, e) 
end

I realy do not know is this valid in OpenSSL update iv, but it work.
in my test this method 10 times slower then simple aes-256-crt.
this my implementation moteus-iv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant