def encrypt(data_type): # create hmac from the supplied mac password hashed with SHA-256 # digest algorithm and the supllied image or text data h_mac = create_hmac(args['m'], bytes(data)) # join hmac and message data secret = '%s--:--%s' % (h_mac, data) # create a SHA-256 hash of the high-order 128 bit of the given password key = hash_128_bit_pass(args['k']) # encrypt the data using XTEA algorithm in CFB mode with the 128 bit # SHA-256 hash of the password as key and a random seed of 8 bytes iv = os.urandom(8) encrypted_secret = crypt(key, secret, iv) # prepend the iv to the encrypted data because it is required for # the decryption and hide the data in the image matroschka = stg.hide_msg( image, '%s--:--%s--:--%s' % (data_type, iv, encrypted_secret)) # save the image containing the embeded and encrypted # data to disk with the extension .ste matroschka.save(args['image']) print "successfully encrypted your secret message" matroschka.show()
def encrypt(data_type): # create hmac from the supplied mac password hashed with SHA-256 # digest algorithm and the supllied image or text data h_mac = create_hmac(args['m'], bytes(data)) # join hmac and message data secret = '%s--:--%s' % (h_mac, data) # create a SHA-256 hash of the high-order 128 bit of the given password key = hash_128_bit_pass(args['k']) # encrypt the data using XTEA algorithm in CFB mode with the 128 bit # SHA-256 hash of the password as key and a random seed of 8 bytes iv = os.urandom(8) encrypted_secret = crypt(key, secret, iv) # prepend the iv to the encrypted data because it is required for # the decryption and hide the data in the image matroschka = stg.hide_msg(image, '%s--:--%s--:--%s' % ( data_type, iv, encrypted_secret)) # save the image containing the embeded and encrypted # data to disk with the extension .ste matroschka.save(args['image']) print "successfully encrypted your secret message" matroschka.show()
def encrypt(data_type): h_mac = create_hmac(args['m'], bytes(data)) secret = '%s--:--%s' % (h_mac, data) key = hash_128_bit_pass(args['k']) iv = os.urandom(8) encrypted_secret = crypt(key, secret, iv) dark = stg.hide_msg(image, '%s--:--%s--:--%s' % (data_type, iv, encrypted_secret)) dark.save(args['image']) print "Cifrado con éxito su mensaje secreto" dark.show()
def encrypt(data_type): print "encryption called ... " igest algorithm and the supllied image or text data h_mac = create_hmac(args['m'], bytes(data)) secret = '%s--:--%s' % (h_mac, data) key = hash_128_bit_pass(args['k']) iv = os.urandom(8) encrypted_secret = crypt(key, secret, iv) matroschka = stg.hide_msg(image, '%s--:--%s--:--%s' % (data_type, iv, encrypted_secret)) print "length of the arguement is ", len(args['k']) matroschka.save(args['image']) print "message saved at path " + str(args['image']) print "successfully encrypted your secret message"