Results 1 to 40 of 51

Thread: Port Java to Vb6

Threaded View

  1. #1

    Thread Starter
    Fanatic Member TokersBall_CDXX's Avatar
    Join Date
    Mar 2003
    Location
    America
    Posts
    571

    Port Java to Vb6

    Greetings... I'm in the process of converting an encryption algorithm from Java to VB. but first I'd like to better grasp the concepts behind the Java routines.

    from what I can see, the java routines take in a string such as

    #58#54#58#42#50#

    and returns the string

    ~b#9#XZ?›aÅXÞ

    JAVA:
    Code:
    private void s(String s1)
        {
    private final String b_java_lang_String_array1d_fld[] = { "LHKf24()", "..FWSqw1", "783vcSWr", "NSW%FGS3", "S834VS$!"};
          
    
      StringTokenizer stringtokenizer = new StringTokenizer(s1 + "#", "#");
            BitSet bitset = new BitSet(64);
            for(int i1 = 0; i1 < 5; i1++)
            {
                BitSet bitset1 = a(b_java_lang_String_array1d_fld[i1].toCharArray());
                int j1 = Integer.parseInt(stringtokenizer.nextToken());
                for(int l1 = 0; l1 < j1; l1++)
                    bitset1 = a(bitset1);
    
                bitset.xor(bitset1);
            }
    
            char ac[] = a(bitset, 8);
            for(int k1 = 0; k1 < 8; k1++)
                if(ac[k1] == 0 || ac[k1] == '\n' || ac[k1] == '\r')
                    ac[k1] = (char)(ac[k1] | 0x80);
    
            try
            {
                a_java_io_DataOutputStream_fld.writeBytes("~b#9#");
                for(int i2 = 0; i2 < ac.length; i2++)
                    a_java_io_DataOutputStream_fld.write((byte)(ac[i2] & 0xff));
    
                a_java_io_DataOutputStream_fld.writeBytes("\n");
            }
            catch(Exception exception)
            {
                a(1);
            }
        }
    
    private BitSet a(BitSet bitset)
        {
            BitSet bitset1 = new BitSet(64);
            boolean flag = false;
            for(int i1 = 0; i1 < 64; i1++)
            {
                if(flag != bitset.get(i1))
                    bitset1.set(i1);
                flag = bitset.get(i1);
            }
    
            return bitset1;
        }
    
    private BitSet a(char ac[])
        {
            int i1 = ac.length * 8;
            BitSet bitset = new BitSet(i1);
            for(int j1 = 0; j1 < i1; j1++)
            {
                int k1 = j1 & 7;
                int l1 = j1 >> 3;
                if((ac[l1] & 0xff & 1 << 7 - k1) != 0)
                    bitset.set(j1);
            }
    
            return bitset;
        }
    
    private char[] a(BitSet bitset, int i1)
        {
            int j1 = i1 * 8;
            char ac[] = new char[i1];
            for(int k1 = 0; k1 < j1; k1++)
            {
                int l1 = k1 & 7;
                int i2 = k1 >> 3;
                if(bitset.get(k1))
                    ac[i2] = (char)(ac[i2] | 1 << 7 - l1);
            }
    
            return ac;
        }


    I would like to produce the same effects in VB, but I'm having trouble grasping the concepts behind how it encrypts/decrypts the strings.


    is this some form of bitset conversion? or mere string/character shift conversion?


    another string passed through the function is

    #58#32#59#48#26#

    which returns

    ~b#20#àž-Un†„
    any ideas on this concept would be greatly appreciated.
    Last edited by TokersBall_CDXX; Feb 1st, 2004 at 03:28 PM.
    Build your own personalized flash based chat room for your webpage for FREE! http://www.4computerheaven.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width