Skip to content

wg481/free-speech-flag-maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Free Speech Flag Maker

A Python script that turns your given hexedecimal string into a Free Speech Flag.

A free speech flag uses three hex bytes of a given input to represent a those three bytes as a hex color (#ffffff). This will automatically convert your hex bytes string into a flag. The bytes that can't be made into a color (always one or two bytes) will be printed to the console.

Usage

First, prep your input.txt by removing the spaces in between your bytes.

For example:
02 0f ff 1a 0a bc ad 11 ff dd 0a 0a 9e ee ff needs to be turned into 020fff1a0abcad11ffdd0a0a9eeeff. Use Notepad++ to replace all spaces and line breaks.

Now, install the dependency and run the script.

pip install pillow
python3 encoder.py input.txt output.png

Here's our example output:

alt text

Bar 1: #020fff
Bar 2: #1a0abc
Bar 3: #ad11ff
Bar 4: #dd0a0a
Bar 5: #9eeeff

Notes

Images are hardcoded at 1920x1080, and self-subdivide. Maybe don't try to make a flag out of 5760 bytes of code...?

Decoder

The decoder script can take a Free Speech flag as an input and output the key within it. It does this by reading the top row of pixels and looking for color changes in X, then splits them into an array with a width of 16 hex pairs separated by spaces.

Decoder Usage:

decoder.py input.png output.txt [--leftovers=xx | xxxx]

--leftovers=xx | xxxx is an optional argument that allows you to put the one or two remaining bytes traditionally appeneded in the corner into the output. i.e. ---leftovers=2abb will append 2a bb to the end of output.txt.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages