Created
July 2, 2014 04:11
-
-
Save oscarmcm/03bd27d3d52941a6f90a to your computer and use it in GitHub Desktop.
simple encripter in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
# -*- coding:UTF-8 -*- | |
import sys, base64, hashlib, hmac | |
from string import maketrans | |
#Codificacion con maketrans | |
MtuX=maketrans("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789","mab1c2z3k4h5f6s7p8i9y0rewqQW]RT[UI$%A(D-G)JK Z#CVB/M@&\*.;_^{}") | |
#Decodificación con makeTrans | |
Mtux=maketrans("mab1c2z3k4h5f6s7p8i9y0rewqQW]RT[UI$%A(D-G)JK Z#CVB/M@&\*.;_^{}","abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") | |
class palabra: | |
def __init__(self,string): | |
self.string = string | |
print 'Has introducido la palabra: ', string | |
def md5(self): | |
print 'MD5>>> ' ,hashlib.md5(cript).hexdigest() | |
def code_base64(self): | |
print 'Encriptado Base64>>> ',base64.b64encode(cript) | |
def decode_base64(self): | |
print 'Decodificado Base64>>>',base64.b64decode(cript) | |
def mtux(self): | |
print 'Encriptado MtuX>>> ',cript.translate(MtuX) | |
def dmtux(self): | |
print 'Decodificado MtuX>>> ',cript.translate(Mtux) | |
def sha1(self): | |
print 'sha>>> ',hashlib.sha1(cript).hexdigest() | |
def sha256(self): | |
print 'sha256>>> ',hashlib.sha256(cript).hexdigest() | |
def sha384(self): | |
print 'sha384>>> ',hashlib.sha384(cript).hexdigest() | |
def sha512(self): | |
print 'sha512>>> ',hashlib.sha512(cript).hexdigest() | |
def Hmac(self): | |
print 'hmac>>> ',hmac.new(cript).hexdigest() | |
cript=raw_input('Palabra: ') | |
cripty=palabra(cript) | |
print ''' | |
Convertir a: | |
---------------------| | |
[1] md5 | | |
---------------------| | |
[2] Base64 | | |
[3] Dec. Base64 | | |
---------------------| | |
[4] ZtuX | | |
[5] Dec. ZtuX | | |
---------------------| | |
[6] sha1 | | |
[7] sha256 | | |
[8] sha384 | | |
[9] sha512 | | |
[10] hmac | | |
---------------------- | |
''' | |
opc = input('Que deseas hacer[?]\n>>> ') | |
if opc == 1: | |
cripty.md5() | |
elif opc == 2: | |
cripty.code_base64() | |
elif opc == 3: | |
cripty.decode_base64() | |
elif opc == 4: | |
cripty.mtux() | |
elif opc == 5: | |
cripty.dmtux() | |
elif opc == 6: | |
cripty.sha1() | |
elif opc == 7: | |
cripty.sha256() | |
elif opc == 8: | |
cripty.sha384() | |
elif opc == 9: | |
cripty.sha512() | |
elif opc == 10: | |
cripty.Hmac() | |
else: | |
exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment