Esempio n. 1
0
        public void PrepareToDecodeBSHFCode(string pszPassword)
        {
            if (null == m_pBshfBuf)
            {
                m_pBshfBuf = new ERIBshfBuffer();
            }
            if (string.IsNullOrEmpty(pszPassword))
            {
                pszPassword = "******";
            }
            int char_count = Encoding.ASCII.GetByteCount(pszPassword);
            int length     = Math.Max(char_count, 32);
            var pass_bytes = new byte[length];

            char_count = Encoding.ASCII.GetBytes(pszPassword, 0, pszPassword.Length, pass_bytes, 0);
            if (char_count < 32)
            {
                pass_bytes[char_count++] = 0x1b;
                for (int i = char_count; i < 32; ++i)
                {
                    pass_bytes[i] = (byte)(pass_bytes[i % char_count] + pass_bytes[i - 1]);
                }
            }
            m_pBshfBuf.m_strPassword  = pass_bytes;
            m_pBshfBuf.m_dwPassOffset = 0;
            m_dwBufPos = 32;
        }
Esempio n. 2
0
 public BSHFDecodeContext(uint nBufferingSize) : base(nBufferingSize)
 {
     m_pBshfBuf = null;
 }