public override int GetHashCode() { int hash = 1; if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (Lang.Length != 0) { hash ^= Lang.GetHashCode(); } if (ScriptId.Length != 0) { hash ^= ScriptId.GetHashCode(); } if (DefaultRegion.Length != 0) { hash ^= DefaultRegion.GetHashCode(); } if (HasMoreScripts != false) { hash ^= HasMoreScripts.GetHashCode(); } if (HasStemming != false) { hash ^= HasStemming.GetHashCode(); } if (Alphabet.Length != 0) { hash ^= Alphabet.GetHashCode(); } if (AlphabetUpper.Length != 0) { hash ^= AlphabetUpper.GetHashCode(); } if (WordSpellCheckLcid != 0) { hash ^= WordSpellCheckLcid.GetHashCode(); } if (GoogleTransId.Length != 0) { hash ^= GoogleTransId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private static byte[] ConvertFromBase32(string inputString) { const int InputPerByteSize = 8; const int OutputPerByteSize = 5; const string AlphabetLower = "abcdefghijklmnopqrstuvwxyz234567"; const string AlphabetUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; if (string.IsNullOrEmpty(inputString)) { return(Array.Empty <byte>()); } int outputSize = inputString.Length * OutputPerByteSize / InputPerByteSize; if (outputSize == 0) { throw new ArgumentException("Input string invalid base32. Empty output array."); } int inputOffset = 0; int inputPosition = 0; byte[] output = new byte[outputSize]; for (int outputPosition = 0; outputPosition < output.Length; outputPosition++) { int outputOffset = 0; while (outputOffset < InputPerByteSize) { int currentByte = AlphabetLower.IndexOf(inputString[inputPosition]); if (currentByte < 0) { currentByte = AlphabetUpper.IndexOf(inputString[inputPosition]); if (currentByte < 0) { throw new ArgumentException("Invalid base32 character \"inputString[inputPosition]\""); } } int size1 = OutputPerByteSize - inputOffset; int size2 = InputPerByteSize - outputOffset; int bitsRemaining = size1 < size2 ? size1 : size2; inputOffset += bitsRemaining; outputOffset += bitsRemaining; output[outputPosition] <<= bitsRemaining; int offset = OutputPerByteSize - inputOffset; byte outputByte = (byte)(currentByte >> offset); output[outputPosition] |= outputByte; if (inputOffset >= OutputPerByteSize) { inputPosition++; inputOffset = 0; } } } return(output); }