@@ -345,14 +345,17 @@ protected void SendMessage(Message message)
345345 private byte [ ] GenerateSessionKey ( byte [ ] sharedKey , byte [ ] exchangeHash , byte [ ] key , int size )
346346 {
347347 var result = new List < byte > ( key ) ;
348+
348349 while ( size > result . Count )
349350 {
350- result . AddRange ( Hash ( new _SessionKeyAdjustment
351- {
352- SharedKey = sharedKey ,
353- ExchangeHash = exchangeHash ,
354- Key = key ,
355- } . GetBytes ( ) ) ) ;
351+ var sessionKeyAdjustment = new SessionKeyAdjustment
352+ {
353+ SharedKey = sharedKey ,
354+ ExchangeHash = exchangeHash ,
355+ Key = key ,
356+ } ;
357+
358+ result . AddRange ( Hash ( sessionKeyAdjustment . GetBytes ( ) ) ) ;
356359 }
357360
358361 return result . ToArray ( ) ;
@@ -368,7 +371,7 @@ private byte[] GenerateSessionKey(byte[] sharedKey, byte[] exchangeHash, byte[]
368371 /// <returns></returns>
369372 private static byte [ ] GenerateSessionKey ( byte [ ] sharedKey , byte [ ] exchangeHash , char p , byte [ ] sessionId )
370373 {
371- var sessionKeyGeneration = new _SessionKeyGeneration
374+ var sessionKeyGeneration = new SessionKeyGeneration
372375 {
373376 SharedKey = sharedKey ,
374377 ExchangeHash = exchangeHash ,
@@ -378,11 +381,14 @@ private static byte[] GenerateSessionKey(byte[] sharedKey, byte[] exchangeHash,
378381 return sessionKeyGeneration . GetBytes ( ) ;
379382 }
380383
381- private class _SessionKeyGeneration : SshData
384+ private class SessionKeyGeneration : SshData
382385 {
383386 public byte [ ] SharedKey { get ; set ; }
387+
384388 public byte [ ] ExchangeHash { get ; set ; }
389+
385390 public char Char { get ; set ; }
391+
386392 public byte [ ] SessionId { get ; set ; }
387393
388394 /// <summary>
@@ -419,10 +425,12 @@ protected override void SaveData()
419425 }
420426 }
421427
422- private class _SessionKeyAdjustment : SshData
428+ private class SessionKeyAdjustment : SshData
423429 {
424430 public byte [ ] SharedKey { get ; set ; }
431+
425432 public byte [ ] ExchangeHash { get ; set ; }
433+
426434 public byte [ ] Key { get ; set ; }
427435
428436 /// <summary>
0 commit comments