Open ccxhwmy opened 2 years ago
nope, the initial counter value is specified in this way:
local resty_aes = require("resty.aes")
local counter = "a 16-chars string"
-- an example: counter = hex2bin("00000000000000000000000000000001") means initial_value=1
-- note: length of counter is fixed as 128bits
local aes, err = resty_aes:new(
key, -- key
nil, -- salt
resty_aes.cipher(192, "ctr"), -- cipher mode
{iv=counter}, -- hash or options
nil, -- hash rounds
nil, -- iv len
false -- enable padding
)
Hi~ I am reading python code about
Crypto.Cipher
in website: https://www.pycryptodome.org/src/cipher/classic#ctr-mode I found thenew
function defined toCrypto.Cipher.<algorithm>.new(key, mode, *, nonce=None, initial_value=None, counter=None)
Is theinitial_value
means thesalt
in : https://github.com/openresty/lua-resty-string/blob/78e5020229718c557484191c891a68097907d818/lib/resty/aes.lua#L120Thank you~