reWZ.WZAES.DecryptASCIIString C# (CSharp) Method

DecryptASCIIString() private method

private DecryptASCIIString ( byte asciiBytes, bool encrypted = true ) : string
asciiBytes byte
encrypted bool
return string
        internal string DecryptASCIIString(byte[] asciiBytes, bool encrypted = true)
        {
            CheckKeyLength(asciiBytes.Length);
            return Encoding.ASCII.GetString(DecryptData(asciiBytes, encrypted ? _asciiEncKey : _asciiKey));
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>Reads a string encoded in WZ format.</summary>
        /// <param name="encrypted"> Whether the string is encrypted. </param>
        /// <returns> The read string. </returns>
        internal string ReadWZString(bool encrypted = true)
        {
            if (Position + 1 > Length)
            {
                throw new WZException("WZ string offset out of bounds");
            }
            int length = ReadSByte();

            if (length == 0)
            {
                return("");
            }
            if (length > 0)
            {
                length = length == 127 ? ReadInt32WithinBounds() : length;
                if (length == 0)
                {
                    return("");
                }
                if (Position + length * 2 > Length)
                {
                    throw new WZException("Not enough bytes to read WZ string");
                }
                byte[] rbytes = ReadBytes(length * 2);
                return(_aes.DecryptUnicodeString(rbytes, encrypted));
            } // !(length >= 0), i think we can assume length < 0, but the compiler can't seem to see that
            length = length == -128 ? ReadInt32WithinBounds() : -length;
            if (Position + length > Length)
            {
                throw new WZException("Not enough bytes to read WZ string");
            }
            return(length == 0 ? "" : _aes.DecryptASCIIString(ReadBytes(length), encrypted));
        }
All Usage Examples Of reWZ.WZAES::DecryptASCIIString