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

At this point, you should be feeling confident in your ability to encrypt and

decrypt messages. In this chapter, you will expand on what you know to include

the cryptography of images. Through exercises in this chapter, you will be able

to identify problems with different modes of encryption and learn alternative

ways to get results. To complete our study of image cryptography, we will close

the chapter with steganography. Through this chapter, you will do the following:

■■

Gain an understanding of image and cryptography libraries

■■

Learn about AES modes of operations

■■

Explore various cryptography methods for images

■■

Hide and read media within an image using Python

Simple Image Cryptography

Before we get into various libraries that can be used for image cryptography, I

wanted to share a simple method that will allow you to encrypt and decrypt a

file. The entire process relies on looping through the bits of an image and then

bitwise exclusive (XOR) them with the bit and the key. To decrypt the image,

we simply reverse the XOR operation.

Implementing Cryptography Using Python®, First Edition. Shannon W. Bray.

© 2020 John Wiley & Sons, Inc. Published 2020 by John Wiley & Sons, Inc.

171

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

Saved successfully!

Ooh no, something went wrong!