Answer the question
In order to leave comments, you need to log in
How long should string be for a key that is used in Java's built-in DES?
Cipher DES = Cipher.getInstance("DES");
byte[] decodedKey1 = java.util.Base64.getDecoder().decode(key);
SecretKey originalKey1 = new SecretKeySpec(decodedKey1, 0, decodedKey1.length, "DES");
DES.init(Cipher.ENCRYPT_MODE, originalKey1);
byte[] line = input.getBytes("UTF-8");
byte[] encryptedDes = DES.doFinal(line);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question