Simplest way to encrypt a text file in java

前端 未结 11 1516
萌比男神i
萌比男神i 2020-11-30 01:18

For my School project I had to show that I can utilize file handling within a program. For this I made a very simple login process that you can create an account on that wri

11条回答
  •  生来不讨喜
    2020-11-30 02:04

    A very basic method would be to xor the data with a key. This method is symmetrical, i.e you can use the same key to decode as encode.

    If we choose a 1 byte key it's nice and simple, enough to make it unreadable (but not at all secure!):

    private void encodeDecode(byte[] bytes, byte key) {
        for(int i=0; i

提交回复
热议问题