HammingStegano
stegobox.codec.HammingStegano
Bases: BaseCodec
This algorithm allows to conceal str inside image, using Hamming codes to error correct steganographically encoded data.
Originally implemented in DakotaNelson/hamming-stego
Source code in stegobox/codec/hamming_stegano/hamming_stegano.py
encode(carrier, payload)
Encoder requires carrier to be a image and payload to be a string. Encode our original message using hamming(8,4). Insert our message into the image, then blur the image to simulate compression/transmission/general data loss.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
carrier |
Image
|
Carrier image. Read with |
required |
payload |
str
|
Payload (secret message) to be encoded. |
required |
Returns:
Name | Type | Description |
---|---|---|
img_message |
Image
|
The image with the payload embedded. |
img_blurred |
Image
|
Blur the image to simulate data loss. |
payload_len |
int
|
The length of payload. |
Source code in stegobox/codec/hamming_stegano/hamming_stegano.py
decode_with_len(carrier, payload_len)
Decode the secret payload from the carrier image. extract the message (with errors) from the message, find out what the errors are thanks to hamming, and generate an error syndrome. (basically an array that says "here's where the errors are")
Parameters:
Name | Type | Description | Default |
---|---|---|---|
carrier |
Image
|
Carrier image. Read with |
required |
payload_len |
int
|
The length of payload. |
required |
Returns:
Name | Type | Description |
---|---|---|
decoded_str |
str
|
The decoded payload (secret message). |