Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: static byte[] encryptPasswordSHA(byte[] userID, byte[] password, byte[] clientSeed, byte[] serverSeed) throws java.io.IOException
        internal static sbyte[] encryptPasswordSHA(sbyte[] userID, sbyte[] password, sbyte[] clientSeed, sbyte[] serverSeed)
        {
            try
            {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(userID);
                md.update(password);
                sbyte[] token = md.digest();
                md.update(token);
                md.update(serverSeed);
                md.update(clientSeed);
                md.update(userID);
                md.update(SHA_SEQUENCE);
                return(md.digest());
            }
            catch (NoSuchAlgorithmException e)
            {
                IOException io = new IOException("Error loading SHA encryption: " + e);
                io.initCause(e);
                throw io;
            }
        }