07.07.2023 Views

Implementing-cryptography-using-python

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6 ■ Using Cryptography with Images 197

blue = fits.PrimaryHDU(data=b_data)

blue.header["AUTHOR"] = author

blue.header["LATOBS"] = location_lat

blue.header["LONGOBS"] = location_long

blue.header["SATNAME"] = satellite

blue.writeto('chapter6/fits/blue.fits', overwrite=True)

The output of the previous code takes our secret image from the beginning

of the chapter and creates three unique FITS files using red, green, and blue

channels. You will see in Figure 6.15 that the header for green.fits contains our

secret information. As you might expect, we could easily encrypt the image too.

Figure 6.15: FITS Files

Summary

In this chapter, you were introduced to a couple of libraries that perform cryptographic

and steganography tasks on images. It is important for you to understand

how various AES block modes work and how they apply to image files.

We concluded the chapter by using the CryptoSteganography library to hide

various types of files. Hiding messages inside an image could affect the properties

of the image. This was obvious when we hid a 30-second MP3 file inside

an image. The decryption process for each of these examples is dependent on

the use of a secret key; if the recipient of the file does not have the secret key,

your message will remain a secret even if the recipient can see that the visual

properties of the file have changed. Finally, we explored the FITS file format.

While the FITS format may not provide much value on the surface, the amount

of data that can be stored and encrypted is incredible.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!