***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Posts

    Latest Updates

    Wednesday, May 3, 2023

    RSA Algorithm

    The RSA algorithm is an asymmetric cryptography algorithm; this means that it uses a public key and a private key.

    The RSA algorithm is named after those who invented it in 1978: Ron Rivest, Adi Shamir, and Leonard Adleman.


    The following steps highlight how it works:

    1. Generating the keys

    1. Select two large prime numbers, x and y. The prime numbers need to be large so that they will be difficult for someone to figure out.
    2. Calculate n = x x y.
    3. Calculate the totient function: ϕ(n) = (x−1)(y−1).
    4. Select an integer e, such that e is co-prime to ϕ(n) and 1< e < ϕ(n). The pair of numbers (n,e) makes up the public key.
    1. Calculate d such that e.d=1 mod ϕ(n). The pair (n,d) makes up the private key.

    2. Encryption

    Given a plaintext P, represented as a number, the ciphertext C is calculated as:

    C=Pe mod n.

    3. Decryption

    Using the private key (n,d), the plaintext can be found using:

    P=Cd mod n.

    RSA Algorithm Example

    • Choose p = 3 and q = 11
    • Compute n = p * q = 3 * 11 = 33
    • Compute φ(n) = (p - 1) * (q - 1) = 2 * 10 = 20
    • Choose e such that 1 < e < φ(n) and e and φ (n) are coprime. Let e = 7
    • Compute a value for d such that (d * e) % φ(n) = 1.

    One solution is d = 3    since [(3 * 7) % 20 = 1]

    • Public key is (e, n) => (7, 33)
    • Private key is (d, n) => (3, 33)
    • The encryption of P = 2 is C = 27 % 33 = 29
    • The decryption of C = 29 is P = 293 % 33 = 2

    Advanced Encryption Standard algorithm

    The AES algorithm (also known as the Rijndael algorithm) is a symmetrical block cipher algorithm that takes plain text in blocks of 128 bits and converts them to ciphertext using keys of 128, 192, and 256 bits. Since the AES algorithm is considered secure, it is in the worldwide standard.


    The AES algorithm uses a substitution-permutation, or SP network, with multiple rounds to produce ciphertext.

    The number of rounds depends on the key size being used.

    A 128-bit key size dictates ten rounds, a 192-bit key size dictates 12 rounds, and a 256-bit key size has 14 rounds.

    Each of these rounds requires a round key, but since only one key is inputted into the algorithm, this key needs to be expanded to get keys for each round, including round 0.

    Steps in each round

    Each round in the algorithm consists of four steps.

    1. Substitution of the bytes
    In the first step, the bytes of the block text are substituted based on rules dictated by predefined S-boxes (short for substitution boxes).

    2. Shifting the rows
    Next comes the permutation step. In this step, all rows except the first are shifted by one.

    3. Mixing the columns
    In the third step, the Hill cipher is used to jumble up the message more by mixing the block’s columns.

    4. Adding the round key

    In the final step, the message is XORed with the respective round key.


    When done repeatedly, these steps ensure that the final ciphertext is secure.

    Applications of AES:

    Wireless networks are secured using the Advanced Encryption Standard to authenticate routers and clients.

    AES plays a huge role in securing website server authentication from both client and server end. With both symmetric and asymmetric encryption being used, this algorithm helps in SSL/TLS encryption protocols to always browse with the utmost security and privacy.

    AES is also used to transfer files between associates in an encrypted format. The encrypted information can extend to chat messages, family pictures, legal documents, etc.


    DES(Data Encryption Standard) Algorithm

    The DES algorithm takes the plain text of 64-bit as input & produces a ciphertext of 64-bit using a key of 56 bits. Initially, a 64-bit key length is used but an 8-bit is discarded.

    The (DES) Data Encryption Standard Algorithm was developed by the IBM team in the 1970s.

    The National Institute of Standards and Technology (NIST) later adopted this algorithm.

    The DES encryption algorithm uses symmetric keys, which means that the same key is used for encrypting and decrypting the data.

    DES Algorithm Steps

    • The initial permutation (IP) function receives the 64-bit plaintext block.
    • The IP is performed on plaintext.
    • The IP then makes two halves of the block that has been permutated. The two halves are known as left plan text (LPT) and right text (RPT).
    • All LPTs and RPTs are encrypted 16 times.
    • The LPT and RPT are joined, and then the final permutation (FP) is performed on this block.
    • The 64-bit ciphertext is now ready.

    In the encryption process (step 4), there are five stages:

    • Key transformation
    • Expansion permutation
    • S-Box permutation
    • P-Box permutation
    • XOR, and swap

    In the decryption process, the same algorithm is used with the order of the 16 keys reversed.

    The DES algorithm is used whenever a not-very-strong encryption is needed. It can be used in random number generators or even as a permutation generator.

    One of the most important practical applications of the DES algorithm is to create triple DES legacy systems with three keys.

    Network session analysis

    Network session analysis Network session analysis is a method of monitoring network activity and availability to identify issues, such as ...