analitics

Pages

Saturday, August 27, 2016

The python module pycryptodome - part 001.

The tutorial for today come with this subject: python module pycryptodome.
According to the official website:
PyCryptodome is a self-contained Python package of low-level cryptographic primitives.
It supports Python 2.4 or newer, all Python 3 versions and PyPy.
official website.
Also this python module can be used with Windows and Linux (Ubuntu and Fedora distro linux).
I don't see anything about Mac OS - Apple OS Mac_OS - wikipedia.
First step of this tutorial:

C:\Python27\Scripts>pip install pycryptodome
Collecting pycryptodome
Downloading pycryptodome-3.4-cp27-cp27m-win_amd64.whl (7.5MB)
100% |################################| 7.5MB 88kB/s
Installing collected packages: pycryptodome
Successfully installed pycryptodome-3.4
You need to have command.com shell admin rights or you got errors:
C:\Python27\Scripts>python -m Crypto.SelfTest
Access is denied.
You can test it the instalation with:
C:\Python27>python -m Crypto.SelfTest
Skipping AESNI tests
...........................................................................................................................................................................................................................................................................................................................................................................

.......................
----------------------------------------------------------------------
Ran 22263 tests in 171.266s

OK
One simple test with this module:
C:\Python27>python.exe
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from Crypto.Cipher import AES
>>> from Crypto.Random import get_random_bytes
>>>
Most of resurces and features can be found here also can have some example at Matthew Green.
I will come with another tutorial about this python module.
Have a great day.

Thursday, August 11, 2016

Hide your info with stepic python module.

I will show a funny way to put your info into one image and then show this info.
First you need one image. I used this image:


First need to use Python 2.7 with Image ( Pillow python module) and stepic python module.
... and follow the below steps:

C:\Python27>cd Scripts
C:\Python27\Scripts>pip install Image
C:\Python27\Scripts>pip install stepic
C:\Python27\Scripts>cd ..

C:\Python27>python
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

To encode and then to show the text from one image I used this python script:


import PIL
from PIL import Image
import stepic
im=Image.open("MonaLisa.jpg")
im1 = stepic.encode(im,'The smallest feline is a masterpiece.')
im1.save('test_encode.jpg','JPEG')
im.show()
im1.show()
decoding=stepic.decode(im1)
data_encode=decoding.decode()
print data_encode