@@ -10,77 +10,5 @@ internal static class CryptoAbstraction
10
10
private static readonly RandomNumberGenerator Randomizer = RandomNumberGenerator . Create ( ) ;
11
11
12
12
internal static readonly SecureRandom SecureRandom = new SecureRandom ( new CryptoApiRandomGenerator ( Randomizer ) ) ;
13
-
14
- /// <summary>
15
- /// Generates a <see cref="byte"/> array of the specified length, and fills it with a
16
- /// cryptographically strong random sequence of values.
17
- /// </summary>
18
- /// <param name="length">The length of the array generate.</param>
19
- public static byte [ ] GenerateRandom ( int length )
20
- {
21
- var random = new byte [ length ] ;
22
- Randomizer . GetBytes ( random ) ;
23
- return random ;
24
- }
25
-
26
- public static byte [ ] HashMD5 ( byte [ ] source )
27
- {
28
- #if NET
29
- return MD5 . HashData ( source ) ;
30
- #else
31
- using ( var md5 = MD5 . Create ( ) )
32
- {
33
- return md5 . ComputeHash ( source ) ;
34
- }
35
- #endif
36
- }
37
-
38
- public static byte [ ] HashSHA1 ( byte [ ] source )
39
- {
40
- #if NET
41
- return SHA1 . HashData ( source ) ;
42
- #else
43
- using ( var sha1 = SHA1 . Create ( ) )
44
- {
45
- return sha1 . ComputeHash ( source ) ;
46
- }
47
- #endif
48
- }
49
-
50
- public static byte [ ] HashSHA256 ( byte [ ] source )
51
- {
52
- #if NET
53
- return SHA256 . HashData ( source ) ;
54
- #else
55
- using ( var sha256 = SHA256 . Create ( ) )
56
- {
57
- return sha256 . ComputeHash ( source ) ;
58
- }
59
- #endif
60
- }
61
-
62
- public static byte [ ] HashSHA384 ( byte [ ] source )
63
- {
64
- #if NET
65
- return SHA384 . HashData ( source ) ;
66
- #else
67
- using ( var sha384 = SHA384 . Create ( ) )
68
- {
69
- return sha384 . ComputeHash ( source ) ;
70
- }
71
- #endif
72
- }
73
-
74
- public static byte [ ] HashSHA512 ( byte [ ] source )
75
- {
76
- #if NET
77
- return SHA512 . HashData ( source ) ;
78
- #else
79
- using ( var sha512 = SHA512 . Create ( ) )
80
- {
81
- return sha512 . ComputeHash ( source ) ;
82
- }
83
- #endif
84
- }
85
13
}
86
14
}
0 commit comments