Java Hash String hash(String strPlain)

Here you can find the source of hash(String strPlain)

Description

Hash

License

Open Source License

Parameter

Parameter Description
strPlain a parameter

Exception

Parameter Description
Exception an exception

Declaration

public static String hash(String strPlain) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from w  w  w .  j ava2s  .  co m*/
     * Hash
     * @param strPlain
     * @return
     * @throws Exception
     */
    public static String hash(String strPlain) {
        return String.valueOf(strPlain.hashCode());
        //      MessageDigest md;
        //      try {
        //         md = MessageDigest.getInstance("SHA");
        //         BASE64Encoder  base = new BASE64Encoder ();
        //         String pwdAfter = base.encode(md.digest(strPlain.getBytes()));
        //         return pwdAfter;
        //      } catch (NoSuchAlgorithmException e) {
        //         ;
        //      }
        //      return "";
    }

    /**
     * transform a Obejct 2 a String ,return value is "" when object is null
     * @param obj
     * @return
     * @author qiumm
     */
    public static String valueOf(Object obj) {
        return (obj == null) ? "" : obj.toString();
    }
}

Related

  1. hash(String src)
  2. hash(String str, int max)
  3. hash(String str, int offset)
  4. hash(String string)
  5. hash(String string, int length)
  6. hash32(String data)
  7. hashAlgToId(String hashAlg)
  8. hashArrayToString(int a[])
  9. hashbang(final String historyToken)