init commit

This commit is contained in:
2025-10-09 09:57:24 +09:00
commit 4d551bd74f
6636 changed files with 1218703 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using Org.BouncyCastle.Security;
namespace Org.BouncyCastle.Crypto.Paddings;
public class TbcPadding : IBlockCipherPadding
{
public string PaddingName => "TBC";
public virtual void Init(SecureRandom random)
{
}
public virtual int AddPadding(byte[] input, int inOff)
{
int result = input.Length - inOff;
byte b = ((inOff <= 0) ? ((byte)(((input[^1] & 1) == 0) ? 255u : 0u)) : ((byte)(((input[inOff - 1] & 1) == 0) ? 255u : 0u)));
while (inOff < input.Length)
{
input[inOff] = b;
inOff++;
}
return result;
}
public virtual int PadCount(byte[] input)
{
byte b = input[^1];
int num = input.Length - 1;
while (num > 0 && input[num - 1] == b)
{
num--;
}
return input.Length - num;
}
}