From e03df47185bf3fab1a3a448031b575c34f66a860 Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Wed, 29 Nov 2017 19:05:00 +0100 Subject: [PATCH] Add option to specify iv, fixes #4 --- src/aeslua/ciphermode.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/aeslua/ciphermode.lua b/src/aeslua/ciphermode.lua index ab1faf1..b247f36 100644 --- a/src/aeslua/ciphermode.lua +++ b/src/aeslua/ciphermode.lua @@ -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(); @@ -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;