Esempio n. 1
0
  // md5±àÂë
  public static String md5Encrypt(String s) throws Exception {

    MessageDigest md5 = MessageDigest.getInstance("MD5");

    sun.misc.BASE64Encoder base64Encoder = new sun.misc.BASE64Encoder();

    return base64Encoder.encode(md5.digest(s.getBytes("utf-8")));
  }
 private String getHPubAccessHandleString() {
   byte[] data = null;
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   ObjectOutputStream oos = null;
   try {
     oos = new ObjectOutputStream(baos);
     oos.writeObject(hPubAccessHandle);
     oos.flush();
     data = baos.toByteArray();
   } catch (IOException ioe) {
     System.out.println("Exception AccessEJBTemplate::getHPubAccessHandleString");
   }
   sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
   String encoded = encoder.encodeBuffer(data);
   return encoded;
 }