Wednesday, March 21, 2012

[C#] ECB (Electronic Code Book)

          Hello, Reader ^^! Back again with source code. This time is is ECB (Electronic Code Book) which is made using C# programming language. There was a problem making it when facing the Unicode conversion to Binary and vice versa, but finally, it is solved :3. Now, 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... In this example, the Encryption Block used is a simple xor. You can define your own Encryption Block. Now, let's me demonstrate a bit:

plain text (in bit) : 0101111111010101
key : 01101
Encryption Block = a xor b

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)01011111110101010000
Key per block01011010110101101011
Encryption Block  (a xor b; a is Plaintext, b is key)00000101000000111011


The result of encryption is 00000101000000111011

Okay, that's all I can say. Thank you for reading ^^!


Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
GitHub (Repository)





4 comments: