The Data Encryption Standard (DES) is a symmetric-key algorithm for the encryption of electronic data. Although its short key length of 56 bits, criticized from the beginning, makes it too insecure for most current applications, it was highly influential in the advancement of modern cryptography.

In cryptography, Triple DES (3DES or TDES), officially the Triple Data Encryption Algorithm (TDEA or Triple DEA), is a symmetric-key block cipher, which applies the DES cipher algorithm three times to each data block. The Data Encryption Standard's (DES) 56-bit key is no longer considered adequate in the face of modern cryptanalytic techniques and supercomputing power.

1 DES crypt and decrypt

You can use an DES instance to crypt and decrypt messages. Encrypt method returns hexadecimal representation of crypted data and decrypt method expects also hexadecimal representation of crypted data to decrypt.

DES Key only allows passwords 8 characters long. If you try to use a password longer than 8 chars, only first 8 bytes will be considered. If password is less than 8 bytes, password is filled automatically.
Copy
<script>
    var des = new Ax.crypt.DES();

    var password = "mypasswo";
    var message_source  = "Secret Message";

    var message_secret  = des.encrypt(password, message_source);
    var message_decoded = des.decrypt(password, message_secret);
    
    console.log("source :" + message_source);
    console.log("secret :" + message_secret);
    console.log("decoded:" + message_decoded);
</script>
source :Secret Message
secret :9e184eaf00489db18156be57bc21ca9e
decoded:Secret Message

2 3DES crypt and decrypt

You can use anTriple DES instance to crypt and decrypt messages. Encrypt method returns hexadecimal representation of crypted data and decrypt method expects also hexadecimal representation of crypted data to decrypt.

DES Key only allows passwords 8 characters long. If you try to use a password longer than 8 chars, only first 8 bytes will be considered. If password is less than 8 bytes, password is filled automatically.
Copy
<script>
    var des = new Ax.crypt.TripleDES();
     new Ax.crypt.TripleDES("DESede/ECB/NoPadding")

    var password = "mypasswo";
    var message_source  = "Secret Message";

    var message_secret  = des.encrypt(password, message_source);
    var message_decoded = des.decrypt(password, message_secret);
    
    console.log("source :" + message_source);
    console.log("secret :" + message_secret);
    console.log("decoded:" + message_decoded);
</script>
source :Secret Message
secret :9e184eaf00489db18156be57bc21ca9e
decoded:Secret Message