Jump to content

File:Tux ECB.png

From Wikimedia Commons, the free media repository
Tux_ECB.png (202 × 239 pixels, file size: 44 KB, MIME type: image/png)

Captions

Captions

Image of Tux encrypted using the Electronic CodeBook method

Summary

[edit]
Description
Русский: Изображение пингвина Tux, зашифрованное в режиме простой замены (Electronic CodeBook, ECB).
English: Image of Tux encrypted using the Electronic CodeBook method.
Español: Imagen de Tux cifrada por método ECB.
Date
Source Own work based on: Tux.svg
Author Larry Ewing, Garrett LeSage (SVG version), Rumpelstilzchen 666 (encryption)
Other versions
Code for «encryption»
from PIL import Image
from itertools import product
from pandas import DataFrame
import random

block_size = 3
common_blocks_ecb = {tuple([(255, 255, 255)] * block_size): ((255,  80, 215), (150, 150, 150), ( 32, 223, 156)),
                     tuple([(253, 253, 251)] * block_size): ((169, 180, 238), (255, 142,  51), ( 35, 251, 102)),
                     tuple([(  2,   2,   4)] * block_size): (( 52,  44, 216), (125, 114,  71), ( 57,  12, 140))}

random.seed(42)
image = Image.open('Tux.png')
image_pixels = image.load()
pixels = [image_pixels[col, row] for row, col in product(range(image.size[1]), range(image.size[0]))]
pixels.extend([(255, 255, 255)] * ((block_size - len(pixels) % block_size) % block_size))

blocks = DataFrame([[pixels[block_count + pixel_count] for pixel_count in range(block_size)] for block_count in range(0, len(pixels), block_size)])
unique_blocks = blocks.drop_duplicates().reset_index(drop=True)
for block in unique_blocks.itertuples(index=False, name=None):
    block_ecb = common_blocks_ecb.get(block)
    if block_ecb is None:
        block_ecb = [(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) for _ in range(block_size)]
    blocks[(blocks == block).T.sum() == block_size] = [block_ecb]

for row, col in product(range(image.size[1]), range(image.size[0])):
    i = row * image.size[0] + col
    image_pixels[col, row] = blocks[i % block_size][i // block_size]
image.save('Tux_ECB.png')

Licensing

[edit]
Larry Ewing
© The copyright holder of this file allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.

Garrett LeSage
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Rumpelstilzchen 666
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current19:29, 17 November 2022Thumbnail for version as of 19:29, 17 November 2022202 × 239 (44 KB)Rumpelstilzchen 666 (talk | contribs)Uploaded a work by [http://www.isc.tamu.edu/~lewing/ Larry Ewing], [https://github.com/garrett/Tux Garrett LeSage] (SVG version), {{u|Rumpelstilzchen 666}} (encryption) from Tux.svg with UploadWizard

The following page uses this file:

File usage on other wikis

The following other wikis use this file: