Leaky Bucket and Data Encryption
Leaky Bucket and Data Encryption
Encryption is a way of scrambling data so that only authorized parties can understand the information. In
technical terms, it is the process of converting plaintext to ciphertext.
Encryption and decryption requires the use of a cryptographic key: a set of mathematical values that both
the sender and the recipient of an encrypted message agree on.
The Caesar Cipher technique is one of the earliest and simplest method of encryption technique. It’s simply
a type of substitution cipher, i.e., each letter of a given text is replaced by a letter some fixed number of
positions down the alphabet. For example with a shift of 1, A would be replaced by B, B would become C,
and so on. The method is apparently named after Julius Caesar, who apparently used it to communicate with
his officials.
Thus to cipher a given text we need an integer value, known as shift which indicates the number of position
each letter of the text has been moved down
Algorithm:
Program take
Program
#include <stdio.h>
#include<string.h>
#include <ctype.h>
int main()
{
int i, x;
char str[100];
printf("\nPlease choose following options:\n");
printf("1 = Encrypt the string.\n");
printf("2 = Decrypt the string.\n");
scanf("%d", &x);
case 2:
Description:
Traffic Shaping is a mechanism to control the amount and the rate of the traffic sent to the network. This
approach of congestion management is called Traffic shaping. Traffic shaping helps to regulate rate of data
transmission and reduces congestion..
There are 2 types of traffic shaping algorithms:
1. Leaky Bucket
2. Token Bucket
In networking, a technique called leaky bucket can smooth out bursty traffic. Bursty chunks are stored in the
bucket and sent out at an average rate.
Algorithm:
1. Start
2. Set the bucket size or the buffer size.
3. Set the output rate.
4. Transmit the packets such that there is no overflow.
5. Repeat the process of transmission until all packets are transmitted. (Reject packets where its size
is greater than the bucket size)
6. Stop
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#define NOF_PACKETS 10
int rand(int a)
{
int rn = (random() % 10) % a;
return rn == 0 ? 1 : rn;
}
int main()
{
int packet_sz[NOF_PACKETS], i, clk, b_size, o_rate, p_sz_rm=0, p_sz, p_time, op;
for(i = 0; i<NOF_PACKETS; ++i)
packet_sz[i] = rand(6) * 10;
for(i = 0; i<NOF_PACKETS; ++i)
printf("\npacket[%d]:%d bytes\t", i, packet_sz[i]);
printf("\nEnter the Output rate:");
scanf("%d", &o_rate);
printf("Enter the Bucket Size:");
scanf("%d", &b_size);
Incoming packet size (50bytes) is Greater than bucket capacity (30bytes)-PACKET REJECTED
Incoming packet size (50bytes) is Greater than bucket capacity (30bytes)-PACKET REJECTED