More tweaks after pen-testing.

This commit is contained in:
CloneTrooper1019
2020-08-20 02:03:05 -05:00
parent f4899b4ce6
commit 2ff5d82218
7 changed files with 31 additions and 21 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Konscious.Security.Cryptography;
namespace RobloxFiles.DataTypes
@ -15,7 +16,7 @@ namespace RobloxFiles.DataTypes
public class SharedString
{
private static Dictionary<string, byte[]> Lookup = new Dictionary<string, byte[]>();
private static ConcurrentDictionary<string, byte[]> Lookup = new ConcurrentDictionary<string, byte[]>();
public string Key { get; internal set; }
public string ComputedKey { get; internal set; }
@ -29,12 +30,15 @@ namespace RobloxFiles.DataTypes
internal static void Register(string key, byte[] buffer)
{
Lookup.Add(key, buffer);
if (Lookup.ContainsKey(key))
return;
Lookup.TryAdd(key, buffer);
}
private SharedString(byte[] buffer)
{
using (HMACBlake2B blake2B = new HMACBlake2B(16 * 8))
using (var blake2B = new HMACBlake2B(16 * 8))
{
byte[] hash = blake2B.ComputeHash(buffer);
ComputedKey = Convert.ToBase64String(hash);