Results 1 to 5 of 5

Thread: Hashing Method in JSP

  1. #1
    Join Date
    Nov 2009
    Posts
    862

    Hashing Method in JSP

    Hello, I am having knowledge about the PHP and want to know something about the web development. And now I want to know the details about the Hashing method in jsp. If anyone is having knowledge about it, then please help me to achieve it. I will be thankful to you.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Hashing Method in JSP

    Hey, you can simply create an MD5 Hash in jsp by the use of the code below:
    Code:
    String str = "123456";
    MessageDigest msgdigest = MessageDigest.getInstance("MD5");
    msgdigest.update(str.getBytes());
    
    byte[] digest = msgdigest.digest();
    StringBuffer sb = new StringBuffer();
    
    for (int i = 0; i < digest.length; i++) {
        str = Integer.toHexString(0xFF & digest[i]);
    
        if (str.length() < 2) {
            str = "0" + str;
        }
        sb.append(str);
    }
    out.print(sb.toString());

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Hashing Method in JSP

    Hello, you can simply able to create a keyed Digest Using MD5 algorithm. As we know the keyed digest is the digest in which the secret key is used for making a digest for your buff of bytes. And it is also possible to use different keys for creating different digests. For getting reference you can simply make use of the code below:

    Code:
    public static byte[] getKeyedDigest(byte[] buff, byte[] key) 
    {
     try 
    { 
    MessageDigest msgdigest = MessageDigest.getInstance("MD5"); 
    msgdigest.update(buff); 
    return msgdigest.digest(key); 
    } 
    catch (NoSuchAlgorithmException nsae) 
    { 
    } 
    return null; 
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Hashing Method in JSP

    Hey, I have search regarding this and unable to get the details about it. But, I think if you refer the books below you will able to get the hashing method in JSP:
    • JavaBeans: Developing Component Software in Java
    • Java Secrets
    • The Java Developer's Resource
    • Concurrent Programming in Java: Design Principles and Patterns
    • The Java Virtual Machine Specification

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Hashing Method in JSP

    Hello, I am not having any knowledge about the hashing methods in java and jsp. But, you can simply able to find out all of the message digest algorithms by the use of the program below. For that it is necessary to make use of the services provided by all of the registered providers. And then the list which you will get can be used for the making MessageDigest object.
    Code:
    String[] names = getCryptoImpls("MessageDigest");

Similar Threads

  1. Secure MD5 hashing in PHP
    By Miquel in forum Software Development
    Replies: 4
    Last Post: 04-01-2011, 12:46 AM
  2. What is MD5 hashing in Internet Security?
    By Acolapissa in forum Networking & Security
    Replies: 3
    Last Post: 29-12-2010, 08:44 AM
  3. Method overriding versus method hiding in C#
    By ^MALARVIZHI^ in forum Software Development
    Replies: 4
    Last Post: 25-12-2010, 06:25 AM
  4. Is it possible to call destroy() method within init() Method?
    By Level8 in forum Software Development
    Replies: 3
    Last Post: 10-12-2009, 08:36 AM
  5. What is method overriding and method overloading in java
    By beelow in forum Software Development
    Replies: 3
    Last Post: 17-11-2009, 08:20 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,555,140.32743 seconds with 16 queries