コード例 #1
0
        /// <summary>
        /// Encrypts the given password using the VNC encryption that UltraVNC uses
        /// to store its passwords. Which is, standard VNC DES encryption plus two
        /// bytes, which are supposed to be a checksum but which are currently not checked
        /// by UltraVNC.
        /// </summary>
        /// <param name="pwd">Password to encrypt. Only the first 8 characters are actually used. (As is standard in VNC).</param>
        /// <returns>A string with the cyphertext in hex, with no spaces or prefixes</returns>
        private static string EncryptPassword(string pwd)
        {
            VNCEncrypt.load();
            VNCEncrypt enc       = new VNCEncrypt(key);
            var        pwd_bytes = StringToBytes(pwd);

            Array.Resize(ref pwd_bytes, 8);
            var enc_bytes = enc.encrypt(pwd_bytes);
            var sb        = new StringBuilder();

            string enc_str = BitConverter.ToString(enc_bytes).Replace("-", "");

            enc_str += "00";

            return(enc_str);
        }
コード例 #2
0
        /// <summary>
        /// Encrypts the given password using the VNC encryption that UltraVNC uses
        /// to store its passwords. Which is, standard VNC DES encryption plus two
        /// bytes, which are supposed to be a checksum but which are currently not checked
        /// by UltraVNC.
        /// </summary>
        /// <param name="pwd">Password to encrypt. Only the first 8 characters are actually used. (As is standard in VNC).</param>
        /// <returns>A string with the cyphertext in hex, with no spaces or prefixes</returns>
        private static string EncryptPassword(string pwd)
        {
            VNCEncrypt.load();
            VNCEncrypt enc = new VNCEncrypt(key);
            var pwd_bytes = StringToBytes(pwd);
            Array.Resize(ref pwd_bytes, 8);
            var enc_bytes = enc.encrypt(pwd_bytes);
            var sb = new StringBuilder();

            string enc_str = BitConverter.ToString(enc_bytes).Replace("-", "");
            enc_str += "00";

            return enc_str;
        }