Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: help me please, I'm stuck.

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help me please, I'm stuck.

    1
    Programming Assignment
    Encryption Program
    In this program you are going to write a class that can be used for encoding and decoding messages. Your program will need two classes. The first class contains the main method and is used to test the second class. The second class contains two public methods. One called Encrypt which takes a string and returns an encrypted (coded) version of the string and one called Decrypt which takes an encrypted string and returns the decrypted (decoded) string.

    Please note that the decrypted message you return must result from the Decrypt method. You cannot just echo the message string.
    The Encryption Algorithm
    You should build your encrypted text using the following pseudocoded algorithm.
    For each character in the message
    Get the current character
    Convert the character into a two-character hexadecimal string
    Create a new character that consists of the concatenation of
    a random uppercase character + the first hex digit +
    a random uppercase character + the second hex digit
    Concatenate this new character to the encrypted text you are going to return
    Return the encrypted text.
    For example, if you send the message “hi” the hexadecimal code for the “h” is 68 and the hexadecimal code for “I” is 69. Your algorithm should return something like “R6X8T6R9” depending on the random characters generated by your method. Note the random characters interspersed between the 68 and the 69.
    2
    The Decryption Algorithm
    You decryption algorithm needs to restore the original message by removing the random characters to
    recover the original hexadecimal code for the character. Remember that each character has been
    turned into a 4-character string. So you will have to extract the four encoded characters that make up
    each character in the original message as a unit. Also remember that the character you extracted is
    coded as a hexadecimal string. To recover the original character from the hexadecimal string you can
    use the following line of code
    c = (char) Integer.parseInt(character,16);
    Here’s a pseudocoded version of the decryption algorithm.
    For the length of the encrypted string
    Extract 4 characters
    Reconstruct the original hex string by removing the 2 random characters
    Create the character encoded by the hex string
    Concatenate the character to the decoded string you are going to return
    Return the decoded string
    Before you start this program be sure you have studied the string functions in chapter 4, the for-loop in
    chapter 5 and the examples we did in class.


  2. #2
    Member
    Join Date
    Oct 2013
    Location
    Manila, Philippines
    Posts
    285
    My Mood
    Amused
    Thanks
    6
    Thanked 64 Times in 61 Posts

    Default Re: help me please, I'm stuck.

    help me please, I'm stuck.
    stuck with what?
    what have you tried?
    do you have codes? errors with your code?
    paste your code together with your question, we will try to help

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: help me please, I'm stuck.

    We don't give code, but we'll help you with yours. What have you tried? Post your code with any errors and then ask specific questions about what you need help with. "I'm stuck," just doesn't cut it.

Similar Threads

  1. Need help STUCK
    By mstratmann in forum Loops & Control Statements
    Replies: 7
    Last Post: May 3rd, 2013, 08:25 AM
  2. Help me please, im stuck!
    By warbie118 in forum Object Oriented Programming
    Replies: 1
    Last Post: November 15th, 2011, 09:09 AM
  3. Im stuck, please help
    By bigsmoke101 in forum Loops & Control Statements
    Replies: 3
    Last Post: April 12th, 2011, 04:34 PM
  4. Stuck help please!
    By mindlessn00b in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 5th, 2010, 05:31 PM
  5. I am stuck
    By hawkman4188 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 29th, 2010, 12:46 AM