"text_in.txt"라는 Java 텍스트 파일이 있습니다.
IDESOFMARCH
길이가 11자인 경우이 파일의 길이를 찾고 H 끝에 'X'문자를 추가하여 텍스트가 각각 RSA 암호화에 사용되는 2 개의 문자 블록으로 나눌 수 있도록 어떻게해야합니까? / 복호화.
예: ID ES OF MA RC HX
내 rsa.java 파일 (파일, 개인, 공개 키)에서 encrypt 메소드를 호출하는 main ()이 있습니다.
code.encrypt(files, 17, 2773);
파일에는 "text_in.txt"및 "text_out.txt"와 두 파일을 모두 여는 부울 true가 포함됩니다.
주요 내용은 다음과 같습니다.
public void encrypt(FileInOut files, int e, int n) {
//Get the in file length and add a 'X' if uneven character blocks
if((files.length() % 2) == 1)
files.write("X");
//Print a 0 in the encrypted file to represent the end of a line
if(files != char)
files.write("0");
Java에서 일반 텍스트 파일 읽기에서 답을 빌리기
String str = new String(Files.readAllBytes(Paths.get("text_in.txt")));
int len = str.length();
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다