Password handling for the SSH client

This commit is contained in:
2016-02-09 16:18:01 -05:00
parent 279551e9be
commit be89837a27
5 changed files with 39 additions and 10 deletions
+14
View File
@@ -24,5 +24,19 @@ namespace LeafWeb.Core.Utility
// Return char and concat substring.
return char.ToLowerInvariant(s[0]) + s.Substring(1);
}
public static byte[] GetBytes(this string str)
{
var bytes = new byte[str.Length * sizeof(char)];
Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
public static string GetString(this byte[] bytes)
{
var chars = new char[bytes.Length / sizeof(char)];
Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length);
return new string(chars);
}
}
}