denyjav / Md5

Md5Romario
0 stars 0 forks source link

md5 #1

Open denyjav opened 10 years ago

denyjav commented 10 years ago

private String encryptionData(String text) { try { byte[] origByte = text.getBytes();

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

        byte[] byteCriptog = md5.digest( origByte );

        BigInteger hash = new BigInteger( 1, byteCriptog );

        String infoMD5Crypted = hash.toString( 16 );

        if ( infoMD5Crypted.length() % 2 != 0 ) {
            infoMD5Crypted = "0" + infoMD5Crypted;
        }

        return infoMD5Crypted;

    } catch ( Exception ex ) {
        return "Error ";
    }

}
ghost commented 9 years ago

I have MD5 error