Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases > Coding Snippets
You last visited: Today at 01:24

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Really small en/decode program written in python

Discussion on Really small en/decode program written in python within the Coding Snippets forum part of the Coding Releases category.

Reply
 
Old   #1
 
newchild's Avatar
 
elite*gold: 0
Join Date: Oct 2012
Posts: 151
Received Thanks: 42
Exclamation Really small en/decode program written in python

Yes I know this is not a masterpiece of codes(It is full of bugs, has ugly namings and an unproper use of Object-oriented programming) but it still can be useful as a bad example.
Code:
class encode(object):
    def __init__(self,list=[],real_list=[]):
        self.list=list
        self.real_list=real_list



    def stringtofloat(self,string):
        if string.lower()=='a':
            self.l=1*self.key
        if string.lower()=='b':
            self.l=2*self.key
        if string.lower()=='c':
            self.l=3*self.key
        if string.lower()=='d':
            self.l=4*self.key
        if string.lower()=='e':
            self.l=5*self.key
        if string.lower()=='f':
            self.l=6*self.key
        if string.lower()=='g':
            self.l=7*self.key
        if string.lower()=='h':
            self.l=8*self.key
        if string.lower()=='i':
            self.l=9*self.key
        if string.lower()=='j':
            self.l=10*self.key
        if string.lower()=='k':
            self.l=11*self.key
        if string.lower()=='l':
           self.l=12*self.key
        if string.lower()=='m':
            self.l=13*self.key
        if string.lower()=='n':
            self.l=14*self.key
        if string.lower()=='o':
            self.l=15*self.key
        if string.lower()=='p':
            self.l=16*self.key
        if string.lower()=='q':
            self.l=17*self.key
        if string.lower()=='r':
           self.l=18*self.key
        if string.lower()=='s':
            self.l=19*self.key
        if string.lower()=='t':
            self.l=20*self.key
        if string.lower()=='u':
            self.l=21*self.key
        if string.lower()=='v':
            self.l=22*self.key
        if string.lower()=='w':
            self.l=23*self.key
        if string.lower()=='x':
            self.l=24*self.key
        if string.lower()=='y':
            self.l=25*self.key
        if string.lower()=='z':
            self.l=26*self.key
        self.list+=[self.l]

    def encode(self):
        text=input('text')
        self.key=int(input('key(numbers only)'))
        for i in range(len(text)):
            self.stringtofloat(text[i])
            helpervar=self.list[i]
            self.real_list+=[helpervar]
        print(self.list)

class decode(object):
    def __init__(self,string='',real_string=''):
        self.string=string
        self.real_string=real_string

    def floattostring(self,float):
        if float==0:
            self.l=' '
        if float==1:
            self.l='A'
        if float==2:
            self.l='B'
        if float==3:
            self.l='C'
        if float==4:
            self.l='D'
        if float==5:
            self.l='E'
        if float==6:
            self.l='F'
        if float==7:
            self.l='G'
        if float==8:
            self.l='H'
        if float==9:
            self.l='I'
        if float==10:
            self.l='J'
        if float==11:
            self.l='K'
        if float==12:
            self.l='L'
        if float==13:
            self.l='M'
        if float==14:
            self.l='N'
        if float==15:
            self.l='O'
        if float==16:
            self.l='P'
        if float==17:
            self.l='Q'
        if float==18:
            self.l='R'
        if float==19:
            self.l='S'
        if float==20:
            self.l='T'
        if float==21:
            self.l='U'
        if float==22:
            self.l='V'
        if float==23:
            self.l='W'
        if float==24:
            self.l='X'
        if float==25:
            self.l='Y'
        if float==26:
            self.l='Z'
        self.string+=self.l

    def decode(self,text=[]):
        counter=int(input('Number of numbers(lol)'))
        for x in range(counter):
            local_string=str(x+1)+'Number'
            text+=[input(local_string)]
        self.key=int(input('key(numbers only)'))
        for i in range(len(text)):
            self.floattostring(float(text[i])//self.key)
            helpervar=self.string[i]
            self.real_string+=helpervar
        print(self.real_string)
So you might want to have a look at this
newchild is offline  
Old 04/20/2014, 09:02   #2
 
LovecKrys's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 210
Received Thanks: 199
Here you should write text = str(input('text')) instead of text=input('text'), then it's not needed to write the input text int "" xD
LovecKrys is offline  
Reply


Similar Threads Similar Threads
small hot key program
07/04/2012 - .NET Languages - 1 Replies
i want to make a small hot key program to sit on top of all windows so i can play Dark Orbit and have as many hot keys as i want and not just 10. i have never made a program but i have made several websites so i know a little bit about codes. i have VB downloaded and i thin what i need to start off with is how do i make a link between my button and the function in game?
RLS: Zoomhack with signature scanning, 1 byte patch. Written in python
01/09/2012 - League of Legends - 0 Replies
from struct import * def bytes_from_file(filename, chunksize=8192): with open(filename, "rb") as f: while True: chunk = f.read(chunksize) if chunk: for b in chunk: yield b else:
[Small-Release] Re-written walk method.
02/05/2009 - CO2 PServer Guides & Releases - 12 Replies
Im pretty sure everyone have seen the walk code in LOTF. Well I rewrote one because I was really really bored, so I decided to do this shit. Its probably the best walk code released so far and yeah, enjoy. Small release as I said, should work in any source with a small adjustment. Edit : Removed the old one because it wasnt working as I thought ( didnt tested ) Heres one that works almost perfect:



All times are GMT +1. The time now is 01:25.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.