CryptoAbstraction
using SshNet.Security.Cryptography;
using System;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Security.Cryptography;
namespace Renci.SshNet.Abstractions
{
internal static class CryptoAbstraction
{
public static byte[] GenerateRandom(int length)
{
byte[] obj = new byte[length];
GenerateRandom(obj);
return obj;
}
public static void GenerateRandom(byte[] data)
{
if (data == null)
throw new ArgumentNullException("data");
WindowsRuntimeBufferExtensions.CopyTo(CryptographicBuffer.GenerateRandom((uint)data.Length), data);
}
public static MD5 CreateMD5()
{
return new MD5();
}
public static SHA1 CreateSHA1()
{
return new SHA1();
}
public static SHA256 CreateSHA256()
{
return new SHA256();
}
public static SHA384 CreateSHA384()
{
return new SHA384();
}
public static SHA512 CreateSHA512()
{
return new SHA512();
}
public static RIPEMD160 CreateRIPEMD160()
{
return new RIPEMD160();
}
public static HMACMD5 CreateHMACMD5(byte[] key)
{
return new HMACMD5(key);
}
public static HMACMD5 CreateHMACMD5(byte[] key, int hashSize)
{
return new HMACMD5(key, hashSize);
}
public static HMACSHA1 CreateHMACSHA1(byte[] key)
{
return new HMACSHA1(key);
}
public static HMACSHA1 CreateHMACSHA1(byte[] key, int hashSize)
{
return new HMACSHA1(key, hashSize);
}
public static HMACSHA256 CreateHMACSHA256(byte[] key)
{
return new HMACSHA256(key);
}
public static HMACSHA256 CreateHMACSHA256(byte[] key, int hashSize)
{
return new HMACSHA256(key, hashSize);
}
public static HMACSHA384 CreateHMACSHA384(byte[] key)
{
return new HMACSHA384(key);
}
public static HMACSHA384 CreateHMACSHA384(byte[] key, int hashSize)
{
return new HMACSHA384(key, hashSize);
}
public static HMACSHA512 CreateHMACSHA512(byte[] key)
{
return new HMACSHA512(key);
}
public static HMACSHA512 CreateHMACSHA512(byte[] key, int hashSize)
{
return new HMACSHA512(key, hashSize);
}
public static HMACRIPEMD160 CreateHMACRIPEMD160(byte[] key)
{
return new HMACRIPEMD160(key);
}
}
}