You are browsing as a guest. Sign up (or log in) to start making projects!

2h 20m 12s logged

spent about an hour writing the process of setting up plaintext for AES, but then as i tested it, i realized i hadn’t accounted for all edge cases and hadn’t written very efficient or elegant code so I decided to take a step back, write out the process on paper, and then rewrite the methods. Here’s that:

plaintext (string) -> binary equivalent with space between each byte (string) -> add trailing zeros to binary string to make the number of bits divisible by 128 to make full blocks without errors -> create an array of each byte in the binary equivalent string (string[]) -> create an array of 128 bit (4x4 byte) blocks, organizing the bytes from the previous string[] in column-major order into each block (string[][][])

having it clearly written out and having already experimented with it, i was able to write cleaner code by writing a method for each step of this process, each taking the lasts output as input, and then writing a final method which executes each of these methods in the correct order, turning plain text into the necessary blocks of binary data. I have attached this method below as I figure the rest of the code is too long to show and this project doesn’t really have any cool graphics to showcase yet.

next, i have to figure out how to generate salts and write a key generation function. alternatively, i could also take a break from the encryption/decryption aspect of this project and figure out the file management system, since i’ve never worked with that before, or i could also get started on the ui.

0
12

Comments 0

No comments yet. Be the first!