From 1de5f9ac6f038bfed2230cc1272b253794b2f41a Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 10 Jul 2016 17:04:29 -0400 Subject: Initial commit --- gamemode/shared/lockbox/padding.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gamemode/shared/lockbox/padding.lua (limited to 'gamemode/shared/lockbox/padding.lua') diff --git a/gamemode/shared/lockbox/padding.lua b/gamemode/shared/lockbox/padding.lua new file mode 100644 index 0000000..72be077 --- /dev/null +++ b/gamemode/shared/lockbox/padding.lua @@ -0,0 +1,21 @@ +local Stream = include("stream.lua"); + +local ZeroPadding = function(blockSize,byteCount) + + local paddingCount = blockSize - ((byteCount -1) % blockSize) + 1; + local bytesLeft = paddingCount; + + local stream = function() + if bytesLeft > 0 then + bytesLeft = bytesLeft - 1; + return 0x00; + else + return nil; + end + end + + return stream; + +end + +return ZeroPadding; -- cgit v1.2.3-70-g09d2