4 thoughts on “Seeking Java encryption source code (MD5, BASE64)”

  1. Import java.security.*;
    import javax.crypto.*;

    /**
    *This example explains how to use the DES private key plus algorithm to decrypt
    *
    * @AUTHOR Devon
    * @Version 1.0 04/03/10
    */
    Public class {

    ) {
    try {
    string algorithm = "des"; // Define the encryption algorithm, you can use the design, the desede, blowfish
    string message = "Hello World."

    // generate a DES key
    =. (Algorithm);
    .init (56); // Select the des algorithm, the key length must be 56 -bit r
    key key =. (); // generate key

    // generate CIPHER object
    cipher cipher = cipher. ("des");

    // Use key encryption (message), generate ciphertexts ()
    cipher.init (cipher.encrypt_mode, key); // The operating mode is encrypted (cipher.encrypt_mode), key is the key r
    byte [] = cipher.dofinal (message.getbytes ()); // get the encrypted byte array
    System.out.println ("encrypted information:" new string ());

    // Plaintext with key text ()
    cipher.init (cipher.DeCrypt_mode, Key); r n byte [] = cipher.dofinal (); // Obtain the after -decomposed byte array
    system.out.println ("Clealing information:" new string ());
    } catch (exception ex) {
    ex. ();
    }
    }

    }

    /**
    *@author devon
    */ n
    import java. security.*;
    import java.security.spec.*;
    import javax.crypto.*;

    public class {
    position ARGV []) {
    try {
    string algorithm = "rsa"; // Define the encryption algorithm, you can use des, desede, blowfish
    string message = "Zhang San, hello, I am, I am Li Si ";

    // generate Zhang San's key pair ()
    =
    . ); // Specify the key length of 1024 bits
    keypair =. (); // generate key pair
    system.out.println ("Generate Zhang San's public key pair");

    // Zhang Sanjian has become a public key () and sends it to Li Si. Here is the number of arrays by the public key
    byte [] = .Getpublic (). ();

    // Through the network or disk, the public key is transferred to Li Si
    // Li Si received the public key after the Zhang San -encoded, and decoded it
    =. (( Algorithm); // Objects
    =
    new (); // The public key uses x.509 encoding
    publicKey =. Key
    System.out.println ("Li Si Cheng Gong Decoding, get Zhang San's public key");

    // Li Si used Zhang San's public key encryption information and sent it to it to Li Si
    cipher cipher = cipher. ("RSA/ECB/"); // get the cipher object
    cipher.init (cipher.encrypt_mode,);
    byte [] = cipher.dofinal (message.getbytes ()); // Information
    System.out.println ("" After -encrypted information: " new string ());
    system.out.println (" encrypted, send it to Li Si ... ");

    // Zhang San decrypts the information received from Li Si with his own private key
    cipher.init (cipher.deCrypt_mode,. ()); Object
    byte [] = cipher.dofinal (); // After getting decrypted information
    system.out.println ("Zhang San received the information, after decryption is:" new string ());
    } catch (exception ex) {
    ex. ();
    }
    }
    }

  2. What encrypted string is encrypted? I have the algorithm of MD5 here
    Public Final Static String MD5 (String PWD) {
    char hexdigits [] = {0, 1, 2, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6 7, 8, 9,
    a, b, c, d, e, f};
    try {
    byte [] strtemp = pwd.getbytes ();
    mdtemp = ("Md5");
    mdtemp.Update (StRTEMP);
    byte [] md = mdtemp.digest ();
    int j = md.length; [] = new char [j * 2];
    int k = 0;
    for (int i = 0; i u003Cj; i ) {
    byte byte0 = md [i];
    str [k ] = hexdigits [byte0 >>> 4

  3. The old MD5 upstairs is easy to crack. Try me. It is the method of me in the Ministry of Public Security, the Taxation Bureau, and the project of insurance companies and banks. I wish you success!

    import java.io.;
    import java.security.;
    import java.security.; (String [] art) {
    dp = new ();
    string md5psw = dp. ("123456");
    system.out.println (md5psw);
    }
    }

    Class {
    private;
    private string res);
    private byte [] args = null;
    String userpass) {
    try {
    // generates objects, pass the parameters of the algorithm used (md5)
    =. ("Md5");
    // Use Getbytes () Methods to generate string arrays
    .update (userpass.getbytes ("gbk");
    // The digest () method of executing objects completes the calculation, and the calculation results return through the array of byte types r r r r r r r r
    args = .digest ();
    } catch (e) {
    e. ();
    } catch (ee) {
    ee. ();
    } Finally {
    .RESET ();
    }

    // Convert the result to string
    result = "" "; // result empty, otherwise it will then it It will automatically add! Intersection Intersection
    for (int i = 0; I u003Cargs.length; i ) {
    result = integer. (

  4. Go back at night

    In Java, every time MD5 encryption runs, the result of the encryption is different. Even if you use a key,

    The encryption method,

    I dare not say that after the MD5 encryption, I will definitely not be able to solve it with the original key,

    but now I didn’t try it. The same string.

    is looking for. Essence Essence Essence Essence Essence Essence Essence

Leave a Comment