Dear all,
in md5 algorithm bellow, password like "secret" which is a string is converted to a correct
md5 password which Tomcat manager accepts it but if password was a int like password="123" it
makes a md5 password which Tomcat manager doesn't accept it.
what is the solution for making md5 from string,int,composit of string and int like password="c123".
thanks for your helping.
secret = 5ebe2294ecd0e0f08eab7690d2a6ee69
123 = 202cb962ac5975b964b7152d234b70
public void md5(String password) throws Exception {

String original = password ;
MessageDigest md = MessageDigest.getInstance("MD5");

byte[] digest = md.digest();
StringBuffer sb = new StringBuffer();
for (byte b : digest) {
sb.append(Integer.toHexString((int) (b & 0xff)));

System.out.println("original:" + original);
System.out.println("digested:" + digest.toString());
System.out.println("digested(hex):" + sb.toString());

__________________________________________________ ____________________

In mysql there is a row in users_tbl as below, password is md5 of "123":
user_name:admin password:202cb962ac5975b964b7152d234b70
and there is a row in roles_tbl as below:
user_name:admin role=manager

in http://localhost:8080/ when I click on Tomcat Manager and enter username=admin
and password=123 it doesn't accept password, although it worked ok without md5.

and there is a realm in server.xml in tomcat as below:
<Realm className="org.apache.catalina.realm.JDBCRealm"

driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/myproject"
connectionName="root" connectionPassword="123"
userCredCol="password" userRoleTable="ROLES_TBL" roleNameCol="role" />

tomcat-users.xml is as below:
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>

<user username="mytomcatusername" password="123" roles="manager"/>

<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>


please help if you know the solution of entering in Tomcat Manager.