- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
public static byte[] HMACSHA256(ProtectedData key, byte[] data)
{
using (var _key = key.Get())
using (var hmac = new HMACSHA256(_key))
return hmac.ComputeHash(data);
}
public static byte[] HMACSHA256(ProtectedData key, Stream stream)
{
using (var _key = key.Get())
using (var hmac = new HMACSHA256(_key))
return hmac.ComputeHash(stream);
}
public static byte[] HMACSHA256(byte[] key, byte[] data)
{
using (var hmac = new HMACSHA256(key))
return hmac.ComputeHash(data);
}
public static byte[] HMACSHA256(byte[] key, Stream stream)
{
using (var hmac = new HMACSHA256(key))
return hmac.ComputeHash(stream);
}
public static byte[] MD5(byte[] data)
{
using (var h = System.Security.Cryptography.MD5.Create())
{ return h.ComputeHash(data); }
}
public static byte[] MD5(Stream stream)
{
using (var h = System.Security.Cryptography.MD5.Create())
{ return h.ComputeHash(stream); }
}
public static byte[] SHA1(byte[] data)
{
using (var h = System.Security.Cryptography.SHA1.Create())
return h.ComputeHash(data);
}
public static byte[] SHA1(Stream stream)
{
using (var h = System.Security.Cryptography.SHA1.Create())
return h.ComputeHash(stream);
}
public static byte[] SHA256(byte[] data)
{
using (var h = System.Security.Cryptography.SHA256.Create())
return h.ComputeHash(data);
}
public static byte[] SHA256(Stream stream)
{
using (var h = System.Security.Cryptography.SHA256.Create())
return h.ComputeHash(stream);
}
public static byte[] SHA384(byte[] data)
{
using (var h = System.Security.Cryptography.SHA384.Create())
return h.ComputeHash(data);
}
public static byte[] SHA384(Stream stream)
{
using (var h = System.Security.Cryptography.SHA384.Create())
return h.ComputeHash(stream);
}
public static byte[] SHA512(byte[] data)
{
using (var h = System.Security.Cryptography.SHA512.Create())
return h.ComputeHash(data);
}
public static byte[] SHA512(Stream stream)
{
using (var h = System.Security.Cryptography.SHA512.Create())
return h.ComputeHash(stream);
}
gost 22.11.2015 11:42 # 0
Milonov 23.11.2015 17:06 # 0
gost 23.11.2015 19:28 # 0
imihajlov 23.11.2015 18:24 # 0
bormand 23.11.2015 18:26 # +1
P.S. Самый прикол, если их потом юзают внутри свича...
imihajlov 23.11.2015 18:28 # 0
bormand 23.11.2015 18:29 # +1