Hello, Reader ^^! Back again with source code. This time is is ECB (Electronic Code Book) which is made using Ruby programming language. Let me explain it again like the C++ before. Encryption using ECB is separating plaintext bit into blocks (key). After that, each block each encrypted with the block key. When the plaintext's length is not divideable by the key's length, pad it with all 0s or all 1s or 101010... Now, let's me demonstrate a bit:
plain text (in bit) : 0101111111010101
key : 01101
Now, splitting them into 5 blocks (based on key's length): 01011|11111|01010|1
The last part length is not 5, so let's padding it with 0 bits : 10000
Plaintext(in bits) | 01011 | 11111 | 01010 | 10000 |
Key per block | 01011 | 01011 | 01011 | 01011 |
Xor-ed | 00000 | 10100 | 00001 | 11011 |
The result of encryption is 00000101000000111011
Okay, that's all I can say. Thank you for reading ^^!
No comments:
Post a Comment