cc-mek-scada/lockbox/padding/pkcs7.lua

19 lines
396 B
Lua
Raw Normal View History

2022-05-29 19:05:57 +00:00
local PKCS7Padding = function(blockSize, byteCount)
local paddingCount = blockSize - ((byteCount -1) % blockSize) + 1;
local bytesLeft = paddingCount;
local stream = function()
if bytesLeft > 0 then
bytesLeft = bytesLeft - 1;
return paddingCount;
else
return nil;
end
end
return stream;
end
return PKCS7Padding;