Submitted by AutoModerator t3_ywvph3 in askscience
Stevetrov t1_iwmsua6 wrote
Reply to comment by PieMastaSam in Ask Anything Wednesday - Engineering, Mathematics, Computer Science by AutoModerator
I will describe streaming encryption with AES because that's easiest. To be clear AES is not a secure hash function, it's a symmetrical encryption algorithm.
Just think of aes as a black box that does the following
- takes a key (128, 192, 256 bits long) basically a huge massive number. There are so many possible keys that all the computers in the world wouldn't be enough to try them all ... not even close.
- from this key the box outputs a key stream of one's and zeros that is different for each key.
- the key stream that comes out of the box appears completely random, has no structure and doesn't repeat.
- two key streams of two related keys are not related.
To encrypt your data, XOR* each bit of the data with each bit of the key steam. The the result is your encrypted data.
To decrypt the data you do exactly the same you did to encrypt, use the same key and your original data is recovered.
*XOR (exclusive OR) takes two binary inputs and returns 1 if the two inputs are different, it returns 0 if they are the same.
Viewing a single comment thread. View all comments