Esempio n. 1
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Tanmoy Das Gupta, Sandeepan Sengupta, Tamojit Saha
"""

from configurator import configurator as cfgr
CHANNEL, PLANE, SCOPE, BUFFER = cfgr('setup.cfg')


def bitplane(image_file='image.tiff', DPI=1000, channel=CHANNEL, plane=PLANE):
    """
    Usage:
    bitplane('image.tiff', 1000)
    bitplane('image.tiff', 500, 'R', 0)
    """

    import os
    from slicer import slicer as slc
    import numpy as np
    #from matplotlib.pyplot import imsave,imshow
    import matplotlib.pyplot as plt
    import matplotlib.cm as cm

    base = os.path.basename(image_file)

    bit_array = slc(image_file, channel, plane)
    bit_array = np.reshape(bit_array, (-1, 512))
    #imshow(bit_array)
    name = os.path.splitext(base)[0]
Esempio n. 2
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Tanmoy Das Gupta, Sandeepan Sengupta, Tamojit Saha
"""

from numpy import uint8

from configurator import configurator as cfgr
CHANNEL, PLANE, SCOPE, BUFFER = cfgr('setup.cfg')
SIGMA, BETA, RHO, DT = cfgr('chaos.cfg')


def salt(key, space):
    """
    Test usage:
    salt(initial position of a chaotic system in Cartesian, no. of output bits)
    salt([1, 0.2, -3], 64)
    """
    if space < 0:
        return None
    from numpy import zeros, remainder
    dt = DT

    xs = zeros((space + 1, ))
    ys = zeros((space + 1, ))
    zs = zeros((space + 1, ))

    xs[0], ys[0], zs[0] = key[0], key[1], key[2]

    for i in xrange(space):
Esempio n. 3
0
# -*- coding: utf-8 -*-
"""
@author: Sandeepan
"""

from configurator import configurator as cfgr
SIGMA, BETA, RHO, ALPHA, GAMMA, DT, MSG_FILE = cfgr('setup.cfg')


def hide(info):

    from binascii import hexlify
    from numpy import zeros

    input_information = info

    hex_data = hexlify(input_information)
    temp = zeros(len(hex_data)).astype('str')
    for i in range(len(hex_data)):
        temp[i] = hex_data[i]
    for j in range(len(temp)):
        if temp[j] == '0': temp[j] = '0000'
        if temp[j] == '1': temp[j] = '0001'
        if temp[j] == '2': temp[j] = '0010'
        if temp[j] == '3': temp[j] = '0011'
        if temp[j] == '4': temp[j] = '0100'
        if temp[j] == '5': temp[j] = '0101'
        if temp[j] == '6': temp[j] = '0110'
        if temp[j] == '7': temp[j] = '0111'
        if temp[j] == '8': temp[j] = '1000'
        if temp[j] == '9': temp[j] = '1001'
Esempio n. 4
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Tanmoy Das Gupta, Sandeepan Sengupta, Tamojit Saha
"""

from configurator import configurator as cfgr

SIGMA, BETA, RHO, DT = cfgr('chaos.cfg')


def lorenz(x, y, z):
    """
    Test usage:
    lorenz(x_position, y_position, z_position)
    """
    sigma = SIGMA
    beta = BETA
    rho = RHO

    x_dot = sigma * (y - x)
    y_dot = x * (rho - z) - y
    z_dot = x * y - beta * z

    return x_dot, y_dot, z_dot
Esempio n. 5
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Tanmoy Das Gupta, Sandeepan Sengupta, Tamojit Saha
"""

import os
import numpy as np

from matplotlib.pyplot import imread, imsave

setup_file = 'setup.cfg'
from configurator import configurator as cfgr
CHANNEL, PLANE, SCOPE, BUFFER = cfgr(setup_file)

MSG_FILE = 'msg.txt'
IMAGE_FILE = 'image.tiff'


#==============================================================================
# Channel Auto-Selection Module
#==============================================================================
def validate(msg_file=MSG_FILE, image_file=IMAGE_FILE, channel=CHANNEL):
    from coder import hide
    msg_bin = hide(msg_file)
    msg_length = len(msg_bin)

    from entropy import ENTROPY

    from analyze import analyze
    address_r, chunk_r = analyze(msg_length, 'image.tiff', 'R')