Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DeriveKey() [1/2]

static byte[] System.Security.Cryptography.HKDF.DeriveKey ( HashAlgorithmName hashAlgorithmName,
byte[] ikm,
int outputLength,
byte?[] salt = null,
byte?[] info = null )
inlinestatic

Definition at line 135 of file HKDF.cs.

136 {
137 if (ikm == null)
138 {
139 throw new ArgumentNullException("ikm");
140 }
141 if (outputLength <= 0)
142 {
143 throw new ArgumentOutOfRangeException("outputLength", System.SR.ArgumentOutOfRange_NeedPosNum);
144 }
145 int num = HashLength(hashAlgorithmName);
146 int num2 = 255 * num;
147 if (outputLength > num2)
148 {
149 throw new ArgumentOutOfRangeException("outputLength", System.SR.Format(System.SR.Cryptography_Okm_TooLarge, num2));
150 }
151 Span<byte> span = stackalloc byte[num];
152 Extract(hashAlgorithmName, num, ikm, salt, span);
153 byte[] array = new byte[outputLength];
154 Expand(hashAlgorithmName, num, span, array, info);
155 return array;
156 }
static string ArgumentOutOfRange_NeedPosNum
Definition SR.cs:20
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Cryptography_Okm_TooLarge
Definition SR.cs:172
Definition SR.cs:7
static int HashLength(HashAlgorithmName hashAlgorithmName)
Definition HKDF.cs:183
static byte[] Extract(HashAlgorithmName hashAlgorithmName, byte[] ikm, byte[]? salt=null)
Definition HKDF.cs:8
static byte[] Expand(HashAlgorithmName hashAlgorithmName, byte[] prk, int outputLength, byte[]? info=null)
Definition HKDF.cs:40

References System.SR.ArgumentOutOfRange_NeedPosNum, System.array, System.SR.Cryptography_Okm_TooLarge, System.Security.Cryptography.HKDF.Expand(), System.Security.Cryptography.HKDF.Extract(), System.SR.Format(), System.Security.Cryptography.HKDF.HashLength(), and System.info.