mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-06-28 03:06:14 +02:00
Added a unit test for steganlysis-parity
This commit is contained in:
parent
e4784ad04d
commit
064456e2a3
3 changed files with 61 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Stegano - Stegano is a basic Python Steganography module.
|
||||
# Copyright (C) 2010-2019 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||
|
@ -26,16 +26,16 @@ __license__ = "GPLv3"
|
|||
|
||||
from PIL import Image
|
||||
|
||||
def steganalyse(img):
|
||||
|
||||
def steganalyse(img: Image.Image) -> Image.Image:
|
||||
"""
|
||||
Steganlysis of the LSB technique.
|
||||
"""
|
||||
encoded = img.copy()
|
||||
encoded: Image.Image = img.copy()
|
||||
width, height = img.size
|
||||
bits = ""
|
||||
for row in range(height):
|
||||
for col in range(width):
|
||||
r, g, b = img.getpixel((col, row))
|
||||
r, g, b = img.getpixel((col, row))[0:3]
|
||||
if r % 2 == 0:
|
||||
r = 0
|
||||
else:
|
||||
|
@ -48,5 +48,5 @@ def steganalyse(img):
|
|||
b = 0
|
||||
else:
|
||||
b = 255
|
||||
encoded.putpixel((col, row), (r, g , b))
|
||||
encoded.putpixel((col, row), (r, g, b))
|
||||
return encoded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue