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.
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.
DESKey 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.
<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>