Rail Fence Cipher Program in C and C++[Encryption & Decryption]

Here you will get rail fence cipher program in C and C++ for encryption and decryption.

It is a kind of transposition cipher which is also known as zigzag cipher. Below is an example.

Rail Fence Cipher Example

Here Key = 3. For encryption we write the message diagonally in zigzag form in a matrix having total rows = key and total columns = message length. Then read the matrix row wise horizontally to get encrypted message.

Rail Fence Cipher Program in C

Output

Original Message: Hello World
Encrypted Message: Horel ollWd
Decrypted Message: Hello World

Rail Fence Cipher Program in C++

Comment below if you have queries related to above rail fence cipher program in C and C++.

One thought on “Rail Fence Cipher Program in C and C++[Encryption & Decryption]

  1. Ashokkumar

    You are done it only for specific input-“Hello World”..but I have to perform encryption and decryption on whatever the user gives as input..please share the program to do the same as soon as possible..thanks in advance!!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.