status: hidden
title: Cybersécurité — Cryptography Solutions
slug: crypto-solutions-jooT8pheejo7eev.html
robots: noindex


## Hexdump

    $ echo '/crypto-eithei7AiGi1Nei.html' | hexdump -C
    00000000  2f 63 72 79 70 74 6f 2d  65 69 74 68 65 69 37 41  |/crypto-eithei7A|
    00000010  69 47 69 31 4e 65 69 2e  68 74 6d 6c 0a           |iGi1Nei.html.|
    0000001d

    >>> ''.join([chr(int(x, 16)) for x in '2f 63 72 79 70 74 6f 2d 65 69 74 68 65 69 37 41 69 47 69 31 4e 65 69 2e 68 74 6d 6c 0a'.split()])
    '/crypto-eithei7AiGi1Nei.html\n'


## Rail Fence

    /crypto-UNgoo7olouheiHi.html

    /   p   U   o   o   i   h
     c y t - N o 7 l u e H . t l
      r   o   g   o   h   i   m

    /pUooihcyt-No7lueH.tlrogohim


/pUooihcyt-No7lueH.tlrogohim


## Mandatory Cæsar

    >>> ''.join([chr(3 + ord(x)) for x in "/crypto-Ohchae7Ohku9aQu.html"])
    2fu|swr0Rkfkdh:Rknx<dTx1kwpo

    >>> ''.join([chr(ord(x) - 3) for x in '2fu|swr0Rkfkdh:Rknx<dTx1kwpo'])
    '/crypto-Ohchae7Ohku9aQu.html'


## ASCII Translation

    >>> plaintext = '/crypto-ahzooCeeghie4od.html'
    >>> [ord(x) - min(ord(x) for x in plaintext) for x in plaintext]
    [2, 54, 69, 76, 67, 71, 66, 0, 52, 59, 77, 66, 66, 22, 56, 56, 58, 59, 60, 56, 7, 66, 55, 1, 59, 71, 64, 63]


    >>> for i in range(50):
    ...     ''.join([chr(i + int(x)) for x in '2, 54, 69, 76, 67, 71, 66, 0, 52, 59, 77, 66, 66, 22, 56, 56, 58, 59, 60, 56, 7, 66, 55, 1, 59, 71, 64, 63'.replace(',', ' ').split()])


## XOR

    >>> plaintext = '/crypto-ohnachu0Aithor9.html'
    >>> [ord(x) ^ 0b00110011 for x in plaintext]
    [28, 80, 65, 74, 67, 71, 92, 30, 92, 91, 93, 82, 80, 91, 70, 3, 114, 90, 71, 91, 92, 65, 10, 29, 91, 71, 94, 95]


    >>> 28 ^ ord('/')
    51
    >>> ''.join([chr(int(x) ^ 51) for x in '28, 80, 65, 74, 67, 71, 92, 30, 92, 91, 93, 82, 80, 91, 70, 3, 114, 90, 71, 91, 92, 65, 10, 29, 91, 71, 94, 95'.split(', ')])
    '/crypto-ohnachu0Aithor9.html'


## Route Cipher

    /crypto-fa6tuodiethaiZ1.html

    /crypto
    -fa6tuo
    diethai
    Z1.html

    >>> plaintext = '/crypto-fa6tuodiethaiZ1.html'
    >>> grid = list(zip(*[iter(plaintext)]*7))
    >>> for j in range(7):
    ...     for i in range(4):
    ...         print(grid[i][j], end='')
    ...
    /-dZcfi1rae.y6thpthttuamooil


## JPEG comment


/crypto-pohxoh6Waegidoh.html

    sha1sum content/pages/stegano/meta.jpg
    3ff77e558b89d0901b01ac7891a32fea28aef88f  content/pages/stegano/meta.jpg

    (pelican-mdk) mdk@windhowl (master)$ hexdump -C content/pages/stegano/meta.jpg | grep -C2 html
    00000240  fd a3 00 00 03 dc 00 00  c0 6e ff fe 00 1e 2f 63  |.........n..../c|
    00000250  72 79 70 74 6f 2d 70 6f  68 78 6f 68 36 57 61 65  |rypto-pohxoh6Wae|
    00000260  67 69 64 6f 68 2e 68 74  6d 6c ff db 00 43 00 08  |gidoh.html...C..|
    00000270  06 06 07 06 05 08 07 07  07 09 09 08 0a 0c 14 0d  |................|
    00000280  0c 0b 0b 0c 19 12 13 0f  14 1d 1a 1f 1e 1d 1a 1c  |................|


## PNG bits

/crypto-oopheeS9Pih1se7.html

    >>> plaintext = '/crypto-oopheeS9Pih1se7.html'
    >>> binary_plaintext = ''.join("{:08b}".format(ord(c)) for c in plaintext)
    >>> input = cv2.imread('cat.png')
    >>> for i, b in enumerate(binary_plaintext):
    ...     input[0][i][2] = (input[0][i][2] & 0b11111110) + int(b)
    ...
    >>> cv2.imwrite('cat2.png', input)
    True


And in reverse:

    >>> import cv2
    >>> cat = cv2.imread('cat.png')
    >>> low_bits = [pixel[2] & 1 for pixel in cat[0]]
    >>> bytes = list(zip(*[iter(low_bits)]*8))
    >>> ''.join([chr(int(''.join(str(bit) for bit in bits), 2)) for bits in bytes])
    '/crypto-oopheeS9Pih1se7.html#É\x1a{Ú«'
