Skip to content

Commit

Permalink
Add option to specify iv, fixes bighil#4
Browse files Browse the repository at this point in the history
  • Loading branch information
TobleMiner committed Nov 29, 2017
1 parent c8c6c56 commit e03df47
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/aeslua/ciphermode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ aeslua.ciphermode = public;
-- key - byte array with key
-- string - string to encrypt
-- modefunction - function for cipher mode to use
-- iv - initialization vector to use
--
function public.encryptString(key, data, modeFunction)
function public.encryptString(key, data, modeFunction, iv)
local iv = iv or {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
local keySched = aes.expandEncryptionKey(key);
local encryptedData = buffer.new();
Expand Down Expand Up @@ -71,8 +72,9 @@ end
-- key - byte array with key
-- string - string to decrypt
-- modefunction - function for cipher mode to use
-- iv - initialization vector to use
--
function public.decryptString(key, data, modeFunction)
function public.decryptString(key, data, modeFunction, iv)
local iv = iv or {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

local keySched;
Expand Down

0 comments on commit e03df47

Please sign in to comment.