Posts: 731
Threads: 128
Joined: Oct 2009
Reputation:
19
02-10-2010, 05:15 AM
(This post was last modified: 02-10-2010, 05:17 AM by Canoris.)
A little program I made to do some simple encoding.... but it keeps saying I have syntax error where the 'p' is in my 'rep' variable... and I know good and well there is no syntax error!
Code: from __future__ import division
import string
import random
while 1 > 0:
def process(op1, op2):
ran = str(random.randrange(0, 1000, 1)
rep = string.replace(op1, op2, ran)
xx = rep
aa = [xx+xx**2, xx+xx**3, xx+xx**4, xx-xx**2, xx-xx**3, xx-xx**4, xx**2+xx**3, xx**2+xx**4, xx**2-xx**3, xx**2-xx**4, xx**3+xx**4, xx**3-xx**4]
start_1 = random.choice(aa)
ex = str(start_1/4)
rr = string.replace(op1, op2, ex)
return rr
p = raw_input('>>> ')
pp = string.join(p)
n_0 = process(pp, '0')
n_1 = process(n_0, '1')
n_2 = process(n_1, '2')
n_3 = process(n_2, '3')
n_4 = process(n_3, '4')
n_5 = process(n_4, '5')
n_6 = process(n_5, '6')
n_7 = process(n_6, '7')
n_8 = process(n_7, '8')
n_9 = process(n_8, '9')
a = process(n_9, 'a')
A = process(a, 'A')
b = process(A, 'b')
B = process(b, 'B')
c = process(B, 'c')
C = process(c, 'C')
d = process(C, 'd')
D = process(d, 'D')
e = process(D, 'e')
E = process(e, 'E')
f = process(E, 'f')
F = process(f, 'F')
g = process(F, 'g')
G = process(g, 'G')
h = process(G, 'h')
H = process(h, 'H')
i = process(H, 'i')
I = process(i, 'I')
j = process(I, 'j')
J = process(j, 'J')
k = process(J, 'k')
K = process(k, 'K')
l = process(K, 'l')
L = process(l, 'L')
m = process(L, 'm')
M = process(m, 'M')
n = process(M, 'n')
N = process(a, 'N')
o = process(N, 'o')
O = process(n, 'O')
p = process(O, 'p')
P = process(p, 'P')
q = process(P, 'q')
Q = process(q, 'Q')
r = process(Q, 'r')
R = process(r, 'R')
s = process(R, 's')
S = process(s, 'S')
t = process(S, 't')
T = process(t, 'T')
u = process(T, 'u')
U = process(u, 'U')
v = process(U, 'v')
V = process(v, 'V')
w = process(V, 'w')
W = process(w, 'W')
x = process(W, 'x')
X = process(x, 'X')
y = process(X, 'y')
Y = process(y, 'Y')
z = process(Y, 'z')
Z = process(z, 'Z')
r_ = string.replace(Z, ' ', '$')
r_0 = string.replace(r_, '-', '>')
r_01 = string.replace(r_0, '.', '#')
r_1 = string.replace(r_01, '1', '-Z')
r_2 = string.replace(r_1, '2', '-Y')
r_3 = string.replace(r_2, '3', '-X')
r_4 = string.replace(r_3, '4', '+A')
r_5 = string.replace(r_4, '5', '+B')
r_6 = string.replace(r_5, '6', '+C')
r_7 = string.replace(r_6, '7', '^z')
r_8 = string.replace(r_7, '8', '^y')
r_9 = string.replace(r_7, '9', '^x')
r_0 = string.replace(r_7, '0', '_')
print(r_0)
Posts: 245
Threads: 33
Joined: Oct 2009
Reputation:
10
02-10-2010, 08:22 AM
(This post was last modified: 02-10-2010, 08:39 AM by uber1337.)
Common mistake, you overlooked a parentheses, you need to close them all.
Code: ran = str(random.randrange(0, 1000, 1)
should be:
Code: ran = str(random.randrange(0, 1000, 1))
If you don't close them all python looks at the next line to find it which happened to contain "rep", which is why you didn't know what to fix.
Edit:
Your code still has errors I can't really see what you are trying to do so I can't fix it for you but I can tell you what your doing wrong.
Code: ran = str(random.randrange(0, 1000, 1)
rep = string.replace(op1, op2, ran)
xx = rep
aa = [xx+xx**2, xx+xx**3, xx+xx**4, xx-xx**2, xx-xx**3, xx-xx**4, xx**2+xx**3, xx**2+xx**4, xx**2-xx**3, xx**2-xx**4, xx**3+xx**4, xx**3-xx**4]
Ok so basically the "**" can't be used with strings because if you think about it a string can't be raised to a power. Logically, 'hi' to the third power means 'hi' * 'hi' * 'hi', which makes no sense, if your looking just to multiply the words, just use "*", the result will be 'hihihi'.
Edit:
Also, you can't use "-" for strings, the only way to concatenate strings is with "+" and "*".
Posts: 731
Threads: 128
Joined: Oct 2009
Reputation:
19
02-10-2010, 02:52 PM
(This post was last modified: 02-10-2010, 02:57 PM by Canoris.)
(02-10-2010, 08:22 AM)uber1337 Wrote: Common mistake, you overlooked a parentheses, you need to close them all.
Code: ran = str(random.randrange(0, 1000, 1)
should be:
Code: ran = str(random.randrange(0, 1000, 1))
If you don't close them all python looks at the next line to find it which happened to contain "rep", which is why you didn't know what to fix.
Edit:
Your code still has errors I can't really see what you are trying to do so I can't fix it for you but I can tell you what your doing wrong.
Code: ran = str(random.randrange(0, 1000, 1)
rep = string.replace(op1, op2, ran)
xx = rep
aa = [xx+xx**2, xx+xx**3, xx+xx**4, xx-xx**2, xx-xx**3, xx-xx**4, xx**2+xx**3, xx**2+xx**4, xx**2-xx**3, xx**2-xx**4, xx**3+xx**4, xx**3-xx**4]
Ok so basically the "**" can't be used with strings because if you think about it a string can't be raised to a power. Logically, 'hi' to the third power means 'hi' * 'hi' * 'hi', which makes no sense, if your looking just to multiply the words, just use "*", the result will be 'hihihi'.
Edit:
Also, you can't use "-" for strings, the only way to concatenate strings is with "+" and "*". Thanks dude! I figured it out already; here is the code that actually works:
Code: from __future__ import division
import string
import random
import os
while 1 > 0:
def process(op1, op2):
ran = random.randrange(0, 1000, 1)
xx = ran
aa = [xx+xx**2, xx+xx**3, xx+xx**4, xx-xx**2, xx-xx**3, xx-xx**4, xx**2+xx**3, xx**2+xx**4, xx**2-xx**3, xx**2-xx**4, xx**3+xx**4, xx**3-xx**4]
start_1 = random.choice(aa)
ee = start_1/4
ex = str(ee)
rr = string.replace(op1, op2, ex)
return rr
p = raw_input('>>> ')
pp = string.join(p)
os.system('clear')
n_0 = process(pp, '0')
n_1 = process(n_0, '1')
n_2 = process(n_1, '2')
n_3 = process(n_2, '3')
n_4 = process(n_3, '4')
n_5 = process(n_4, '5')
n_6 = process(n_5, '6')
n_7 = process(n_6, '7')
n_8 = process(n_7, '8')
n_9 = process(n_8, '9')
a = process(n_9, 'a')
A = process(a, 'A')
b = process(A, 'b')
B = process(b, 'B')
c = process(B, 'c')
C = process(c, 'C')
d = process(C, 'd')
D = process(d, 'D')
e = process(D, 'e')
E = process(e, 'E')
f = process(E, 'f')
F = process(f, 'F')
g = process(F, 'g')
G = process(g, 'G')
h = process(G, 'h')
H = process(h, 'H')
i = process(H, 'i')
I = process(i, 'I')
j = process(I, 'j')
J = process(j, 'J')
k = process(J, 'k')
K = process(k, 'K')
l = process(K, 'l')
L = process(l, 'L')
m = process(L, 'm')
M = process(m, 'M')
n = process(M, 'n')
N = process(n, 'N')
o = process(N, 'o')
O = process(o, 'O')
p = process(O, 'p')
P = process(p, 'P')
q = process(P, 'q')
Q = process(q, 'Q')
r = process(Q, 'r')
R = process(r, 'R')
s = process(R, 's')
S = process(s, 'S')
t = process(S, 't')
T = process(t, 'T')
u = process(T, 'u')
U = process(u, 'U')
v = process(U, 'v')
V = process(v, 'V')
w = process(V, 'w')
W = process(w, 'W')
x = process(W, 'x')
X = process(x, 'X')
y = process(X, 'y')
Y = process(y, 'Y')
z = process(Y, 'z')
Z = process(z, 'Z')
a_ = process(Z, '.')
a_1 = process(a_, '!')
a_2 = process(a_1, '?')
a_3 = process(a_2, ';')
a_4 = process(a_3, ':')
a_5 = process(a_4, "'")
a_6 = process(a_5, '"')
a_7 = process(a_6, '[')
a_8 = process(a_7, "]")
a_9 = process(a_8, '/')
a_10 = process(a_9, '+')
a_11 = process(a_10, '-')
a_12 = process(a_11, ')')
a_13 = process(a_12, '(')
a_14 = process(a_13, '\\')
r_ = string.replace(a_14, ' ', '$')
r_0 = string.replace(r_, '-', '>')
r_01 = string.replace(r_0, '.', '#')
r_1 = string.replace(r_01, '1', '-Z')
r_2 = string.replace(r_1, '2', '-Y')
r_3 = string.replace(r_2, '3', '-X')
r_4 = string.replace(r_3, '4', '+A')
r_5 = string.replace(r_4, '5', '+B')
r_6 = string.replace(r_5, '6', '+C')
r_7 = string.replace(r_6, '7', '^z')
r_8 = string.replace(r_7, '8', '^y')
r_9 = string.replace(r_8, '9', '^x')
r_0 = string.replace(r_9, '0', '_')
print('\n'+r_0+'\n')
BTW, +1. You've always been helpful in the area of Python. :p
EDIT: BTW, this is only half of the project I'm doing. I have to make the decryption program now :/ If you want more details, please don't be afraid to ask!! :p
Posts: 245
Threads: 33
Joined: Oct 2009
Reputation:
10
(02-10-2010, 02:52 PM)Аноним Интерфейс Wrote: Thanks dude! I figured it out already; here is the code that actually works:
Code: from __future__ import division
import string
import random
import os
while 1 > 0:
def process(op1, op2):
ran = random.randrange(0, 1000, 1)
xx = ran
aa = [xx+xx**2, xx+xx**3, xx+xx**4, xx-xx**2, xx-xx**3, xx-xx**4, xx**2+xx**3, xx**2+xx**4, xx**2-xx**3, xx**2-xx**4, xx**3+xx**4, xx**3-xx**4]
start_1 = random.choice(aa)
ee = start_1/4
ex = str(ee)
rr = string.replace(op1, op2, ex)
return rr
p = raw_input('>>> ')
pp = string.join(p)
os.system('clear')
n_0 = process(pp, '0')
n_1 = process(n_0, '1')
n_2 = process(n_1, '2')
n_3 = process(n_2, '3')
n_4 = process(n_3, '4')
n_5 = process(n_4, '5')
n_6 = process(n_5, '6')
n_7 = process(n_6, '7')
n_8 = process(n_7, '8')
n_9 = process(n_8, '9')
a = process(n_9, 'a')
A = process(a, 'A')
b = process(A, 'b')
B = process(b, 'B')
c = process(B, 'c')
C = process(c, 'C')
d = process(C, 'd')
D = process(d, 'D')
e = process(D, 'e')
E = process(e, 'E')
f = process(E, 'f')
F = process(f, 'F')
g = process(F, 'g')
G = process(g, 'G')
h = process(G, 'h')
H = process(h, 'H')
i = process(H, 'i')
I = process(i, 'I')
j = process(I, 'j')
J = process(j, 'J')
k = process(J, 'k')
K = process(k, 'K')
l = process(K, 'l')
L = process(l, 'L')
m = process(L, 'm')
M = process(m, 'M')
n = process(M, 'n')
N = process(n, 'N')
o = process(N, 'o')
O = process(o, 'O')
p = process(O, 'p')
P = process(p, 'P')
q = process(P, 'q')
Q = process(q, 'Q')
r = process(Q, 'r')
R = process(r, 'R')
s = process(R, 's')
S = process(s, 'S')
t = process(S, 't')
T = process(t, 'T')
u = process(T, 'u')
U = process(u, 'U')
v = process(U, 'v')
V = process(v, 'V')
w = process(V, 'w')
W = process(w, 'W')
x = process(W, 'x')
X = process(x, 'X')
y = process(X, 'y')
Y = process(y, 'Y')
z = process(Y, 'z')
Z = process(z, 'Z')
a_ = process(Z, '.')
a_1 = process(a_, '!')
a_2 = process(a_1, '?')
a_3 = process(a_2, ';')
a_4 = process(a_3, ':')
a_5 = process(a_4, "'")
a_6 = process(a_5, '"')
a_7 = process(a_6, '[')
a_8 = process(a_7, "]")
a_9 = process(a_8, '/')
a_10 = process(a_9, '+')
a_11 = process(a_10, '-')
a_12 = process(a_11, ')')
a_13 = process(a_12, '(')
a_14 = process(a_13, '\\')
r_ = string.replace(a_14, ' ', '$')
r_0 = string.replace(r_, '-', '>')
r_01 = string.replace(r_0, '.', '#')
r_1 = string.replace(r_01, '1', '-Z')
r_2 = string.replace(r_1, '2', '-Y')
r_3 = string.replace(r_2, '3', '-X')
r_4 = string.replace(r_3, '4', '+A')
r_5 = string.replace(r_4, '5', '+B')
r_6 = string.replace(r_5, '6', '+C')
r_7 = string.replace(r_6, '7', '^z')
r_8 = string.replace(r_7, '8', '^y')
r_9 = string.replace(r_8, '9', '^x')
r_0 = string.replace(r_9, '0', '_')
print('\n'+r_0+'\n')
BTW, +1. You've always been helpful in the area of Python. :p
EDIT: BTW, this is only half of the project I'm doing. I have to make the decryption program now :/ If you want more details, please don't be afraid to ask!! :p Ahh now I see what your going for, quite a complicated encryption, I never quite had the stomach for those, good luck with the decryptor, and thanks Btw: If your really into encryption take a look at this
Posts: 731
Threads: 128
Joined: Oct 2009
Reputation:
19
Yep, I'm familiar with those modules; in fact, I've made a program with just those modules:
Code: #!/usr/bin/python
# -*- coding: utf-8 -*-
import hashlib
import datetime
import base64
import os
import time
#simple massege to demonstrate syntax
os.system('clear')
print('PyHashing, by: Interface')
print('---------------------------------------------------')
time.sleep(2)
print(' Syntax = [TYPE] [STRING] [HEX: Y/N]')
print('')
print(' TYPE type of encryption needed. Supported: md5 , sha224 , sha256 , sha384 , sha512 , base16 , base32 , base64')
print('')
print(' HEX whether or not hexidecimal encryption is need or not; otherwise set to default')
print('')
print(' STRING the specified string to encrypt')
#difining variables
strgz = raw_input(' Type: ')
strgt = raw_input('String: ')
strgh = raw_input(' Hex?: ')
m = 'md5'
s0 = 'sha224'
s1 = 'sha256'
s2 = 'sha384'
s3 = 'sha512'
b0 = 'base16'
b1 = 'base32'
b2 = 'base64'
no = 'n'
yes = 'y'
#user input
(strgz)
(strgt)
(strgh)
#processing of data
if ((strgz) == (s0) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha224(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s1) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha256(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s2) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha384(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s3) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha512(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (m) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.md5(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s0) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha224(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s1) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha256(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s2) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha384(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s3) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha512(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (m) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.md5(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (b0) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(base64.b16encode(strgt))
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (b1) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(base64.b32encode(strgt))
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (b2) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(base64.b64encode(strgt))
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) is not (m) and (s0) and (s1) and (s2) and (s3) and (b0) and (b1) and (b2) and (strgh) == ('')):
os.system('clear')
print('SYNTAX ERROR!')
Posts: 245
Threads: 33
Joined: Oct 2009
Reputation:
10
(02-10-2010, 03:19 PM)Аноним Интерфейс Wrote: Yep, I'm familiar with those modules; in fact, I've made a program with just those modules:
Code: #!/usr/bin/python
# -*- coding: utf-8 -*-
import hashlib
import datetime
import base64
import os
import time
#simple massege to demonstrate syntax
os.system('clear')
print('PyHashing, by: Interface')
print('---------------------------------------------------')
time.sleep(2)
print(' Syntax = [TYPE] [STRING] [HEX: Y/N]')
print('')
print(' TYPE type of encryption needed. Supported: md5 , sha224 , sha256 , sha384 , sha512 , base16 , base32 , base64')
print('')
print(' HEX whether or not hexidecimal encryption is need or not; otherwise set to default')
print('')
print(' STRING the specified string to encrypt')
#difining variables
strgz = raw_input(' Type: ')
strgt = raw_input('String: ')
strgh = raw_input(' Hex?: ')
m = 'md5'
s0 = 'sha224'
s1 = 'sha256'
s2 = 'sha384'
s3 = 'sha512'
b0 = 'base16'
b1 = 'base32'
b2 = 'base64'
no = 'n'
yes = 'y'
#user input
(strgz)
(strgt)
(strgh)
#processing of data
if ((strgz) == (s0) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha224(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s1) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha256(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s2) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha384(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s3) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha512(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (m) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.md5(strgt).digest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s0) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha224(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s1) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha256(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s2) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha384(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (s3) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.sha512(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (m) and (strgh) == (yes)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(hashlib.md5(strgt).hexdigest())
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (b0) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(base64.b16encode(strgt))
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (b1) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(base64.b32encode(strgt))
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) == (b2) and (strgh) == (no)):
os.system('clear')
print(datetime.date.today())
from time import gmtime, strftime
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
print('---------------------------------------------------')
print(base64.b64encode(strgt))
time.sleep(5)
raw_input('. . .Press Enter')
os.system('clear')
if ((strgz) is not (m) and (s0) and (s1) and (s2) and (s3) and (b0) and (b1) and (b2) and (strgh) == ('')):
os.system('clear')
print('SYNTAX ERROR!')
oohh nice . what is this for:
Code: #user input
(strgz)
(strgt)
(strgh)
Is that just to be neat? and a lot of unneeded parentheses, I guess it's comes down to coding preferences and readability, but imo I like to keep codes as short as possible, unless I'm sharing with beginners
Posts: 731
Threads: 128
Joined: Oct 2009
Reputation:
19
(02-10-2010, 08:19 PM)uber1337 Wrote: oohh nice . what is this for:
Code: #user input
(strgz)
(strgt)
(strgh)
Is that just to be neat? and a lot of unneeded parentheses, I guess it's comes down to coding preferences and readability, but imo I like to keep codes as short as possible, unless I'm sharing with beginners Actually this was my first program! So some of the programming is very redundant.
Posts: 245
Threads: 33
Joined: Oct 2009
Reputation:
10
02-11-2010, 08:30 AM
(This post was last modified: 02-11-2010, 08:36 AM by uber1337.)
(02-11-2010, 05:29 AM)Аноним Интерфейс Wrote: Actually this was my first program! So some of the programming is very redundant. ahh ok. Python is my first language so I have never really done more than I need to. You will get the hang of it after a while.
btw : I just took another quick look at your program, I don't think you can make a decryptor because of:
Code: start_1 = random.choice(aa)
For example, entering the letter "h" will spit out a different string each time, and if the encryption is different each time, it will be impossible to decrypt.
Posts: 731
Threads: 128
Joined: Oct 2009
Reputation:
19
(02-11-2010, 08:30 AM)uber1337 Wrote: ahh ok. Python is my first language so I have never really done more than I need to. You will get the hang of it after a while.
btw : I just took another quick look at your program, I don't think you can make a decryptor because of:
Code: start_1 = random.choice(aa)
For example, entering the letter "h" will spit out a different string each time, and if the encryption is different each time, it will be impossible to decrypt. LOL, I know, that why I'm writing the numbers to a file; and this will be the key file. In the decryption code I will use the keyfile with the numbers in it to reverse the algorithm.
Posts: 245
Threads: 33
Joined: Oct 2009
Reputation:
10
(02-11-2010, 07:28 PM)Аноним Интерфейс Wrote: LOL, I know, that why I'm writing the numbers to a file; and this will be the key file. In the decryption code I will use the keyfile with the numbers in it to reverse the algorithm. You mean you are writing the random.choice(aa) to a file and that will be the argument for the decryptor? Sorry I'm not to knowledgeable when it comes to decryption/encryption.
|