Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RC2BCryptModes.cs
Go to the documentation of this file.
1using System;
4
6
7internal static class RC2BCryptModes
8{
9 internal static SafeAlgorithmHandle GetHandle(CipherMode cipherMode, int effectiveKeyLength)
10 {
11 return cipherMode switch
12 {
13 CipherMode.CBC => OpenRC2Algorithm("ChainingModeCBC", effectiveKeyLength),
14 CipherMode.ECB => OpenRC2Algorithm("ChainingModeECB", effectiveKeyLength),
15 _ => throw new NotSupportedException(),
16 };
17 }
18
19 private static SafeAlgorithmHandle OpenRC2Algorithm(string cipherMode, int effectiveKeyLength)
20 {
22 safeAlgorithmHandle.SetCipherMode(cipherMode);
23 if (effectiveKeyLength != 0)
24 {
25 safeAlgorithmHandle.SetEffectiveKeyLength(effectiveKeyLength);
26 }
27 return safeAlgorithmHandle;
28 }
29}
static SafeAlgorithmHandle GetHandle(CipherMode cipherMode, int effectiveKeyLength)
static SafeAlgorithmHandle OpenRC2Algorithm(string cipherMode, int effectiveKeyLength)
static SafeAlgorithmHandle BCryptOpenAlgorithmProvider(string pszAlgId, string pszImplementation, OpenAlgorithmProviderFlags dwFlags)
Definition Cng.cs:34