×

Discussion Board

Results 1 to 3 of 3

Thread: encryption

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    10

    encryption

    i used this simple file encryption and decryption in j2me... it works fine when i run it using the emulator. but when deployed in nokia n73 it somewhat destorys the file. what's wrong with it?

    Code:
    public static byte[] encrypt(byte[] b, String key)
        {
            char[] key2 = key.toCharArray();
            int[] intArgs = new int[key.length()];
    
            for(int i = 0; i < key.length(); i++)
            {
                intArgs[i] = (int)key2[i];
            }
            
            int j = 0;
            for(int i = 0; i < b.length - 3; i++)
            {
                if(j == intArgs.length)
                    j = 0;
                
                    int y = (int)b[i] + intArgs[j];
                    b[i] = (byte)y;
                    j++;
            }
            
            return b;
            
        }
        
        public static byte[] decrypt(byte[] b, String key)
        {
            char[] key2 = key.toCharArray();
            int[] intArgs = new int[key.length()];
    
            for(int i = 0; i < key.length(); i++)
            {
                intArgs[i] = (int)key2[i];
            }
            
            int j = 0;
            for(int i = 0; i < b.length; i++)
            {
                if(j == intArgs.length)
                    j = 0;
                
                    int y = (int)b[i] - intArgs[j];
                    b[i] = (byte)y;
                    j++;
            }
            return b;
            
        }

  2. #2
    Registered User
    Join Date
    May 2007
    Posts
    10

    Re: encryption

    fixed... the problem is that an older version of the program is deployed hehe

  3. #3
    Registered User
    Join Date
    Feb 2007
    Posts
    2

    Re: encryption

    can i use the code above with images and videos???

Similar Threads

  1. Does E65 support WEP Encryption?
    By surfchen in forum Wired and Wireless interfaces (Closed)
    Replies: 3
    Last Post: 2007-03-18, 18:38
  2. Encryption Algorithm in Symbian
    By er_gps212 in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2005-10-18, 11:43
  3. Encryption Export Restrictions
    By parisn in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-06-15, 12:41
  4. Bluetooth encryption level
    By uabtcar in forum Mobile Java General
    Replies: 0
    Last Post: 2004-06-02, 14:55
  5. Basic encryption
    By doctordwarf in forum Mobile Java General
    Replies: 1
    Last Post: 2004-05-05, 18:05

Posting Permissions

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