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 6 of 6

Thread: How do i encrypt my password at command line

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How do i encrypt my password at command line

    Good morning house, i'm writing an assignment that needs administrator password to login, i don't want the password to display the exact texts when typing it at command line. how can i get this done without using Jpassword?
    Secondly, i want to implement something like "Press any key to continue..." in the code and don't know what to use. Thanks


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: How do i encrypt my password at command line

    If you want to use the standard command console, I'm not entirely sure that's possible (at least not without JNI).

    The standard Java implementation of getting input from the command console waits until the user has pressed enter/return before sending the data to the input stream. At the same time, any typed characters immediately appear in the console.

  3. The Following User Says Thank You to helloworld922 For This Useful Post:

    AHOT (October 13th, 2010)

  4. #3
    Junior Member
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: How do i encrypt my password at command line

    Thank you Helloworld922,
    how about pausing the program flow to wait untill a character is typed on the keyboard; to implement something like "press any key to continue..."

  5. #4
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: How do i encrypt my password at command line

    If you are using Scanner or whatever to read from the command prompt, I'm pretty sure that the program pauses when you are waiting for the next input with the call Scanner.getNext() or whatever. Someone will have to confirm that for me before I start giving examples and whatnot. I don't want to give incorrect information.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  6. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How do i encrypt my password at command line


  7. #6
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: How do i encrypt my password at command line

    Reading in the next character from the console input stream will pause until the enter key is pressed, not when any key is pressed.

    If it's acceptable for you to have a "press enter to continue", then Scanner.nextLine() will work for that purpose. Otherwise, it's back to JNI.

Similar Threads

  1. Need Help for encrypt/decrypt.
    By superdhebz in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 17th, 2010, 12:17 PM
  2. A problem with command line compilation
    By goodguy in forum Java Theory & Questions
    Replies: 4
    Last Post: August 2nd, 2010, 10:58 AM
  3. [SOLVED] Command Line Argument Help
    By EmSaint in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 10:55 AM
  4. Multi-Valued Command Line Arguments
    By joey86 in forum Java Theory & Questions
    Replies: 1
    Last Post: December 29th, 2009, 11:19 AM
  5. How to Send command line arguments in Eclipse?
    By JavaPF in forum Java JDK & IDE Tutorials
    Replies: 0
    Last Post: April 23rd, 2009, 11:37 AM