How does blowfish encryption work




















The Blowfish algorithm in Java is a symmetric encryption algorithm that is considered one of the most robust defenses against hackers trying to penetrate the security of software developed in Java. Step 1 — To use the Blowfish algorithm in Java, you first need to import all the libraries associated with it. Step 2 — Now, you create your code and make a key string to use for the encryption and the decryption process. Also, your key needs to be a secret. Step 3 — After you are done making the key, create the encryption class process to encrypt the entered data.

Step 4 — Create the decryption class below the encryption class and add comments to make it easier for others to understand the code. Step 5 — Once you have written the decryption class, close everything and save your java file.

Now run the code and enter the text you want to cipher. Once you enter the ciphertext, its encryption will be done by the encryption class, and a new text will appear, generated using the Blowfish algorithm in cryptography. Blowfish has two subkeys present in arrays: the P-array contains entry, and S-boxes have four entry.

After that, S-boxes are used to accept the incoming 8-bit input, and it will produce an output of bit. In each round, one of the P-arrays is used. After all the rounds are done, and only the final one is left, each half of the data block gets XORed with one of the P-entries not used till now. Also, as we said in our advantage section, the Blowfish algorithm works on a Feistel network. As a result, by X07Ring P17 and to P18, we can quickly invert it.

So it can cipher the given text block with a different encryption key. P-array and S-boxes do the initial phase of encryption. Then with the help of P-entries placed in order, we get to XORed the secret key.

After that, we can use the same method to encrypt the data presented as zero strings. P1 and P2 replace the consequential cipher present in the algorithm. Then again, P1 and P2 get encrypted by the new modified subkeys.

Blowfish cipher works this whole task times to develop new subkeys for the P-array and the four S-boxes. In this entire procedure, only 4KB of data is generated by the Blowfish algorithm.

If you look on the internet right now, most people use Google Chrome, while some work on Safari and Microsoft Edge. Each browser comes with cybersecurity features. However, when you use one of the widely used browsers, it is fair to say that the risk of malicious URLs is pretty severe.

Even right now, Google has confirmed that their browser, Google Chrome, has a zero-day vulnerability. It means that threat actors have already got their way around the latest Google Chrome update and can exploit it whenever they want. Before we proceed any further, we need to talk about why we need encryption in the first place? Encryption is one of the processes used to encode the data so it can remain hidden from unauthorized individuals.

As a result, its primary function is to protect the personal information of a person, company, or industry. But to make data sending and receiving more secure, you need encryption. The process of encryption is pretty simple. All you have to do is make sure that nobody can open the file or read it until they have the encryption key.

The encryption key is responsible for encrypting the data. Any algorithm you choose to create the encryption key must be complex and reliable. With the help of the Blowfish algorithm in cryptography, you get the encryption and the decryption keys to use one form of an algorithm.

As a result, the key generated for encryption must be used in the decryption of the data. The Blowfish algorithm helps encrypt massive amounts of data in a short time, and its implementation can be easily worked out on hardware.

The only issue with the Blowfish algorithm is that if someone finds out the decryption key, they can easily use it to decrypt the data and steal or see the content not made for them. It is because the Blowfish cipher works on the principle of Feistel structure cipher. When the communications session is over, all the keys are discarded. In this example, it doesn't matter if someone is eavesdropping on the entire conversation.

Without the private RSA keys, which never go over the airwaves, the eavesdropper can't obtain the Blowfish keys and, therefore, can't decrypt the messages passed between the two machines. This example is similar to how the OpenSSH command shell works although OpenSSH takes additional steps to prevent the public keys from being tampered with during transit.

Now let's say that a server wants to send a firmware upgrade to a device and wants to be sure that the code isn't intercepted and modified during transit. The firmware upgrade may be delivered over a network connection, but could just as easily be delivered via a CD-ROM. In any case, the server first encrypts the firmware upgrade with its private RSA key, and then sends it to the device. The recipient decrypts the message with the server's public key, which was perhaps programmed into the device during manufacture.

If the firmware upgrade is successfully decrypted, in other words a checksum of the image equals a known value, or the machine instructions look valid, the firmware upgrade is considered authentic. The RSA algorithm is computationally expensive, although not unreasonably so for the level of functionality and security it provides. A lighter-weight approach to firmware exchange with an embedded system would be to encrypt the image with Blowfish, instead of RSA.

The downside to this approach is that the Blowfish key in the embedded system has to be kept secret, which can be difficult to achieve for a truly determined attacker with hardware skills. In less extreme cases, however, Blowfish is probably fine since an attacker with such intimate knowledge of the target system and environment will likely find another way into the device anyway in other words, simply snatching the firmware upgrade from flash memory once it's decrypted.

The Blowfish algorithm Blowfish is a symmetric encryption algorithm, meaning that it uses the same secret key to both encrypt and decrypt messages. Blowfish is also a block cipher, meaning that it divides a message up into fixed length blocks during encryption and decryption.

The block length for Blowfish is 64 bits; messages that aren't a multiple of eight bytes in size must be padded. Blowfish is public domain, and was designed by Bruce Schneier expressly for use in performance-constrained environments such as embedded systems. Implementation examples are available from several sources, including the one by Paul Kocher that's excerpted in this article as Listing 1.

Written by Paul Kocher. This code and the algorithm are in the0 public domain. Blowfish requires about 5KB of memory.

A careful implementation on a bit processor can encrypt or decrypt a bit message in approximately 12 clock cycles. Not-so-careful implementations, like Kocher, don't increase that time by much. Longer messages increase computation time in a linear fashion; for example, a bit message takes about 2 x 12 clocks.

Blowfish works with keys up to bits in length. Figure 1: Blowfish algorithm. A graphical representation of the Blowfish algorithm appears in Figure 1. In this description, a bit plaintext message is first divided into 32 bits. The resulting P' and F' are then XORed with the last two entries in the P-array entries 17 and 18 , and recombined to produce the bit ciphertext. Figure 2: Graphic representation of F. A graphical representation of F appears in Figure 2.

The function divides a bit input into four bytes and uses those as indices into an S-array. The lookup results are then added and XORed together to produce the output. Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments. What's New. Most popular in Algorithms. In all, the Blowfish encryption algorithm will run times to generate all the subkeys - about 4KB of data is processed.

Blowfish is one of the fastest block ciphers in widespread use, except when changing keys. Each new key requires pre-processing equivalent to encrypting about 4 kilobytes of text, which is very slow compared to other block ciphers. This prevents its use in certain applications, but is not a problem in others, such as SplashID. Blowfish is not subject to any patents and is therefore freely available for anyone to use. This has contributed to its popularity in cryptographic software.

For additional information, please visit Wikipedia. SplashData has been a leading provider of security applications and services for over 10 years. The company's secure password and record management solution SplashID Safe has over 1 million individual users worldwide as well as hundreds of business and enterprise clients. Toggle navigation.



0コメント

  • 1000 / 1000