本文整理匯總了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);
}
}