Search code examples
pythonpython-3.xsteganographystepic

How to use stepic.encode()


from PIL import Image
import stepic
img = Image.open ('a.png')
img2 = stepic.encode(img, 'hello world')
img2.show()

Here the code is giving the following error:

TypeError: unsupported operand type(s) for &: 'str' and 'int'

Python 3.6 is used.


Solution

  • had the same problem.. I tested on Python 3.6.6 simply change the line below FROM:

    img2 = stepic.encode(img, 'hello world')
    

    TO:

    img2 = stepic.encode(img, b'hello world')
    

    you need to pass your data/text as binary