Example #1
0
        /// <summary>
        /// Computes the appropriate string hash value for the given input text.
        /// </summary>
        /// <param name="text">The text to be hashed.</param>
        /// <returns>The string hash value.</returns>
        /// <remarks>Strings beginning with "0x" will be converted to numeric values.</remarks>
        public ulong StringHash(string text)
        {
            if (text.StartsWith("0x") && ulong.TryParse(text.Substring(2), System.Globalization.NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out ulong l))
            {
                return(l);
            }

            switch (Options.HashMode)
            {
            case VaultHashMode.Hash32:
                return(VLT32Hasher.Hash(text));

            case VaultHashMode.Hash64:
                return(VLT64Hasher.Hash(text));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #2
0
 public override ulong GetExportID()
 {
     return(VLT32Hasher.Hash(Class.Name));
 }
Example #3
0
 public static void AddVLT(string str)
 {
     VltHashDictionary[VLT32Hasher.Hash(str)]   = str;
     Vlt64HashDictionary[VLT64Hasher.Hash(str)] = str;
 }
Example #4
0
 public override ulong GetExportID()
 {
     return(VLT32Hasher.Hash($"{Collection.Class.Name}/{Collection.Name}"));
 }