// Decompiled by DJ v3.8.8.85 Copyright 2005 Atanas Neshkov  Date: 25.06.2006 02:33:49
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   Password.java

package Password;


public class Password
{

    public Password()
    {
    }

    public static int getPasswd(String raw, String key)
    {
        return add(action(raw, key));
    }

    private static int add(String s1)
    {
        int i = 0;
        int j = 0;
        int k = 0;
        int l = s1.length();
        if(l < 19)
        {
            for(int i1 = l - 1; i1 >= 0; i1--)
            {
                i = i * 3 + s1.charAt(i1);
                j = j * 5 + s1.charAt(l - i1 - 1);
            }

        } else
        {
            int j1 = l / 19;
            for(int k1 = l - 1; k1 >= 0; k1 -= j1)
            {
                i = i * 5 + s1.charAt(k1);
                j = j * 3 + s1.charAt(l - k1 - 1);
            }

        }
        k = i ^ j;
        return k & 0xffffff ^ k >> 24;
    }

    private static final String action(String s1, String s2)
    {
        int i = s1.length();
        int j = s2.length();
        int k = i ^ j << 4;
        if(i < 1)
            return s1;
        if(j < 1)
            return s2;
        int l = i;
        if(j > l)
            l = j;
        StringBuffer stringbuffer = new StringBuffer(l);
        for(int i1 = 0; i1 < l; i1++)
            stringbuffer.append((char)(s1.charAt(i1 % i) ^ s2.charAt(i1 % j) ^ k));

        return stringbuffer.toString();
    }
}