Last active
August 9, 2023 12:37
-
-
Save VulBusters/5adc5b9e4aafd8845263f551fa010828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static byte[] GetSessionKey(byte[] sharedSecret) | |
{ | |
String salt = PlayerPrefs.GetString(_PlayerPrefs.Salt); | |
if(String.IsNullOrEmpty(salt)) | |
{ | |
throw new PlayerPrefsItemNotFoundException(_PlayerPrefs.Salt); | |
} | |
var pdb = new Pkcs5S2ParametersGenerator(new Sha256Digest()); | |
pdb.Init(sharedSecret, Conversion.StringToByteArray(salt), CryptoConstant.Iterations); | |
var key = (KeyParameter)pdb.GenerateDerivedMacParameters(CryptoConstant.KdfKeySize * 8); | |
return key.GetKey(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment