예제 #1
0
파일: MD5.java 프로젝트: dalinhuang/zctable
  /*
    md5Final�����������
  */
  private void md5Final() {
    byte[] bits = new byte[8];
    int index, padLen;

    /// * Save number of bits */
    Encode(bits, count, 8);

    /// * Pad out to 56 mod 64.
    index = (int) (count[0] >>> 3) & 0x3f;
    padLen = (index < 56) ? (56 - index) : (120 - index);
    md5Update(PADDING, padLen);

    /// * Append length (before padding) */
    md5Update(bits, 8);

    /// * StoreImp state in digest */
    Encode(digest, state, 16);
  }
예제 #2
0
파일: MD5.java 프로젝트: dalinhuang/zctable
 /*
   getMD5ofStr����MD5����Ҫ�Ĺ�����������ڲ���������Ҫ����MD5�任���ַ�
   ���ص��DZ任��Ľ��������Ǵӹ�����ԱdigestHexStrȡ�õģ�
 */
 public String getMD5ofStr(String inbuf) {
   md5Init();
   md5Update(inbuf.getBytes(), inbuf.length());
   md5Final();
   digestHexStr = "";
   for (int i = 0; i < 16; i++) {
     digestHexStr += byteHEX(digest[i]);
   }
   return digestHexStr;
 }