Cryptosystems – Dictionary Attack ”; Previous Next What is Dictionary Attack? A dictionary attack occurs when someone tries multiple words from a list such as a dictionary to guess the password. They try different words until they find the right one. It”s like trying to open a lock by trying multiple keys until one works. In other words, a dictionary attack is a type of malicious attack in which hackers who try to guess the password of their online user account by typing common combinations of words, phrases and numbers, can get access to things like social media profiles, even password protected files etc. This is when an attacker can be a real problem for the victim. How does dictionary attack work? This hacking uses a systematic method to crack passwords. Basically, there are three steps to mastering these hacks and understanding them can help in learning how to prevent dictionary attacks − Typically, an attacker will create a custom list of password options-a brute force dictionary-that specifies popular combinations of words and numbers Automated software then uses this brute-force dictionary to try to access online accounts. If a dictionary attack successfully penetrates a vulnerable account, the hacker uses any sensitive data stored in the profile to create his own access. This could be fraud, acting in bad faith, or simply accessing an account to make money. To gather the potential passwords, an attacker will typically use the names of common pets, recognizable pop culture figures, or athletes from major leagues, for example the, because many people use words that make sense to them and they create passwords that are easy to remember. Often, variations of these will be included in the list, such as different combinations of words or the addition of special characters. Building this list with automated tools also makes dictionary attacks easier to succeed. Using a password list and collaboration tools makes it much faster than trying to crack a password and log into an online account. If this were done manually, the attack would take much longer to give the account owner or system administrator time to notice and implement protection against the attack. Because of the methodology, these dictionary attacks rarely have any individual targets. Instead, they work in the hope that one of the passwords on the list will be correct. However, if the attacker is targeting a specific location or organization, a more focused and localized list of terms will be produced. For example, if they plan to invade Spain, they can use standard Spanish words instead of English. Or, if they are targeting a specific organization, they can use words associated with that company. Dictionary Attack vs Brute Force While a dictionary attack is a form of brutal attack, there is an important difference between the two. Whereas dictionary attacks use a fixed set of words to systematically break down a mathematical word, brute force hacks do not use letters but rather, any combination of letters, symbols, and numbers that they are not intentionally passable so that dictionary attacks are often more effective-and more likely to succeed. Since they have far fewer combinations to test. With 26 letters in the alphabet and 10 single numbers 36 digits in all the number of possible combinations for a successful brute force attack is almost impractical. According to the context, a brutal attack on a 10-character input would be in 3.76 squares of possible alphanumeric password runs. However, the advantage of brute force attacks is that their trial and error method often cracks complex and unique passwords because they use such a complete list of possible passwords, so eventually that attack will have the appropriate character combination for a password. How to prevent Dictionary Attacks To prevent dictionary attacks you can − Use Strong and Unique Passwords − Choose passwords that are hard for others to guess, don’t let common words appear in dictionaries. Avoid Easy Passwords − Unexpectedly many people use simple, easy-to-hack word and number combinations as passwords, like “Password123” or “abcd1234”. These are the most vulnerable to hacking since dictionary attacks are specifically designed to crack easy-to-guess passwords. Enable Multi Factor Authentication − This adds an extra layer of security by requiring an additional method of authentication along with your password, such as a code sent to your phone. Limit Login Attempts − Some systems can block or slow down repeated logins after a certain number of failed attempts, making it harder for attackers to guess passwords. Use Account Lockout Policy − Automatically lock out user accounts after multiple unsuccessful login attempts, preventing further review. Update Passwords Regularly − Change your passwords periodically to reduce the chances of long-term guessing. Check for Suspicious Activity − Watch for any unusual login attempts or actions on your accounts and investigate immediately. Forced reset − Dictionary hacking usually relies on repeated attempts to crack a password. Reduce the chances of a successful attack by forcing the password to be reset after a certain number of failed attempts. If this is not an option you can work with on your accounts, you can make it manual by enabling online accounts to send you an email in the event of a failed login attempt, if you are notified if someone is trying to access an account, especially if you receive these notifications in rapid succession You can change the password to ensure it remains secure. Summary Dictionary attacks are a way for hackers to guess a password by trying many words from a list such as a dictionary, until they find the right one. This attack is based on words, phrases, or characters as it is usually used by people as a password. Organizations and individuals can implement several preventive measures to defend against dictionary attacks, such as using strong unique passwords, enabling multi factor authentication, effort to limit access, implement account lockout procedures, regular password updates, monitor suspicious activity, enforce passwords -Enforcement is also configured after a certain amount unsuccessful attempts
Category: cryptography
Cryptography – Polyalphabetic Cipher ”; Previous Next Polyalphabetic ciphers use multiple alphabets to substitute letters, determining the encryption based on the letter”s position in the text. Unlike basic ciphers, polyalphabetic ciphers create a one-to-many relationship, where each letter has several possible encryptions. The Alberti Cipher, invented in 1467, is the earliest known polyalphabetic cipher. It utilizes a series of random alphabets for encryption, signified by uppercase letters in the ciphertext that indicate switches between alphabets. It can use this cipher, and Alberti used a cipher disc to show how plaintext letters are connected with ciphertext letters. In this cipher, each ciphertext character is determined by both the plaintext character and its place in the message. As the name suggests, polyalphabetic means using numerous keys rather than just one. This means that the key should be a stream of subkeys, with each subkey depending on the position of the plaintext character that requires the subkey for encipherment. How it works? It is required to have a key stream k = (K1, K2, K3,. . .) in which Ki is used to encipher the ith character in the plaintext and make the ith character in the encrypted text. Vigenere cipher is the most well-known and simple among these algorithms. The Vigenere cipher is one of the most simple and widely used polyalphabetic ciphers. In this method, the alphabetic text is encrypted with a series of Caesar ciphers depending on the letters of a keyword. The Caesar cipher restores each letter in the plaintext, keeping the letters in a constant position to the right in alphabet. This shift is implemented modulo 26. For example, in a Caesar cipher with shift 3, A can become D, B can become E, and so on. The Vigenere cipher consists of a series of simple substitution ciphers with various shift values. This cipher repeats the keyword right before it joins with the plaintext”s duration. Encryption is performed by going to the row in the table corresponding to the key and determining the column heading of the corresponding letter of the plaintext character; the letter at the intersection of the corresponding row and column of the Vigenere Square generates the ciphertext character. The remaining plaintext is encrypted using a similar approach. Features These approaches share the following common features − A set of related monoalphabetic substitution rules is applied. A key determines the rule used for a transformation. Example For example, ”a” can be encoded as ”d” in the beginning of the text but as ”n” in the middle. The polyalphabetic ciphers have the advantage of concealing the letter frequency of the fundamental language. As a result, the attacker cannot divide the ciphertext using static individual letter frequencies. Names of Polyalphabetic Cipher Polyalphabetic ciphers are a form of encryption process in which different letters are replaced in unique ways, making them harder to crack. Below are some examples of polyalphabetic ciphers − Vigenere Cipher Beaufort Cipher Playfair Cipher Autokey Cipher Running Key Cipher These ciphers use different techniques for changing the substitution pattern, making them more secure than basic ciphers like the Caesar cipher. MonoAlphabetic Cipher vs. Polyalphabetic Cipher See the difference between MonoAlphabetic Cipher and Polyalphabetic Cipher in detail below − Sr.No. MonoAlphabetic Cipher Polyalphabetic Cipher 1 In a monoalphabetic cipher, every character in the original message (plaintext) is consistently replaced by a specific character in the encrypted message (ciphertext). Polyalphabetic ciphers employ multiple different sets of letters (alphabets) to substitute the original message, making the encryption more secure and complex. 2 In this type of cipers, a character in plaintext has a one-to-one relationship with the characters in ciphertext. In this kind of ciphers, a character in plaintext has a one-to-many relationship with characters in ciphertext. 3 In a monoalphabetic stream cipher, the value of the key used to encrypt each character in the plaintext does not change based on the location of that character within the plaintext sequence. In a stream cipher, the key changes based on the location of the plaintext character within the data sequence, making it a polyalphabetic cipher. 4 Every letter in the original message (plaintext) is replaced by a specific letter in the coded message (ciphertext). Every letter in the original message can be replaced by any of ”m” different letters in the encrypted message. 5 It is a basic substitution cipher. It is a multiple substitution cipher. 6 It contains additive, multiplicative, affine, and monoalphabetic substitution ciphers. The text showcases various encryption techniques, including autokey, Playfair, Vigenere, Hill, the unbreakable one-time pad, rotor machines, and the famous Enigma cipher. 7 Monoalphabetic ciphers are not as strong as polyalphabetic ciphers. Polyalphabetic ciphers are significantly stronger. 8 The Monoalphabetic Cipher is a substitution cipher that relies on the same fixed mappings from plaintext to cipher letters throughout the text. Polyalphabetic Cipher is a substitution cipher in which plaintext characters in various locations are enciphered with distinct cryptoalphabets. Print Page Previous Next Advertisements ”;
Cryptography – Feistel Block Cipher ”; Previous Next A framework or design model called the Feistel cipher which is used to create different symmetric block ciphers, including DES. Components of this design framework can either be self-invertible, non-invertible, or invertible. The encryption and decryption algorithms are also the same as those used by the Feistel block cipher. The Feistel structure demonstrates the implementation processes of confusion and diffusion and is based on the Shannon structure that was first described in 1945. Using a substitution method, confusion creates a complex relationship between the encryption key and the ciphertext. But diffusion uses a permutation process for creating a complex link between plaintext and cipher text. The framework for implementing substitution and permutation alternately was proposed by the Feistel cipher. Substitution uses ciphertext to take the place of plaintext elements. Instead of having one element replace another as is done with substitution, permutation rearranges the elements of plaintext. Algorithm Make a list of every character in plaintext. After converting the plaintext to ascii, format it in 8-bit binary. Separate the binary plaintext string into its left (L1) and right (R1) parts. For each of the two rounds, generate two random binary keys (K1 and K2), each of equal length to the plaintext. Encryption There are multiple rounds of processing plaintext in the Feistel cipher encryption process. The substitution step and the permutation step are included in every round. Take a look at the example that following, which describes the encryption structure used in this design framework. Step 1 − The plaintext is split up into fixed-size blocks, and only one block is handled at a time in this initial phase. Two inputs for the encryption technique are a block of plaintext and a key K. Step 2 − Split the block of plaintext into two parts. The plaintext block will have two distinct representations: LE0 for the left half of the block and RE0 for the right half. To create the ciphertext block, the two parts of the plaintext block (LE0 and RE0) will undergo multiple rounds of plaintext processing. The encryption function is applied to the key Ki as well as the right half REi of the plaintext block for each round. Next, the left half of LEj is XORed with the function results. In cryptography, the logical operator XOR is used to compare two input bits and generate one output bit. For the following round, RE i+1, the output of the XOR function becomes the new right half. For the next round, the left half LEi+1 replaces the prior right half REi. The same function, which implements a substitution function by applying the round function to the right half of the plaintext block, will be executed on each round. The left half of the block is used to XOR the function”s output. After that, the two halves are switched using a permutation function. The next round”s permutation results are given. Actually, the Feistel cipher model resembles the previously discussed Shannon structure in that it uses the substitution and permutation processes in an alternating manner. Feistel Cipher Design Features When using block ciphers, the following Feistel cipher design features are taken into account − Block size − Larger block sizes are considered to make block ciphers more secure. Larger block sizes, but it slow down how quickly the encryption and decryption processes execute. Block ciphers typically contain 64-bit blocks, while more recent versions, such as AES (Advanced Encryption Standard), have 128-bit blocks. Simple analysis − By making block ciphers simple to analyze, cryptanalytic vulnerabilities can be found and fixed, leading to the development of strong algorithms. Key size − Similar to block size, higher key sizes are considered to be more secure, but they can additionally cause the encryption and decryption process to take time to complete. The previous 64-bit key has been replaced by a 128−bit key in modern ciphers. The quantity of rounds − The quantity of rounds has an effect on a block cipher”s security as well. More rounds boost security, but they also make the encryption harder to crack. The number of rounds therefore depends on the kind of data protection that a firm wants. Round function − An complex round function increases the security of the block cipher. Subkey generation function − Expert cryptanalysts find it more challenging to decrypt ciphers with more complex subkey generating functions. Fast software encryption and decryption − It is advantageous to use software that may boost block ciphers” rate of execution. Decryption The fact that the Feistel cipher model uses the same algorithm for both encryption and decryption may surprise you. A few important guidelines to keep in mind when decrypting are as follows − The encrypted text block is divided into two parts, the left (LD0) and the right (RD0), as seen in the above picture. The round function is used with the key Kn-1 to operate on the right half of the cipher block, just like the encryption algorithm. The left half of the ciphertext block is XORed with the function”s result. The output of the XOR function becomes the new right half (RD1), and RD0 swaps places with LD0 for the subsequent cycle. In fact, the identical function is used in each round, and the plaintext block is reached after a certain number of rounds are completed. Implementation in Python Let us implement the Feistel Block Cipher with the help of Python”s binascii and random modules − The Feistel Cipher algorithm for encryption and decryption is shown using this Python program. To recover the original plaintext, it first encrypts the input, which it then decrypts. Example import binascii import random def random_key(p): key = “” p = int(p) for _ in range(p): temp = random.randint(0, 1) temp = str(temp) key = key + temp return key def exor_func(a, b): temp = “” for i in range(len(a)): if a[i] == b[i]: temp += “0” else: temp += “1” return temp def convert_bin_to_dec(binary): string =
Cryptography – Origin
Cryptography – Origin ”; Previous Next Human beings from ages had two inherent needs – (a) to communicate and share information and (b) to communicate selectively. These two needs gave rise to the art of coding the messages in such a way that only the intended people could have access to the information. Unauthorized people could not extract any information, even if the scrambled messages fell in their hands. The art and science of concealing the messages to introduce secrecy in information security is recognized as cryptography. The word ”cryptography” was coined by combining two Greek words, ”Krypto” meaning hidden and ”graphene” meaning writing. Evolution of Cryptography Cryptography has been around for a really long time, even before computers and the Internet. People always wanted to hide their messages, so they found clever ways to do it. One of the earliest known uses of cryptography dates back to ancient Egypt, around 2000 BCE. Grave walls and other surfaces were hidden with hieroglyphics and symbols to convey important messages. These symbols were like a secret language that only a few people could understand. Another famous example comes from ancient Greece. The Spartans were warriors and used a technique called the Skytel. They tied a piece of paper to a tree of a certain size and wrote their message along the length of the paper. If the message was released from the wand, the message would be distorted and unreadable unless one had a full-sized wand. During and after the European Renaissance, various Italian and Papal states led the rapid proliferation of cryptographic techniques. Various analysis and attack techniques were researched in this era to break the secret codes. Improved coding techniques such as Vigenere Coding came into existence in the 15th century, which offered moving letters in the message with a number of variable places instead of moving them the same number of places. Only after the 19th century, cryptography evolved from the ad hoc approaches to encryption to the more sophisticated art and science of information security. In the early 20th century, the invention of mechanical and electromechanical machines, such as the Enigma rotor machine, provided more advanced and efficient means of coding the information. During the period of World War II, both cryptography and cryptanalysis became excessively mathematical. With the advances taking place in this field, government organizations, military units, and some corporate houses started adopting the applications of cryptography. They used cryptography to guard their secrets from others. Now, the arrival of computers and the Internet has brought effective cryptography within the reach of common people. Cryptography Origin Ancient Beginnings − Long ago, ancient civilizations like Egypt and Greece began using secret codes to hide their messages. They used special signs and techniques like Scytale to secure their message. Evolution in Antiquity − Over time, people in places like Rome got smarter about keeping secrets. Leaders used Caesar ciphers and other codes to send messages that only their trusted allies could understand. Medieval − During the Middle Ages, people also developed private laws. Sophisticated ciphers were developed, such as the Vigenère Cipher, which uses keywords to scramble messages. Revolution and Knowledge − In later times, intellectuals such as Leon Battista Alberti and Blaise de Vigenaire further improved the laws. It was rigorously disassembled and used for vital tasks such as sending secret messages in warfare. Military and Commonwealth Importance − Private codes have become too expensive for militaries and states. It was used to plan wars, spy on the enemy, and communicate secretly with other nations. Industrial Revolution − With the advent of machines during the Industrial Revolution, people wrote even more beautiful code. Devices like Enigma were developed to better understand messages. The Modern Era − Now, thanks to computers and the Internet, privacy laws are more important than ever. Intelligent people create special rules and regulations to keep our messages safe when they are transmitted over the Internet. Relevance in modern society − Privacy laws are relevant today. They help keep our information safe while shopping online or sending messages to friends. Without them, people could view our privacy and cause trouble. From 1800 to the First World War From the 1800s until the First World War, cryptography made great strides. Charles Babbage and Frederick Kasisky made breakthroughs in latent mathematical analysis. Cipher solving techniques developed by Edgar Allan Poe became popular. Cryptography played a role in historical events such as the Mata Hari murder and the Dreyfus case. During World War I, Room 40 defied German naval code and blocked the Zimmermann wire, affecting America”s entry into the war. Gilbert Varnam proposed the teleprinter cipher, which led to the development of cipher devices and unbreakable disposable pads. The pre-World War II enigma mathematical methods of William F. Friedman and Marion Rejewski also became prominent. When was encryption invented, and by whom? The first written evidence of encryption can be traced back to ancient Egypt. About 4,000 years ago, the tomb of nobleman Khnumhotep II contained inscriptions made during his lifetime. However, some unusual images were used that obscured the original meaning of the text. In Egypt, ancient encryption was primarily used to protect knowledge, as education was a privilege only available to the upper classes of society, and it was also a means of teaching writing skills and used for religious reasons therefore, as in reference to forbidden things. The first recorded use of encryption for military purposes dates back to about 500 B.C. Spartan encryption uses a feature called scytale, which could send and receive secret messages. A thin strip of leather was placed around the tube and text was written along the length of the tube. Once the tape was wrapped from the cylinder, the text became eligible unless the reader had the same cylinder. This is the first time that basic concepts commonly found in modern cryptographic technologies have been applied to encryption and decryption today. The first type of encryption The first type of encryption is a
Cryptography – Triple DES
Cryptography – Triple DES (Data Encryption Standards) ”; Previous Next The speed of exhaustive key searches against DES after 1990 began to cause discomfort amongst users of DES. However, users did not want to replace DES as it takes an enormous amount of time and money to change encryption algorithms that are widely adopted and embedded in large security architectures. The pragmatic approach was not to abandon the DES completely, but to change the manner in which DES is used. This led to the modified schemes of Triple DES (sometimes known as 3DES). It should be noted that there are two versions of Triple DES: 2-key Triple DES (2TDES) and 3-key Triple DES (3TDES). What is Triple DES? Triple Data Encryption Algorithm, often known as Triple DES, TDEA and 3DES is an encryption method that encrypts a single piece of text using three separate versions of DES. In the first, each key used is unique; in the second, two keys are same and one is different; and in the third, every key is similar. These are the different key selecting methods that are used. Triple DES was first introduced in 1998. For a longer effective key length, it runs the DES cipher algorithm three times over each data block. Encryption Process of Triple DES The three stages of Triple DES operation are Encrypt-Decrypt-Encrypt (EDE). It functions by using a key bundle, made up of three 56-bit keys (K1, K2, and K3). Initially K1 is used for encryption; K2 is then used for decryption; and K3 is used for the final encryption. There is a two-key Triple DES version where K1 is used for the first and end steps but the same algorithm is done three times. In 2015, this two-key version was discontinued. Because of the limitation to use double enciphering, the algorithm is executed three times. Meet-in-the-middle attacks are a type of attacks that encrypt from one end, decrypt from the other, and search for collisions, or keys resulting in the same outcome in both directions. Double DES, or any other cipher run twice, would only be twice as strong as the base cipher if memory were enough. In simple terms, the double cipher is going to have a shorter key and be equally powerful as the identical cipher run once. Not only this, but encrypting twice with two keys is equivalent to encrypting once with an alternate key if the cipher combines together. However determining the other key is not simple, using every single key in a brute-force attack will result to the discovery of the third key. So multiple encrypting is a waste of time if the cipher is a group. An operator and a set have a connection known as a group. They form a group if their behaviour with addition is nearly the same as that of integers. A group is also formed if you continue to encrypt a block and it finishes a full circuit over the set of potential blocks. DES does not belong to a group. But DES has popular structural characteristics that lead some to maintain that it”s not definitely not a group, in other words, it can be a group. For example, there are known DES loops in which you can get stuck in an indefinite loop by continuously encrypting with the same key. Encryption Modes Triple DES allows the DES algorithm to be used in each of the three rounds in either direction, for encryption or decryption. As a result, Triple DES has eight different possible modes. Mode Encryption Sequence DDD Decrypt-Decrypt-Decrypt DDE Decrypt-Decrypt-Encrypt DED Decrypt-Encrypt-Decrypt DEE Decrypt-Encrypt-Encrypt EDD Encrypt-Decrypt-Decrypt EDE Encrypt-Decrypt-Encrypt EED Encrypt-Encrypt-Decrypt EEE Encrypt-Encrypt-Encrypt If there was a better choice, you are unlikely to want to use EEE or DDD mode for the same structural reasons that you could not want to use EED, DEE, DDE, or EDD. The most effective compositions are EDE or DED due to the weak nongroupness of DES. EDE additionally makes more sense. You have to clarify how Triple DES begins with decryption if you decide to use DED. Modules of Triple DES There are some modules of Triple DES which are as follows − Admin Login − In this project, admin can get in the username and password to validate himself to access the account panel modules. User Login − In this module, users can get in their username and password to authenticate themselves to access their account panel modules. User Registration Module − In this module, users can get in their username and password and address, mobile, email id to register themselves to access the account panel modules. Create Message Module for Admin − In this module, admin can choose the username and then enter the message along with the subject and also the input encryption key which can be used for encrypt the message and the subject and then send it to the selected user and message and subject are both saved into the user inbox. Check Suspicious Mails for Admin − In this module, admin can verify the suspicious mails which is not generally stored into the user inbox rather than marked as suspicious status and sent it to the admin as suspicious mails with the user element. Data Dictionary for Admin − In this module, admin can add the suspicious words into current data dictionary to detect more directly and efficiently the suspicious mails sent by the users. View Data Dictionary for Admin − In this module, admin can see the suspicious words exists into the data dictionary and also has access to remove the suspicious words from the current data dictionary of suspicious words. View Users List for Admin − In this module, admin can see the registered users and their full element and has access to remove the users if any of the registered users are discovered to do the suspicious event on the website. Create Message Module for Users − In this module, users can choose the other users
Cryptography – Stream Cipher ”; Previous Next A stream cipher encrypts text by applying a key and algorithm to each bit of a data stream one by one. In contrast, block ciphers process data in blocks of multiple bits at once. Stream ciphers are mainly used to encrypt one byte (8 bits) at a time. Since stream ciphers are linear, messages are encrypted and decrypted with the help of the same key. And, while cracking them is difficult, hackers will have to manage to do it. In this, a keystream, a random series of bits, is generated from a key. To encrypt the data stream, each bit is XORed with an equivalent bit from the keystream. How does it work? Stream ciphers make use of a common key (“symmetric key”) to code their data. Encryption and decryption processes of the data are handled by this symmetric key. Unlike public-key ciphers, stream ciphers utilize one key for encryption as well as decryption, eliminating the need for different keys for each task (for instance, using one key to encrypt and another to decrypt). Cryptographic methods generally conceal data from unauthorized access by scrambling it. However, stream ciphers differ by processing data bit-by-bit, unlike block ciphers that operate on collections of data known as blocks. Stream ciphers involve Plaintext − The original message to be encrypted. Keystreams − Random sequences of characters (e.g., numbers, letters, symbols) that replace the plaintext characters. Ciphertext − The encrypted message. Key generation is a complex mathematical operation, but modern computers can perform it quickly. In a stream cipher, individual bits of plaintext are inputted and subjected to a mathematical operation. The result is jumbled text which needs the right key to decode. Using the proper key, the receiver can reverse the process and convert the scrambled text back to its plaintext. In stream cipher encryption, the key known as a one-time pad is exceptionally secure due to its unique property. It is designed to be equivalent in length to the message being encrypted, ensuring that an attacker cannot mathematically decipher the message without having the original key. Keystream Generation Let us see at a basic example of keystream creation with the help of an XOR-based stream cipher. Let”s say we have the below data − Key: 101011 Initialization Vector (IV): 110100 To create a stream of encrypted data (keystream): Set up the encryption algorithm with a secret key and initialization vector (IV). If needed, adjust the key and IV to be the same length as the message being encrypted. Combine the key and IV using an exclusive OR (XOR) operation to generate the keystream. Here is the step by step process − Key: 101011 IV: 110100 Keystream: 011111 Now, let us say we have a plaintext message as: 1100101. To encrypt this plaintext using the keystream − Plaintext: 1100101 Keystream: 011111 Ciphertext: 1011010 To decrypt the ciphertext, we would use the same keystream − Ciphertext: 1011010 Keystream: 011111 Plaintext: 1100101 This example explains how to generate a keystream, which is then used to encode and decode a message, using a key and an initialization vector. For better safety, more complex methods and bigger key sizes are used in real-world applications. Categories of Stream Ciphers Stream ciphers fall into two main categories with slightly different mechanisms − Synchronous Stream Ciphers − Employ a secret key to produce key streams independent of the plaintext and ciphertext. Self-Synchronizing Stream Ciphers − Utilize a secret key and additional randomization to enhance security against hacking. Alternative encryption options is Block cipher which divides messages into smaller blocks and applies an encryption algorithm to each block. Advantages of Stream Cipher Here are some benefits of Stream Cipher: Speedy Encryption and Decryption: Stream ciphers encrypt and decrypt data at single bit or byte speeds, making them ideal for real-time communication and demanding applications. Low Hardware Requirements: Stream ciphers can be easily implemented in simple performance (such as XOR) hardware, allowing them to be implemented efficiently on a variety of devices and systems. Selective Access: Stream ciphers provide the ability to decrypt particular parts of encrypted data selectively, which is useful when needing to access or modify specific portions without decrypting the entire message. Disadvantages of Stream Cipher Below are some disadvantages of Stream Cipher technique − Vulnerability to Known Plaintext Attacks − Known plaintext attacks are harmful to stream ciphers. An attacker can identify the encryption keystream when they have pieces of both the plaintext and the ciphertext, which include the encrypted message. This can potentially expose the protected data. Lack of Diffusion − Stream ciphers have poor diffusion. When the plaintext changes slightly, the ciphertext also changes only slightly. This makes it easier for attackers to study patterns and possibly restore the original message even without knowing the encryption key. Popular Stream Ciphers Some popular stream ciphers are − RC4 − Because it was quick and easy to use, RC4 was earlier widely used in the SSL/TLS and WEP/WPA protocols, but it was out of date due to security vulnerabilities. Salsa20 − Salsa20, developed by Daniel J. Bernstein, is known for its efficiency and safety. Applications like secure communications and disk encryption frequently use it. ChaCha − ChaCha is a newer version of Salsa20, designed with better diffusion and protection against certain attacks. It”s often used in protocols like TLS and VPNs. HC-128 − Hongjun Wu”s stream cipher offers excellent efficiency along with robust security. It works effectively in devices with limited capabilities, like cell phones. Grain − Martin Hell and Thomas Johansson developed this lightweight stream cipher. It is particularly efficient when implemented in hardware, making it ideal for use in applications such as RFID tags and sensor networks. Print Page Previous Next Advertisements ”;
Cryptography – Modern Age
Cryptography – Modern Age ”; Previous Next Cryptography and encryption are very useful for data security. In today”s world, it is very important in protecting cyber data. The Internet allows computers to communicate with each other anywhere. But with that, a lot of intruders come in and try to make us care about what we do. People or companies whose job it is to keep data secure. Encryption is the primary way we do that. In this chapter we will discuss the various ways in which we use cryptography today for security purposes. Modern cryptography uses complex mathematical techniques to encode information so that only the intended recipient can understand it. There are two main types of cryptography: symmetric and asymmetric cryptography. As the technology is evolving around, so does cryptography and researchers are constantly developing new ways to get ahead of potential threats. Classic Cryptography vs. Modern Cryptography Classic and modern cryptography are both methods used to keep information secure but they are different in many ways let us discuss these one by one − Technology Classic cryptography is based on manual methods and mechanical devices like pen and paper, mechanical cipher machines (like Enigma), or simple electronic circuits. While Modern cryptography uses advanced computing technologies like digital computers, specialized cryptographic hardware, and software algorithms. Security Strength Classic cryptography mostly relies on simple substitution or transposition techniques. This can be very easy for modern computers to crack mainly with the help of brute force attacks. Modern cryptography uses more complex algorithms. This makes it more secure against attacks. It uses mathematical principles like prime number theory, discrete logarithms, and elliptic curves to create best encryption schemes. Time Period Classic cryptography used before the 20th century. And techniques like Caesar ciphers and the Enigma machine used in that time. Modern cryptography is developed in the 20th and 21st centuries which uses advanced mathematical algorithms and computer technology. Key Management In the Classic cryptography the key management was very challenging because keys need to be shared securely between two parties without interception. This feature can make classic cryptographic systems vulnerable to attacks. Modern cryptography uses asymmetric encryption in which each user has a pair of keys. A public key for encryption and A private key for decryption. This feature removes the need for key distribution and gives stronger security. Applications Classic cryptography was mainly used for military and diplomatic applications, as well as to get important information in ancient times and history. Modern cryptography is everywhere in today”s digital world, being used for online transactions, financial transactions, data storage, and authentication methods such as protecting digital signatures and biometrics. Overall, while classical cryptography laid the foundation for modern cryptographic principles, modern cryptography offers much stronger security and broader applications through advances in mathematics, computer technology, and cryptographic analysis. Context of Cryptography Cryptology, the study of cryptosystems, can be subdivided into two branches − Cryptography Cryptanalysis What is Cryptography? Cryptography is the science of making a cryptosystem with the ability to provide data security. Cryptography deals with the actual security of digital data. It describes the design of devices based on accounting systems that provide basic information security services. You can think of cryptography as a giant tool set with methods for security operations. What is Cryptanalysis? Cryptanalysis is the art and science of breaking cipher text. It is also the branch of cryptography. The cryptographic system generates cipher text that is transmitted or stored. It involves studying the cryptographic devices with a view to breaking them. Cryptanalysis is also used to test the security properties of new cryptographic techniques as they are developed. Note − Cryptography deals with the design of cryptosystems and the cryptanalysis studies the breaking of cryptosystems. Cryptography Primitives Cryptography primitives are nothing more than tools and techniques in cryptography that can be selectively used to provide desired security services − Encryption Hash functions Message Authentication codes (MAC) Digital Signatures The below table shows the primitives that can be achieved a particular security service on their own. Primitives Services Encryption Hash Function MAC Digital Signature Confidentiality Yes No No No Integrity No Sometimes Yes Yes Authentication No No Yes Yes Non Repudiation No No Sometimes Yes Note − To obtain a set of necessary security services from a cryptosystem, cryptographic primitives are commonly connected and have complex relationships with one another. Print Page Previous Next Advertisements ”;
Cryptography – XOR Encryption ”; Previous Next XOR functions are extensively used in cryptography, digital logic circuits, network protection, and programming languages like Python, Java, and C++. The XOR operation is also known as Exclusive OR. The logical function XOR (exclusive OR) compares two binary digits and returns 1 if they differ. The XOR function returns 0 if the two bits are exactly equal. In other words, XOR gives 1 if one of the binary digits is 1, but not both. So as we have discussed above, XOR can be used for encryption in cryptography. So with the help of XOR encryption we can encrypt data that is impossible to crack using brute-force. For example, creating random encryption keys to match the right key. Implementation Using Python We can implement the XOR Encryption using below methods in Python − Using a For Loop and a Fixed Key Using Random Key Generation Using the base64 module In the next sections, we will try to explain each of these ways in brief so that you can gain a better understanding of XOR Encryption using Python. Approach 1: Using a for loop and a fixed key XOR encryption is a simple symmetric encryption algorithm wherein each individual inside the input message is combined with a key with the help of the XOR operation. So we are able to encrypt our input message character by person the use of XOR operation and right here we are able to use a hard and fast key for every man or woman.In our case the key is ”T”. And then the outcome of the XOR operation is converted back to a character. The process of XOR-ing every character with the key hides the original message, which makes it difficult to read without the encryption key. Here is an example of performing XOR encryption on a plaintext − Example #Our XOR encryption function def xorEncrypt(inpString): my_xor_key = ”T” length = len(inpString) encrypted_msg = “” for i in range(length): encrypted_msg += chr(ord(inpString[i]) ^ ord(my_xor_key)) return encrypted_msg demoMsg = “This is Tutorialspoint” # Encrypt the string print(“Original Message: “, demoMsg) encrypted_message = xorEncrypt(demoMsg) print(“Our Encrypted Message: “, encrypted_message) Following is the output of the above example − Input/Output Original Message: This is Tutorialspoint Our Encrypted Message: <=”t=”t! ;&=58”$;=: Approach 2: Using Random Key Generation In this approach we are going to use random key generation using the random module of Python to create a key of the same length as the message for XOR encryption. It uses the random.choice() method to randomly select ASCII characters from the string module. In the xorEncrypt function, the generated key and the message are passed as arguments. The zip function is used to iterate over corresponding characters of the message and the key simultaneously. This process adds randomness and security to the encryption process. Below is the Python implementation for the XOR Encryption using random key generation − Example import random import string #Generate random key def generate_key(length): return ””.join(random.choice(string.printable) for _ in range(length)) # XOR Encryption function def xorEncrypt(message, key): encrypted = ””.join(chr(ord(char) ^ ord(key_char)) for char, key_char in zip(message, key)) return encrypted #Function execution and input message message = “Hello, Everyone!” key = generate_key(len(message)) encrypted_msg = xorEncrypt(message, key) print(“Encrypted Message:”, encrypted_msg) decrypted_msg = xorEncrypt(encrypted_msg, key) print(“Decrypted Message:”, decrypted_msg) Following is the output of the above example − Input/Output Encrypted Message: e-2( vH#R29 Decrypted Message: Hello, Everyone! Approach 3: Using the base64 module The base64 module in Python offers functions to encode and decode information the use of Base64 encoding. So we will carry out XOR encryption on the input message with the help of a consumer-described key. After encrypting the message, we will encode it using base64 to create an encrypted message. Here is an implementation that shows XOR encryption with a user-defined key and then encodes the encrypted message using base64 − Example import base64 def xorEncrypt(message, key): encrypted = ””.join(chr(ord(char) ^ ord(key[i % len(key)])) for i, char in enumerate(message)) return encrypted def main(): try: message = “Hello my name is Azaad” key = “T” print(“Our Original Message is:”, message) # Encrypt the message using XOR encryption encrypted_message = xorEncrypt(message, key) # Encode the encrypted message using base64 encoded_message = base64.b64encode(encrypted_message.encode()).decode() print(“Encrypted and encoded message:”, encoded_message) except Exception as e: print(“An error occurred:”, str(e)) if __name__ == “__main__”: main() Following is the output of the above example − Input/Output Our Original Message is: Hello my name is Azaad Encrypted and encoded message: HDE4ODt0OS10OjU5MXQ9J3QVLjU1MA== Implementation using Java In this implementation we will use Java”s Base64 class to implement the Base64 encoding and decoding functionality. This class contains only static methods for getting encoders and decoders for the Base64 encoding method. The implementation of this class supports the Base64 types specified in RFC 4648 and RFC 2045. Example So below is the implementation of Base64 encoding and decoding using Java”s Base64 class: import java.util.Base64; public class Base64Class { public static void main(String[] args) { // Encoding process String plaintext = “Hello, Tutorialspoint!”; String encoded_message = Base64.getEncoder().encodeToString(plaintext.getBytes()); System.out.println(“The Encoded string: ” + encoded_message); // Decoding process byte[] decodedBytes = Base64.getDecoder().decode(encoded_message); String decodedString = new String(decodedBytes); System.out.println(“The Decoded string: ” + decodedString); } } Following is the output of the above example − Input/Output The Encoded string: SGVsbG8sIFR1dG9yaWFsc3BvaW50IQ== The Decoded string: Hello, Tutorialspoint! Implementation using C++ The C++ code implements a function to encode a string to Base64. Here we will basically use vector and iomanip library to implement Base64. Vector library contains definitions and implementations of useful data structures and functions and iomanip is a library which is basically used to manipulate the output of C++ program. This code basically converts every character to its corresponding Base64 cost and appends it to the output string. Similarly, the deciphering feature converts each Base64 character back to its unique value and appends it to the output string. This way, the authentic string is reconstructed. Example Following is the implementation using C++ #include <iostream> #include
Cryptosystems – Brute Force Attack ”; Previous Next What is the Brute Force Attack? Brute force attacks are hacking strategies that use trial and mistakes to crack passwords, login credentials and encryption keys. It is a easy but dependable way to benefit unauthorized get entry to non-public accounts and organizations systems and networks. The hacker tries multiple usernames and passwords, often using a computer to try multiple connections, until he finds the correct login information. The name “brute force” comes from attackers who use extreme force to try to gain access to users” accounts. Despite older methods of cyber-attack, phishing attacks are tried and tested, and remain a favorite method for hackers. How does a brute force attack work? The process of brute force attacks includes an automated or manual trial and error technique, wherein the attacker uses a combinations of letters, numbers and logos to guess accurate authentication information. Target selection − The attacker selects the target system or account he wants to gain access to. This could be a website, email account, network server, or other system that requires authentication. Password generation − The attacker generates passwords in an attempt to counter the target. This can be done manually by setting up the passwords that can be entered, or automatically using software tools that can generate passwords and test them at high speed. Password testing − The attacker begins testing each created password against the target system. This can be accomplished via the system”s login page or authentication method. If the password is wrong, the attacker proceeds to the next phase. If everything is right, you will be granted access to the system or account. Iterations − The process continues until the attacker determines the proper password or has exhausted all available possibilities. Depending on the complexity of the password and the speed of the attacker”s equipment, this system can take seconds to days or even longer. Access − If an attacker well guesses the password, they may gain unauthorized get admission to to the targeted gadget or account.They can then execute hostile behaviors to steal resources or undermine system security by stealing important information. Brute force attacks are often used as a last resort when other methods of gaining access, such as exploiting vulnerabilities or social engineering, fail and are often automated to accelerate the process there to win is the big one. But because of the number of possible combinations, force attacks can be time-consuming and resource-intensive, especially for systems with strict security measures in place. Types of Brute Force Attacks Brute force attacks can take different forms depending on the target and the specific security mechanisms in place. Here are some common brute force attacks. Password Brute Force − This is the weakest form of brute force attack. the attacker systematically tries every possible combination of characters until a valid password is found. This can be done manually, but it”s limited to software tools that can run fast and test thousands or millions of passwords per second. Password brute force attacks are often used against login pages on websites, email accounts, or other systems that require authentication. Credential stuffing − In this type of attack, the attacker uses a listing of username and password pairs acquired from previous information breaches or leaks. They then attempt those combinations in opposition to various on-line services or web sites, hoping that some customers have reused their credentials across more than one money owed. Since many human beings use the identical password for one of a kind money owed, credential stuffing can be quite successful in gaining unauthorized access to numerous bills. Dictionary attacks − Instead of testing every combination of characters, dictionary attacks rely on a random list of common words, phrases, or phrases . Using a dictionary enables an attacker to significantly reduce the number of attempts needed to guess a password, since only the entries in a list have to be looked up. Dictionary attacks tend to be more efficient than they are used aggressively, especially when users choose a word that is easy or easy to guess. Reverse brute force attack − In a reverse brute force attack, the attacker already has a specific password in mind and tries to find out a username or account associated with it This is in contrast to traditional brute force attacks, where in which the attacker tries passwords starting with the username. Reverse brute-force attacks are rare but can be used in situations where the attacker has obtained the password through other means, such as social engineering or a data breach, and wants to know what accounts he has on it. Hybrid brute force attack − A combination of a dictionary attack and a simple brute force attack. an attacker uses two methods to identify a login account, starting with a known username. Using a list of possible words to test combinations of letters, letters, and numbers. Each brute force attack has its own advantages and limitations, attackers can choose the most appropriate strategy based on their target system and security policy but all brute force attacks have the same goal of gaining unauthorized access through a system that they will speculate or try combinations until they succeed. Notable Brute Force Attacks There have been many notable threat attacks over the years, targeting systems and organizations. Here are a few examples − LinkedIn − Hackers breached the famous commercial enterprise networking online website LinkedIn and stole 6 million person passwords in 2012. Attackers used a combination of brute force and dictionary attacks to crack passwords. As a result, LinkedIn needed to reset affected user passwords and implement robust secrutiy features to prevent brute force attacks. Sony PlayStation Network (PSN) − A security breach on the Sony PlayStation Network peaked in 2011 affecting more than 77 million users with personal information, including usernames and a use including passwords. The breach resulted in massive outages for PSN and significant damage to Sony”s reputation. WordPress − Over
Cryptosystems – Types
Cryptography – Types ”; Previous Next The study and application of secure communication methods in the presence of third parties is known as cryptography. It can also be used to establish a safe connection among two systems. Under particular conditions, cryptography uses mathematics-mostly arithmetic and number theory-to guarantee the confidentiality, integrity, and authenticity of messages. By making sure that data cannot be read or modified while data is being transit, where unauthorised people can hack and read, it protects confidentiality. The first thing to understand about cryptography is that there is no one way to universally encrypt a message. There are multiple methods and each has benefits and drawbacks. Public and symmetric key cryptography are currently the most widely used encryption techniques. Many cryptographic algorithms are simply derived from other applications, like encryption methods for secure transactions across unreliable networks like the Internet or digital signature schemes. For example, factorising integers was the original purpose of the development of RSA cryptosystems. Criminals regularly use cryptography to avoid identifying and transmit illegal messages without being detected. Public-key cryptosystems, like RSA, which are widely used in security protocols, also use it. Types of Cryptography The majority of encryption techniques can be divided into three categories: symmetric cryptography algorithms, and asymmetric cryptography algorithms, and hash functions while hybrid systems like the SSL internet protocols do exist. Let us see the types of cryptography in the section below. Symmetric Key Cryptography Asymmetric Key Cryptography Hash Functions Symmetric Key Cryptography Symmetric key encryption, commonly referred to as private key cryptography, secret key cryptography, or single key encryption, uses a single key for both the encryption and decryption processes. Every user needs to have access to the same private key in these kinds of systems. Private keys can be exchanged using a Diffie-Hellman key agreement or, more accurately, through a secure key exchange technique like a previously established secure communication channel such as a private courier or secured line. So we can use the same key to lock and unlock messages. It is like having a secret code that you and your friend both know. It is very simple and fast. The two parties share the key in a secure way. Two categories of symmetric key algorithms exist − Block Cipher − The cipher algorithm operates on a fixed-size block of data in a block cpher. As an example, eight bytes of plaintext are encrypted at a time if the block size is eight. When handling data larger than the block size, the user interface for the encrypt/decrypt process typically calls multiple times the low-level cipher function. Stream Cipher − Stream ciphers transform data one bit (or one byte) at a time instead of operating on a block basis. Simply say, a stream cipher uses a given key to generate a keystream. The plaintext data is then XORed with the generated keystream. Examples of Symmetric Cryptography are as follows: DES, Triple DES, Blowfish, AES. Asymmetric Key Cryptography Unlike symmetric encryption cryptography, we use two keys in this type of cryptography: one for encryption and second one for decryption. Since these keys can be reused several times and are only used once per message, they do not need to be kept secret. Public-key systems are the most common use case for asymmetric key cryptography. Two keys are utilised in asymmetric encryption: a secret key and a public key. Because of this, another name for these algorithms is public key algorithms (PKA). Since only the intended recipient”s private key can be used to decipher an encrypted message, public key cryptography is typically thought to be more secure than symmetric encryption methods, even though one key is made available to the public. Asymmetric key cryptography has many examples, like the following − Rivest, Shamier, and Adleman (RSA) − One of the first widely used public key cryptosystems for secure data transmission, the RSA algorithm was founded in 1977 and is named for its authors, Rivest, Shamier, and Adleman. Elliptic curve cryptography (ECC) − It is a modern type of asymmetric encryption that generates very strong cryptographic keys using the algebraic structures of elliptic curves. Hash Functions A hash function is like a special mathematical function which takes an input of arbitrary data like text, numbers, or files and converts it into a fixed-length string called a hash. We can say it is like a fingerprint for your data. Hash function can process any size of data but always gives output of fixed length value. The output is much smaller than the input. Suppose you own a library that has millions of volumes. You are not going through each book”s page by page in the hope to quickly find a specific book. An index will be used instead, connecting unique page numbers (hashes) to book titles (data). Hash functions behave similarly for storing and retrieving data. The following claims about a decent hash function are accurate for all purposes and reasons − Collision-resistant − Data integrity is maintained by generating a new hash whenever any part of the data is changed. One-way − This function cannot be undone. To ensure data security, a digest needs to make it impossible to locate the original data. Because hash algorithms encrypt data directly without requiring separate keys, they are an extremely effective part of cryptosystems. In fact, the plaintext works as its own key. Future Cryptography Quantum cryptography Post-quantum cryptography Quantum cryptography The field of cryptography keeps developing to keep up with the speed at which technology is developing and the high level of cyberattacks that are happening. The applied science of efficiently encrypting and transferring data based on the naturally occurring and permanent laws of quantum physics for application in cybersecurity is known as quantum cryptography, or quantum encryption. Quantum encryption is still in its early stages, but it has the potential to be significantly more secure than earlier cryptographic algorithm types and possibly even unhackable. Post-quantum cryptography Post-quantum cryptographic algorithms use various forms of mathematical cryptography to