YassineYousfi
commited on
Commit
Β·
600de08
1
Parent(s):
1f2c04e
update stuff
Browse files- README copy.md +0 -2
- README.md +1 -1
- app.py +13 -4
README copy.md
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
# pySTC
|
2 |
-
A Python interface for [Syndrome Trellis Codes](http://dde.binghamton.edu/download/syndrome/) Steganography
|
|
|
|
|
|
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
title: Stego
|
3 |
-
emoji:
|
4 |
colorFrom: purple
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
|
|
1 |
---
|
2 |
title: Stego
|
3 |
+
emoji: π
|
4 |
colorFrom: purple
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
app.py
CHANGED
@@ -8,7 +8,16 @@ from PIL import Image
|
|
8 |
|
9 |
|
10 |
title = "Steganography"
|
11 |
-
description =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
def HILL(input_image, operation, message, key):
|
14 |
input_image.seek(0)
|
@@ -28,11 +37,11 @@ def HILL(input_image, operation, message, key):
|
|
28 |
[-1, 2, -1]])
|
29 |
L1 = np.ones((3, 3)).astype('float32')/(3**2)
|
30 |
L2 = np.ones((15, 15)).astype('float32')/(15**2)
|
31 |
-
costs = signal.convolve2d(I, H, mode='same')
|
32 |
costs = abs(costs)
|
33 |
-
costs = signal.convolve2d(costs, L1, mode='same')
|
34 |
costs = 1/costs
|
35 |
-
costs = signal.convolve2d(costs, L2, mode='same')
|
36 |
costs[costs == np.inf] = 1
|
37 |
stc.embed('tmp/file.png', costs, message, key, 'tmp/stego.png')
|
38 |
return 'tmp/stego.png'
|
|
|
8 |
|
9 |
|
10 |
title = "Steganography"
|
11 |
+
description = '''Explore hiding messages in images using content adaptive steganography and STCs (Syndrome Trellis Codes).
|
12 |
+
http://dde.binghamton.edu/download/syndrome/ .
|
13 |
+
We use HILL https://ieeexplore.ieee.org/document/7025854 .
|
14 |
+
Python implementation adapted from Daniel Lerch's https://github.com/daniellerch/pySTC .
|
15 |
+
To encode:
|
16 |
+
Drag and drop a PNG file, write a message and enter a key (remember the key).
|
17 |
+
To decode:
|
18 |
+
Drap and drop the stego file, enter the key.
|
19 |
+
Note that this software is supplied "as is," without any services or guaranties.
|
20 |
+
'''
|
21 |
|
22 |
def HILL(input_image, operation, message, key):
|
23 |
input_image.seek(0)
|
|
|
37 |
[-1, 2, -1]])
|
38 |
L1 = np.ones((3, 3)).astype('float32')/(3**2)
|
39 |
L2 = np.ones((15, 15)).astype('float32')/(15**2)
|
40 |
+
costs = signal.convolve2d(I, H, mode='same', boundary='symm')
|
41 |
costs = abs(costs)
|
42 |
+
costs = signal.convolve2d(costs, L1, mode='same', boundary='symm')
|
43 |
costs = 1/costs
|
44 |
+
costs = signal.convolve2d(costs, L2, mode='same', boundary='symm')
|
45 |
costs[costs == np.inf] = 1
|
46 |
stc.embed('tmp/file.png', costs, message, key, 'tmp/stego.png')
|
47 |
return 'tmp/stego.png'
|