forked from sshnet/SSH.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCipherPadding.cs
More file actions
65 lines (61 loc) · 2.59 KB
/
CipherPadding.cs
File metadata and controls
65 lines (61 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
namespace Renci.SshNet.Security.Cryptography.Ciphers
{
/// <summary>
/// Base class for cipher padding implementations.
/// </summary>
public abstract class CipherPadding
{
/// <summary>
/// Pads the specified input to match the block size.
/// </summary>
/// <param name="blockSize">Size of the block.</param>
/// <param name="input">The input.</param>
/// <returns>
/// Padded data array.
/// </returns>
public byte[] Pad(int blockSize, byte[] input)
{
return Pad(blockSize, input, 0, input.Length);
}
/// <summary>
/// Pads the specified input to match the block size.
/// </summary>
/// <param name="blockSize">Size of the block.</param>
/// <param name="input">The input.</param>
/// <param name="offset">The zero-based offset in <paramref name="input"/> at which the data to pad starts.</param>
/// <param name="length">The number of bytes in <paramref name="input"/> to take into account.</param>
/// <returns>
/// The padded data array.
/// </returns>
public abstract byte[] Pad(int blockSize, byte[] input, int offset, int length);
/// <summary>
/// Pads the specified input with a given number of bytes.
/// </summary>
/// <param name="input">The input.</param>
/// <param name="paddinglength">The number of bytes to pad the input with.</param>
/// <returns>
/// The padded data array.
/// </returns>
public byte[] Pad(byte[] input, int paddinglength)
{
return Pad(input, 0, input.Length, paddinglength);
}
/// <summary>
/// Pads the specified input with a given number of bytes.
/// </summary>
/// <param name="input">The input.</param>
/// <param name="offset">The zero-based offset in <paramref name="input"/> at which the data to pad starts.</param>
/// <param name="length">The number of bytes in <paramref name="input"/> to take into account.</param>
/// <param name="paddinglength">The number of bytes to pad the input with.</param>
/// <returns>
/// The padded data array.
/// </returns>
public abstract byte[] Pad(byte[] input, int offset, int length, int paddinglength);
/// <summary>
/// Gets the padd count from the specified input.
/// </summary>
/// <param name="input">The input.</param>
/// <returns>The padd count.</returns>
public abstract int PadCount(byte[] input);
}
}