mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Move crypto to unmanaged implementation
Which is much better if Mono can handle it, should be OK
This commit is contained in:
@@ -89,7 +89,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
try {
|
||||
byte[] key;
|
||||
using (SHA256Managed sha256 = new SHA256Managed()) {
|
||||
using (SHA256Cng sha256 = new SHA256Cng()) {
|
||||
key = sha256.ComputeHash(EncryptionKey);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
try {
|
||||
byte[] key;
|
||||
using (SHA256Managed sha256 = new SHA256Managed()) {
|
||||
using (SHA256Cng sha256 = new SHA256Cng()) {
|
||||
key = sha256.ComputeHash(EncryptionKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
byte[] hashedData;
|
||||
using (HMACSHA1 hmacGenerator = new HMACSHA1(sharedSecretArray, true)) {
|
||||
using (HMACSHA1 hmacGenerator = new HMACSHA1(sharedSecretArray)) {
|
||||
hashedData = hmacGenerator.ComputeHash(timeArray);
|
||||
}
|
||||
|
||||
@@ -279,9 +279,9 @@ namespace ArchiSteamFarm {
|
||||
|
||||
byte[] b64Secret = Convert.FromBase64String(IdentitySecret);
|
||||
|
||||
int bufferSize = 8;
|
||||
byte bufferSize = 8;
|
||||
if (string.IsNullOrEmpty(tag) == false) {
|
||||
bufferSize += Math.Min(32, tag.Length);
|
||||
bufferSize += (byte) Math.Min(32, tag.Length);
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
@@ -297,7 +297,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
byte[] hash;
|
||||
using (HMACSHA1 hmac = new HMACSHA1(b64Secret, true)) {
|
||||
using (HMACSHA1 hmac = new HMACSHA1(b64Secret)) {
|
||||
hash = hmac.ComputeHash(buffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user