Confuser.Core/Utils.cs
/// <summary>
///     Encoding the buffer to a string using specified charset.
/// </summary>
/// <param name="buff">The input buffer.</param>
/// <param name="charset">The charset.</param>
/// <returns>The encoded string.</returns>
Encoding the buffer to a string using specified charset.
Encoding the buffer to a string using specified charset .
public static string EncodeString(byte[] buff, char[] charset)
        {
            int current = buff[0];
            var ret = new StringBuilder();
            for (int i = 1; i < buff.Length; i++)
            {
                current = (current << 8) + buff[i];
                while (current >= charset.Length)
                {
                    ret.Append(charset[current % charset.Length]);
                    current /= charset.Length;
                }
            }
            if (current != 0)
                ret.Append(charset[current % charset.Length]);
            return ret.ToString();
        }
public static string EncodeString ( byte [ ] buff , char [ ] charset ) { int current = buff [ 0 ] ; var ret = new StringBuilder ( ) ; for ( int i = 1 ; i < buff . Length ; i ++ ) { current = ( current << 8 ) + buff [ i ] ; while ( current >= charset . Length ) { ret . Append ( charset [ current % charset . Length ] ) ; current /= charset . Length ; } } if ( current != 0 ) ret . Append ( charset [ current % charset . Length ] ) ; return ret . ToString ( ) ; }
Encoding the buffer to a string using specified charset.
Encoding the buffer to a string using specified charset .
The encoded string.
The encoded string .
buff
byte[]
The input buffer.
The input buffer .
charset
char[]
None