Home > Mobile >  Lua remote code how to implement the external file encryption?
Lua remote code how to implement the external file encryption?

Time:09-23

Application of remote code how to realize the external file encryption external files

CodePudding user response:

refer to the original poster weixin_44165171 response:
how remote code is applied to implement the external file encryption external files



Define your own & lt;/span>;

import java.io.File;
Import the Java. IO. RandomAccessFile;
import java.util.Scanner;

Public class Test1 {
Public static void main (String [] args) {
System. The out. Println (" input file path: ");
String s=new Scanner (System.) in nextLine ();
The File f=new File (s);
if(! F.i sFile ()) {
System. The out. Println (" please enter the correct path to the file ");
return ;

}
System. The out. Println (" KEY: ");
Int key=new Scanner (System.) in nextInt ();
Try {
Encrypt (f, key);
System. The out. Println (" encryption/decryption complete ");
} the catch (Exception e) {
System. The out. Println (" encryption/decryption failure ");
e.printStackTrace();
}
}

Private static void encrypt (File f, int key) throws the Exception {
/*
* 1. New RandomAccessFile object is assigned to the raf
* 2. Single byte read cycle, read the byte value is assigned to b
* 3. B or different key, the result in the assigned to b
* 4. Locate the subscript seek back to the previous position (raf) getFilePointer () - 1)
* 5. The byte value b written back to the file
* 6. Close the raf
This can't use?

CodePudding user response:

reference 1st floor weixin_44165171 response:
Quote: refer to the original poster weixin_44165171 response:
how remote code is applied to implement the external file encryption external files



Define your own & lt;/span>;

import java.io.File;
Import the Java. IO. RandomAccessFile;
import java.util.Scanner;

Public class Test1 {
Public static void main (String [] args) {
System. The out. Println (" input file path: ");
String s=new Scanner (System.) in nextLine ();
The File f=new File (s);
if(! F.i sFile ()) {
System. The out. Println (" please enter the correct path to the file ");
return ;

}
System. The out. Println (" KEY: ");
Int key=new Scanner (System.) in nextInt ();
Try {
Encrypt (f, key);
System. The out. Println (" encryption/decryption complete ");
} the catch (Exception e) {
System. The out. Println (" encryption/decryption failure ");
e.printStackTrace();
}
}

Private static void encrypt (File f, int key) throws the Exception {
/*
* 1. New RandomAccessFile object is assigned to the raf
* 2. Single byte read cycle, read the byte value is assigned to b
* 3. B or different key, the result in the assigned to b
* 4. Locate the subscript seek back to the previous position (raf) getFilePointer () - 1)
* 5. The byte value b written back to the file
* 6. Close the raf
This can't use?

Look at the, also don't know??????
  • Related