Encrypt Password with JSP

Encrypt Password with JSP

View Answers

September 5, 2009 at 4:11 PM

Hi Friend,

Try the following code:

1)form.jsp:

<html>
<body>
<form name="userform" method="post" action="encrypt.jsp">
<table>
<tr><td>User Name</td><td><input type="text" name="user"></td></tr>
<tr><td>Password</td><td><input type="password" name="pass"></td></tr>
<tr><td>Confirm Password</td><td><input type="password" name="cpass"></td></tr>
<tr><td>Name</td><td><input type="text" name="name"></td></tr>
<tr><td>Phone</td><td><input type="text" name="phone"></td></tr>
<tr><td>Contact</td><td><input type="text" name="contact"></td></tr>
<tr><td><input type="submit" value="Search"></td></tr>
</table>
</form>
</body>
</html>

2)encrypt.jsp:

<%@page import="java.sql.*"%>
<%@page import=" java.security.MessageDigest"%>
<%
String username=request.getParameter("user");
String password=request.getParameter("pass");
String name=request.getParameter("name");
String phone=request.getParameter("phone");
String contact=request.getParameter("contact");
String algorithm="";
int ph=Integer.parseInt(phone);
byte[] unencodedPassword = password.getBytes();
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (Exception e) {}
md.reset();
md.update(unencodedPassword);
byte[] encodedPassword = md.digest();
StringBuffer buf = new StringBuffer();
for (int i = 0; i < encodedPassword.length; i++) {
if (((int) encodedPassword[i] & 0xff) < 0x10) {
buf.append("0");
}
buf.append(Long.toString((int) encodedPassword[i] & 0xff, 16));
}
String passw=buf.toString();
String connectionURL = "jdbc:mysql://localhost:3306/test";;
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(connectionURL, "root", "root");
PreparedStatement ps = con.prepareStatement("INSERT INTO register(user,pass,name,phone,contact) VALUES(?,?,?,?,?)");
ps.setString(1,username);
ps.setString(2,passw);
ps.setString(3,name);
ps.setInt(4,ph);
ps.setString(5,contact);
int i = ps.executeUpdate();
ps.close();
con.close();
}
catch(Exception ex){}

%>

Thanks

June 15, 2011 at 2:22 PM

hello, can u give me code for how to decrypt password for this encryption??


August 6, 2012 at 3:39 PM

hello, can u give me code for how to decrypt password for this encryption??









Related Tutorials/Questions & Answers:
Encrypt Password with JSP - JSP-Servlet
Encrypt Password with JSP  Hi guys... I need you help.... I want to ask you how to make encrypt password with JSP servlet. For example I have form registration consists of: username, password, retype password, fullname, telp
encrypt the username and password using PHP
encrypt the username and password using PHP  How can we encrypt the username and password using PHP?   Hi friends, You can use the MySQL PASSWORD() function to encrypt username and password. For example, INSERT
Advertisements
Password need to encrypt while inserting into DB and need to decrypt while responding to forgot password
Password need to encrypt while inserting into DB and need to decrypt while responding to forgot password  Hi, I need the functionality in JSP to encrypt the password while inserting into DB and need decrypt logic while
How can we encrypt the username and password using PHP?
How can we encrypt the username and password using PHP?  How can we encrypt the username and password using PHP
Password need to encrypt while inserting into DB and need to decrypt while responding to forgot password
Password need to encrypt while inserting into DB and need to decrypt while responding to forgot password  Hi, i encrypt password and stored in to DB.but i dont know decrypt that password.plz send the code.in your site link
JSP code for forget password
JSP code for forget password  I need forget password JSP code.. example http://www.roseindia.net/users/forgotpassword.html
forgot password code in jsp
forgot password code in jsp  forgot password code in jsp   Please visit the following link: http://www.roseindia.net/jsf/richfaces
change password - JSP-Servlet
a simple web application using mysql and jsp. now i want to create a web page for a user. this web page consists of changing the password for the existing user. it look like this: current password new password confirm new password SUBMIT
Change Password - JSP-Servlet
Change Password  Hi all, Please kindly help me with jsp code and explanations to enable me write a change password program. This program will connect to mssql database 2000. Thanks
Decrypt an encrypted password in JSP
Decrypt an encrypted password in JSP   How to decrypt an encrypted password and store in database ? Her is my code that i have done for encryption..."); > String > pass=request.getParameter("password"); > String > cpass
Password History - JSP-Servlet
Password History  I am using servlets and in my application i want to maintain password history.It means on password change My application should check previous 5 password so that new password can't be same to 5 old password
how to change password into one jsp to another jsp
how to change password into one jsp to another jsp  i have two jsps in one jsp i give one password and confirm password, in another jsp i want change my password compare with 1st jsp how to write code please give me answer?  
code for password strength using jsp-servlet
code for password strength using jsp-servlet  hi.............. plz help me to give code for password strength using jsp-servlet for implementation in my project as soon as possible because i want to show this functionality in my
Send forgot Password through mail - JSP-Servlet
Send forgot Password through mail   hello every one I am designing a admin login page where i am validating the password through file(Example if user Name is Sreenivas and types sree as password i check a file where i
Change Password Code in JSP
Change Password Code in JSP In this example we will see how to change password code in jsp. First of all we have created a form where we have displayed...;/head> <h2 align="center"><strong>Change password in JSP
can any one give the frogort password code using jsp,
can any one give the frogort password code using jsp,  plz give the code for frogot password
Java swing store the encrypted password into database
Java swing store the encrypted password into database In this tutorial, you will learn how to encrypt the password and insert it into database. Here is an example that creates two fields to accept username and password from the user
change password servlets - JSP-Interview Questions
change password servlets  hi all, i need the codes to create a change password servlet.  Hi, I dont have the time to write the code. But i... a link for change the password page in that page there should be a three text box
Password
Password  make a program which ask ask the username and password * in this format. in C language
JSP code for registration form
JSP code for registration form  Haiiii can u please tell me how to encrypt password field in registration form and to compare both password and confirm password fields using jsp
jsp login code ... when username , drop down box and password is correct
jsp login code ... when username , drop down box and password is correct  i need a jsp code for login.... when username password and dropdown box...; var password=document.form.pass.value; if(username==""){ alert("Enter Username
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct... in dropdown box.... so when i login i all the three username,password and dropdown box...=document.form.user.value; var password=document.form.pass.value; if(username==""){ alert("Enter
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct... in dropdown box.... so when i login i all the three username,password and dropdown box...=document.form.user.value; var password=document.form.pass.value; if(username
how to check username & password from database using jsp
how to check username & password from database using jsp  Hello, I have created 1 html page which contain username, password & submit button. in my oracle10G database already contain table name admin which has name, password
ModuleNotFoundError: No module named 'encrypt'
ModuleNotFoundError: No module named 'encrypt'  Hi, My Python... 'encrypt' How to remove the ModuleNotFoundError: No module named 'encrypt... to install padas library. You can install encrypt python with following command
password protected zip file creation exmpale coded neaded - JSP-Servlet
password protected zip file creation exmpale coded neaded  am able to create a zip file and able to read the file but password protection need please help
sir plz help in design a jsp page whichis as follow username [_____] select [__>]password [_____] after selection then onlypassword text box is visible
sir plz help in design a jsp page   sir plz help in design a jsp page which is as follow username [ _ ] select [ > ] password [ _ ] after selection then only password text box is visible
Forgot Password of Application
Forgot Password of Application  Forgot Password of Application through servlet and jsp
ModuleNotFoundError: No module named 'django-encrypt'
ModuleNotFoundError: No module named 'django-encrypt'  Hi, My... named 'django-encrypt' How to remove the ModuleNotFoundError: No module named 'django-encrypt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-encrypt'
ModuleNotFoundError: No module named 'django-encrypt'  Hi, My... named 'django-encrypt' How to remove the ModuleNotFoundError: No module named 'django-encrypt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'tf-encrypt'
ModuleNotFoundError: No module named 'tf-encrypt'  Hi, My Python... 'tf-encrypt' How to remove the ModuleNotFoundError: No module named 'tf-encrypt' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'yxspkg_encrypt'
ModuleNotFoundError: No module named 'yxspkg_encrypt'  Hi, My... named 'yxspkg_encrypt' How to remove the ModuleNotFoundError: No module named 'yxspkg_encrypt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cfn-encrypt'
ModuleNotFoundError: No module named 'cfn-encrypt'  Hi, My Python... 'cfn-encrypt' How to remove the ModuleNotFoundError: No module named 'cfn-encrypt' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'django-encrypt'
ModuleNotFoundError: No module named 'django-encrypt'  Hi, My... named 'django-encrypt' How to remove the ModuleNotFoundError: No module named 'django-encrypt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lets-encrypt'
ModuleNotFoundError: No module named 'lets-encrypt'  Hi, My Python... 'lets-encrypt' How to remove the ModuleNotFoundError: No module named 'lets-encrypt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'travis-encrypt'
ModuleNotFoundError: No module named 'travis-encrypt'  Hi, My... named 'travis-encrypt' How to remove the ModuleNotFoundError: No module named 'travis-encrypt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aes-encrypt'
ModuleNotFoundError: No module named 'aes-encrypt'  Hi, My Python... 'aes-encrypt' How to remove the ModuleNotFoundError: No module named 'aes-encrypt' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'desktop-encrypt'
ModuleNotFoundError: No module named 'desktop-encrypt'  Hi, My... named 'desktop-encrypt' How to remove the ModuleNotFoundError: No module named 'desktop-encrypt' error? Thanks   Hi, In your python
Password encryption and decryption
users' password in the database so that I wouldnt know their password. Is there anyway that you could teach me how to encrypt the password and store...Password encryption and decryption  Hello, I'm developing a system
forget password
forget password  can i get coding for forgot password in jsp, need using javamail also cannot.. what should i do?? Thx
Forget Password
Forget Password  How i get my forget password through mail?   Please visit the following links: http://www.roseindia.net/jsf/richfaces/ http://www.roseindia.net/jsf/richfaces/developing-jsp-files.shtml
ModuleNotFoundError: No module named 'lets-encrypt-apache'
ModuleNotFoundError: No module named 'lets-encrypt-apache'  Hi, My... named 'lets-encrypt-apache' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-apache' error? Thanks   Hi
ModuleNotFoundError: No module named 'lets-encrypt-exim'
ModuleNotFoundError: No module named 'lets-encrypt-exim'  Hi, My... named 'lets-encrypt-exim' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-exim' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'lets-encrypt-dns'
ModuleNotFoundError: No module named 'lets-encrypt-dns'  Hi, My... named 'lets-encrypt-dns' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-dns' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'lets-encrypt-exim'
ModuleNotFoundError: No module named 'lets-encrypt-exim'  Hi, My... named 'lets-encrypt-exim' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-exim' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'lets-encrypt-iis'
ModuleNotFoundError: No module named 'lets-encrypt-iis'  Hi, My... named 'lets-encrypt-iis' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-iis' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'lets-encrypt-icecast'
ModuleNotFoundError: No module named 'lets-encrypt-icecast'  Hi...: No module named 'lets-encrypt-icecast' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-icecast' error? Thanks   Hi
ModuleNotFoundError: No module named 'lets-encrypt-nginx'
ModuleNotFoundError: No module named 'lets-encrypt-nginx'  Hi, My... named 'lets-encrypt-nginx' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-nginx' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'lets-encrypt-iis'
ModuleNotFoundError: No module named 'lets-encrypt-iis'  Hi, My... named 'lets-encrypt-iis' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-iis' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'lets-encrypt-postfix'
ModuleNotFoundError: No module named 'lets-encrypt-postfix'  Hi...: No module named 'lets-encrypt-postfix' How to remove the ModuleNotFoundError: No module named 'lets-encrypt-postfix' error? Thanks   Hi

Ads