RUVIDEO
Поделитесь видео 🙏

How to Encrypt and Decrypt Data In Java Using DES Algorithm

//How to Encrypt and Decrypt Data In Java Using DES Algorithm


Here are the general steps to encrypt/decrypt a file in Java:

Create a Key from a given byte array for a given algorithm.

Get an instance of Cipher class for a given algorithm transformation. See document of the Cipher class for more information regarding supported algorithms and transformations.

Initialize the Cipher with an appropriate mode (encrypt or decrypt) and the given Key.

Invoke doFinal(input_bytes) method of the Cipher class to perform encryption or decryption on the input_bytes, which returns an encrypted or decrypted byte array.

Read an input file to a byte array and write the encrypted/decrypted byte array to an output file accordingly.

Now, let’s see some real examples.

=============================================================
import java.io.*;
import javax.crypto.*;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
class Desal
{
public static void main(String []s)
{

try
{
String st="Hello";
System.out.println("Real String : "+ st);

byte str[]=st.getBytes();
Cipher c=Cipher.getInstance("DES");
KeyGenerator kg=KeyGenerator.getInstance("DES");
SecretKey sk=kg.generateKey();

//ENCRYPT_MODE
c.init(Cipher.ENCRYPT_MODE,sk);
byte ct[]=c.doFinal(str);
System.out.println("ENCRYPT_MODE DATA : "+ new String(ct));


//DECRYPT_MODE
c.init(Cipher.DECRYPT_MODE,sk);
byte ct1[]=c.doFinal(ct);
System.out.println("DECRYPT_MODE DATA : "+ new String(ct1));

}
catch(Exception e)
{
System.out.println(e);
}
}
}

==============================================
encryption and decryption in java example,
string encryption and decryption in java,
password encryption and decryption in java,
java code to encrypt and decrypt a string,
java code for encryption and decryption of files,
simple encryption and decryption in java,
encryption and decryption in java source code,
encryption and decryption in java example md5

www.patelwala.com
www.readranks.com

-~-~~-~~~-~~-~-
Please watch: "How to online money earn from Flipkart without selling any products"
https://www.youtube.com/watch?v=AkhdfQPCj0o
-~-~~-~~~-~~-~-

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «How to Encrypt and Decrypt Data In Java Using DES Algorithm», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.