コード例 #1
0
ファイル: main.py プロジェクト: SwiftsNamesake/Steganography
def unhide(image, length, decode, size, chunksize):

	'''
	Recovers hidden data in an image.

	'''

	return (decode(unbitchunks(chunk, size, chunksize)) for chunk in islice(chunks(list(bitstream(image.load(), chunksize, image.size)), size//chunksize), 0, length))
コード例 #2
0
ファイル: main.py プロジェクト: SwiftsNamesake/Steganography
def unhide(image, length, decode, size, chunksize):
    '''
	Recovers hidden data in an image.

	'''

    return (decode(unbitchunks(chunk, size, chunksize)) for chunk in islice(
        chunks(list(bitstream(image.load(), chunksize, image.size)), size //
               chunksize), 0, length))
コード例 #3
0
ファイル: main.py プロジェクト: SwiftsNamesake/Steganography
def bitchunkSuite():
	
	'''
	Some tests I wrote to visually inspect a few bit-twiddling functions defined in this module.

	'''

	# 
	n         = 123 # Number to be smeared out
	chunksize = 2   # Size of each chunk (in bits)
	size      = 8   # Size of the number (in bits)

	# 
	# TODO: Clean this up
	print(*(('{:>%d}' % chunksize).format(str(n)) for n in range(size//chunksize)))
	print(*chunks(('{:0%sb}' % size).format(n), chunksize))
	print(*(('{:0%sb}' % chunksize).format(bits) for bits in bitchunks(n, size, chunksize)))
	for n, c in enumerate(chain(*(bitchunks(ord(c), size, chunksize) for c in 'Hello World!'))):
		print(('{:0%sb}' % chunksize).format(c), end='|' if ((n+1) % (size//chunksize)) is 0 else '')
	print()
コード例 #4
0
ファイル: main.py プロジェクト: SwiftsNamesake/Steganography
def bitchunkSuite():
    '''
	Some tests I wrote to visually inspect a few bit-twiddling functions defined in this module.

	'''

    #
    n = 123  # Number to be smeared out
    chunksize = 2  # Size of each chunk (in bits)
    size = 8  # Size of the number (in bits)

    #
    # TODO: Clean this up
    print(*(('{:>%d}' % chunksize).format(str(n))
            for n in range(size // chunksize)))
    print(*chunks(('{:0%sb}' % size).format(n), chunksize))
    print(*(('{:0%sb}' % chunksize).format(bits)
            for bits in bitchunks(n, size, chunksize)))
    for n, c in enumerate(
            chain(*(bitchunks(ord(c), size, chunksize)
                    for c in 'Hello World!'))):
        print(('{:0%sb}' % chunksize).format(c),
              end='|' if ((n + 1) % (size // chunksize)) is 0 else '')
    print()