Introduction to the Cryptography and its Functions
Cryptography is the technique of securing information and communication by using codes to
ensure that only authorized individuals can access and understand the data. It plays a crucial
role in maintaining privacy, guaranteeing secrecy, and protecting data from unauthorised
access.
The main function of cryptography is to provide confidentiality, integrity, authentication, and
non-repudiation of data. Let's explore these functions in more detail:
   1. Confidentiality: Cryptography ensures the confidentiality of data by encrypting it.
      Encryption converts the original data into an unreadable format, and only those who
      possess the decryption key can decipher and access the information. This prevents
      unauthorised parties from understanding the contents of the message.
   2. Integrity: Cryptography helps in maintaining the integrity of data by providing
      mechanisms to detect any unauthorised modifications or tampering. Hash functions
      are commonly used to generate a unique fixed-size string of data, known as a hash
      value. By comparing this value before and after transmission, one can verify the
      integrity of the data.
   3. Authentication: Cryptography facilitates authentication, which ensures that the
      communicating parties are who they claim to be. Techniques like digital signatures
      and certificates allow for the verification of the sender's identity and the integrity of
      the transmitted data.
   4. Non-repudiation: Cryptography helps establish non-repudiation, which means that a
      sender cannot deny sending a message or performing a specific action. Digital
      signatures serve as evidence of the authenticity of a message, preventing the sender
      from denying their involvement.
Overall, cryptography is employed to safeguard sensitive information, protect online
transactions, secure communication channels, and ensure the trustworthiness of digital
systems.
Steganography
                                               1
Steganography is the practice of hiding information within another message or object to
avoid detection. It can be used to hide any type of digital content, including Text, Images,
Videos, Audio, and Network traffic.
The hidden data is then extracted at its destination. Steganography can be used along with
cryptography as an extra-secure method to protect data.
Some types of steganography include:
      Text steganography: Conceals a secret message inside a piece of text
      Image steganography: Encodes secret information within a digital image
      Audio steganography: Hides a secret message into the audio
      Video steganography: Secretly embeds data or other files within a video file
Some techniques used in steganography include:
      Backmasking: Hides a message in the audio file that can only be heard when played
       backwards
      Watermarking: Encrypts one piece of data (the message) within another (the "carrier")
      Least Significant Bit (LSB) technique: Conceals data by altering the last few bits in a
       byte required to encode a message
The reverse process of steganography is called steganalysis. Steganalysis aims to determine
whether a file contains a secret message and if so, what the hidden information is.
Encryption & Decryption
Encryption is the process of converting readable data into an unreadable form. Decryption is
the process of converting encrypted data back to its original readable format. The science of
encrypting and decrypting information is called cryptography.
Encryption
      Plaintext: The original representation of the data
      Ciphertext: The alternate representation of the data
      Encryption systems:
           o   Advanced Encryption Standard (AES)
           o   Triple DES
           o   Blowfish
           o   Rivest-Shamir-Adleman (RSA)
Decryption
      Reverse encryption process: Use the same algorithm, key, or password
      Asymmetric encryption: Uses two keys: a public key for encryption and a private key
       for decryption
      Symmetric encryption: Uses one key for both encryption and decryption.
                                               2
Encryption is the process of converting normal data into ciphertext to protect it, while decryption
is the process of converting the ciphertext back into its original plaintext form. Together, they
form the basis of secure communication and data protection in cryptography.
Symmetric key Cryptography and Asymmetric key
Cryptography
      Symmetric Key Encryption                         Asymmetric Key Encryption
                                                     It requires two keys, a public key and a
    It only requires a single key for both
                                                        private key, one to encrypt and the
         encryption and decryption.
                                                               other one to decrypt.
    The size of cipher text is the same or            The size of cipher text is the same or
     smaller than the original plain text.             larger than the original plain text.
     The encryption process is very fast.                The encryption process is slow.
  It is used when a large amount of data is           It is used to transfer small amounts of
             required to transfer.                                      data.
                                                     It provides confidentiality, authenticity,
       It only provides confidentiality.
                                                               and non-repudiation.
                                                       The length of key used is 2048 or
  The length of key used is 128 or 256 bits
                                                                    higher
   In symmetric key encryption, resource
                                                     In asymmetric key encryption, resource
      utilization is low as compared to
                                                              utilization is high.
         asymmetric key encryption.
   It is efficient as it is used for handling         It is comparatively less efficient as it
             large amount of data.                     can handle a small amount of data.
   Security is less as only one key is used          It is more secure as two keys are used
     for both encryption and decryption              here- one for encryption and the other
                   purpose.                                      for decryption.
   The Mathematical Representation is as             The Mathematical Representation is as
                follows-                                          follows-
           P = D (K, E(K, P))                                P = D(Kd, E (Ke,P))
                                                 3
       Symmetric Key Encryption                       Asymmetric Key Encryption
  where K –> encryption and decryption                   where Ke –> encryption key
                  key                                      Kd –> decryption key
             P –> plain text                                 D –> Decryption
            D –> Decryption                         E(Ke, P) –> Encryption of plain text
 E(K, P) –> Encryption of plain text using          using encryption key Ke. P –> plain
                    K                                               text
                                                     Examples: Diffie-Hellman, ECC, El
   Examples: 3DES, AES, DES and RC4
                                                          Gamal, DSA and RSA
Symmetric key cryptography and asymmetric key cryptography are both encryption
schemes. Symmetric key cryptography uses a single key for both encryption and
decryption. Asymmetric key cryptography uses a public-private key pair, where one key
encrypts and the other decrypts.
Symmetric key cryptography is more efficient and faster than asymmetric key
cryptography. It's often used for encrypting large amounts of data, such as in databases. It's
also been used in the past for secret communication between governments and militaries.
Symmetric key cryptography is used for:
    Secret communication: In the past, governments and militaries used symmetric key
     cryptography for secret communication.
    Data security: Symmetric key algorithms are used in computer systems to enhance
     data security.
    Bulk data encryption: Symmetric algorithms are well suited for encrypting large
     amounts of data.
Asymmetric key cryptography is used for:
      Digital signatures: To authenticate data
      Key exchange: To exchange encryption keys
      Email security: To secure emails
      Web security: To secure websites
      TLS/SSL handshake: To verify website server authenticity
                                               4
Advantages and Disadvantages of Symmetric
Encryption in Cryptography
 Pros                                             Cons
 Fast Symmetric encryption is fast &              Key must be kept secret The key must be
 efficient for large amounts of data.             kept secret, which can be challenging when
                                                  encryption and decryption take place in
                                                  different locations
 Easy to understand Symmetric encryption is
 simple and easy to understand.
 Secure symmetric encryption is essentially       The receiver must get the key, the receiver
 unbreakable.                                     must get the secret key from the sender.
 Low resource usage symmetric encryption          Can’t create digital signature it is not
 requires low computer resources.                 possible to create digital signatures that
                                                  cannot be revoked.
Symmetric encryption uses the same key to encrypt and decrypt data. The key is a secret
value that both the sender and the receiver must know and keep safe.
There are two basic types of symmetric encryption:
       Stream: Encrypts messages a character at a time.
       Block: Breaks messages up into known-sized pieces.
                                              5
Advantages and Disadvantages of Asymmetric
Encryption in Cryptography
 Advantages                                           Disadvantages
 Secure key exchange: parties can use each            Slower than the symmetric encryption.
 other’s public keys to encrypt & share their
 symmetric keys.
 No need to exchange keys: Eliminates the             More Complex: not the best solution for
 need to exchange secret keys.                        bulk encryption.
 Increased security: Private keys don’t need          More-resource-intensive: requires lager key
 to be transmitted or revealed to anyone.             sizes.
                                                      No way to retrieve lost private keys: if the
                                                      private key is lost, there is no way to
                                                      retrieve it.
Commonly used Cryptographic Algorithms: DES / RSA
DES ( Data Encryption Standard)
The Data Encryption Standard (DES) is a symmetric-key algorithm that encrypts data. It was
developed by IBM in the 1970s and accepted by the National Institute of Standards and
Technology (NSIT).
Here are some key points about DES:
      Block cipher: DES is a block cipher that encrypts data in 64-bit blocks.
      Key length: DES uses a 56-bit key.
      Encryption and decryption: DES uses the same key for encryption and decryption.
      Block size: DES converts a plaintext bit of fixed length into a ciphertext bit string,
       keeping its length unchanged.
      Initial permutation: This step rearranges bits in a predefined way to make passing data
       into encryption machines easier.
      Properties: DES satisfies two properties that make it a strong cipher:
           o   Avalanche effect: A small change in plaintext results in a large change in the ciphertext.
           o   Completeness: Each bit of ciphertext depends on many bits of plaintext.
                                                  6
DES was once the go-to algorithm for encrypting electronic data, but it has been superseded
by the more secure Advanced Encryption Standard (AES) algorithm.
RSA (                                               )
The RSA algorithm is a public-key encryption technique that uses two keys: one public and
one private. The algorithm was developed by Ron Rivest, Adi Shamir, and Leonard
Adleman. Their paper was published in 1977.
Here are some key points about the RSA algorithm:
   Steps: The algorithm involves four steps: key generation, key distribution, encryption, and
    decryption.
   Security: RSA is considered a secure way of encryption. It's safe for exchanging data over the
    internet and maintains data confidentiality.
   Key length: RSA can work with keys of different lengths, including 1024, 2048, 3072, 4096, 8129,
    and 16384 bits. Longer keys provide higher security but consume more computing time.
   Use: RSA allows you to secure messages before sending them and certify notes so recipients know
    they haven't been altered.
Hybrid Encryption in Cryptography
                                                    7
In cryptography, hybrid encryption is a method that combines the efficiency of
symmetric-key encryption with the convenience of public-key encryption. Hybrid
encryption is used to encrypt large amounts of data to a public key.
Hybrid encryption works by:
      Exchanging a symmetric key: Using asymmetric encryption to exchange a symmetric
       key between the sender and receiver
      Encrypting and decrypting data: Using symmetric encryption to encrypt and decrypt
       the data
Hybrid encryption achieves both speed and security while avoiding the problems
of key distribution and management.
Hybrid encryption aims to produce a more secure, better performance, and robust
algorithm than applying basic ciphers individually.
Electronic Signature
A digital signature in cryptography is a cryptographic output that verifies the
authenticity of data. It's a value calculated from data and a secret key that only the
signer knows.
Digital signatures have the following properties:
      Unforgeable
      Authentic
      Can't be modified once sent
      Not reusable
      Prevent repudiation
Digital signatures are important in businesses because they can help ensure that the
message belongs to the sender. However, they are not foolproof. They can be
compromised if the signer's private key is stolen or the certificate authority that
issued the digital certificate is untrustworthy.
Electronic signatures can take different forms, including:
      Typing your name
      Drawing your signature with a mouse or stylus
    Scanning your handwritten signature
The three types of electronic signatures are:
      Simple e-signatures (SESs)
      Advanced e-signatures (AdESs)
      Qualified e-signatures (QESs)
                                            8
Comparison between Electronic Signature and Digital
Signature
In cryptography, an electronic signature is a broad term for any electronic process that
indicates acceptance of a record or agreement. A digital signature is a more secure electronic
signature that is generated using a digital certificate.
Here's some more information about electronic signatures and digital signatures:
   Electronic signatures
    Also known as e-signatures, these are the digital version of paper-based signatures. They
    are used to sign electronic documents, such as contracts. Electronic signatures are
    simpler and more accessible than digital signatures. However, they are less secure and
    more vulnerable to tampering.
   Digital signatures
    These are encrypted, electronic stamps of authentication on digital information. They are
    used to protect documents and secure them with encryption standards. Digital signatures
    are more secure than electronic signatures and provide a higher level of assurance that
    the signature is genuine.