Results 1 to 2 of 2
Like Tree2Likes
  • 2 Post By Fubarable

Thread: Need some help with encryption decryption

  1. #1
    JP34 is offline Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Default Need some help with encryption decryption

    Can you help me fill in the blanks in the most basic code you can think of. Please
    public class ToolKit {
    /* Some Code Removed For Brevity */
    public static String lowerCase(String str) {
    String lowerT="";
    for (int i=0; i<str.length(); i++) {
    String ltr=str.substring(i, i+1);
    int caseIndex=UPPER_ALPHABET.indexOf(ltr);
    if(caseIndex==-1) {
    lowerT+=ltr;
    } else {
    lowerT+=LOWER_ALPHABET.substring(caseIndex, caseIndex+1);
    }
    }
    return lowerT;
    }
    public static int randomNumber(int min, int max) {
    if (max < min) {
    int temp=min;
    min = max;
    max = temp;
    }
    return ((int)(Math.random()*(max- min + 1)) + min);
    }
    public static String generateCode(String str) {
    String code=ALL_CHARACTERS;
    /* Your code HERE */
    return code;
    }
    public static String encrypt(String str,String code) {
    // Sample Run:
    // str="ABCDEF";
    // code="CDABEF"
    // encrypted="CDABEF"
    String encrypted = "";
    /* Your code HERE */
    return encrypted;
    }
    public static String decrypt(String str, String code) {
    // str="CDABEF";
    // code="CDABEF"
    // decrypted="ABCDEF"
    String decrypted="";
    /* Your code HERE */
    return decrypted;
    }
    public final static String UPPER_ALPHABET="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    public final static String LOWER_ALPHABET="abcdefghijklmnopqrstuvwxyz";
    public final static String PUNCTUATION=" ,.!@#$%^&*()[]{};:'\"<>\\-_=+";
    public final static String ALL_CHARACTERS=UPPER_ALPHABET+LOWER_ALPHABET+PUNCT UATION

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Need some help with encryption decryption

    Quote Originally Posted by JP34 View Post
    Can you help me fill in the blanks in the most basic code you can think of. Please
    ...
    No we shouldn't and we won't. Please understand that we'll be happy to look at your attempts and try to help you come to a solution, but we don't appreciate folks just dumping homework in here and asking us to do it for them. That's not right, that's not how you learn, and that's not what we'll do.

    So please show your efforts, ask your question, and we'll be more than happy to help as best we can. If this won't work for you, then we wish you well, but again ask that you not dump your work here.
    DarrylBurke and quad64bit like this.

Similar Threads

  1. Encryption & Decryption
    By raj.mscking@gmail.com in forum New To Java
    Replies: 1
    Last Post: 02-01-2012, 03:21 PM
  2. Encryption and Decryption
    By jatinkansagara in forum Advanced Java
    Replies: 7
    Last Post: 06-27-2011, 04:08 PM
  3. PGP Encryption&Decryption
    By Deepa in forum New To Java
    Replies: 2
    Last Post: 07-07-2009, 07:22 AM
  4. Encryption/Decryption
    By Echilon in forum New To Java
    Replies: 2
    Last Post: 03-24-2009, 12:58 PM
  5. Encryption/Decryption Through AOP
    By SirRawlins in forum Advanced Java
    Replies: 0
    Last Post: 12-19-2007, 04:22 PM

Tags for this Thread

Posting Permissions

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