Aşağıdaki kod, bir dizeyi BlowFish şifrelemesiyle şifrelemem için iyi çalışıyor.Java'da BlowFish ile Şifreleme
// create a key generator based upon the Blowfish cipher
KeyGenerator keygenerator = KeyGenerator.getInstance("Blowfish");
// create a key
SecretKey secretkey = keygenerator.generateKey();
// create a cipher based upon Blowfish
Cipher cipher = Cipher.getInstance("Blowfish");
// initialise cipher to with secret key
cipher.init(Cipher.ENCRYPT_MODE, secretkey);
// get the text to encrypt
String inputText = "MyTextToEncrypt";
// encrypt message
byte[] encrypted = cipher.doFinal(inputText.getBytes());
Kendi gizli anahtarımı tanımlamak istiyorsam, bunu nasıl yaparım?
Teşekkür Hızlı bir yanıt çok! – StefanE
@Erik ayrıca http://stackoverflow.com/questions/38007478/encrypt-and-decrypt-string-using-chacha20 – Nepster
sorusuna da bakın. Bu çözüm, bir String'i doğrudan şifreleme anahtarı olarak kullandığı için güvensizdir. – Robert