本文整理汇总了C#中Tamir.SharpSsh.jsch.Packet.padding方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.padding方法的具体用法?C# Packet.padding怎么用?C# Packet.padding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tamir.SharpSsh.jsch.Packet
的用法示例。
在下文中一共展示了Packet.padding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: encode
// encode will bin invoked in write with synchronization.
public void encode(Packet packet)
{
//System.Console.WriteLine("encode: "+packet.buffer.buffer[5]);
//System.Console.WriteLine(" "+packet.buffer.index);
//if(packet.buffer.buffer[5]==96){
//Thread.dumpStack();
//}
if(deflater!=null)
{
packet.buffer.index=deflater.compress(packet.buffer.buffer,
5, packet.buffer.index);
}
if(c2scipher!=null)
{
packet.padding(c2scipher.getIVSize());
int pad=packet.buffer.buffer[4];
lock(random)
{
random.fill(packet.buffer.buffer, packet.buffer.index-pad, pad);
}
}
else
{
packet.padding(8);
}
byte[] mac=null;
if(c2smac!=null)
{
c2smac.update(seqo);
c2smac.update(packet.buffer.buffer, 0, packet.buffer.index);
mac=c2smac.doFinal();
}
if(c2scipher!=null)
{
byte[] buf=packet.buffer.buffer;
c2scipher.update(buf, 0, packet.buffer.index, buf, 0);
}
if(mac!=null)
{
packet.buffer.putByte(mac);
}
}
示例2: encode
// encode will bin invoked in write with synchronization.
public void encode(Packet packet)
{
if (deflater != null)
{
packet.buffer.index = deflater.compress(packet.buffer.buffer,
5, packet.buffer.index);
}
if (c2scipher != null)
{
packet.padding(c2scipher.getIVSize());
int pad = packet.buffer.buffer[4];
lock (random)
{
random.fill(packet.buffer.buffer, packet.buffer.index - pad, pad);
}
}
else
{
packet.padding(8);
}
byte[] mac = null;
if (c2smac != null)
{
c2smac.update(seqo);
c2smac.update(packet.buffer.buffer, 0, packet.buffer.index);
mac = c2smac.doFinal();
}
if (c2scipher != null)
{
byte[] buf = packet.buffer.buffer;
c2scipher.update(buf, 0, packet.buffer.index, buf, 0);
}
if (mac != null)
{
packet.buffer.putByte(mac);
}
}