![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
|
Text encryption
For some reason I decided to make an encryption and decryption program. The encryption will include the following:
-Password Protection -Protection against cracking the code (EG typing the alphabet and copying the code down) -varying levels of encryption -and anything else I think of along the way I'm not cancelling the flash project, that's just on hold until I can get my friend over to help me with some of the art and such (most likely this weekend). It will be written in Visual Basic (Because I don't really know anything else). Expect an alpha sometime this weekend. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
May I hope you are writing it in VB.NET? If not, you _really_ should.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
Visual Basic man? You need to broaden your languages a little bit. If you write it in VB.Net you may as well code it in C#. If you are using VB 6.0, get rid of it. You can SharpDevelop for free to help you out with VB.Net/C#. Looking forward to seeing the end result.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#4 |
|
Programmer
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 3
![]() |
I wrote a module in ruby that can encrypt string and decrypt string. if you want it, i can post it for you. then you could translate the code to another language or i could do that for you.
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
I'd be interested just to see the Ruby code... as I don't know Ruby at all.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Dec 2005
Posts: 13
Rep Power: 0
![]() |
Will you use a professional encryption algorithm, or just some monoalphabetic substitution? OpenSSL's crypto library is quite nice, I guess blowfish whould do the trick nicely. Don't now if it supports VB though (or vice versa), but that's your headache
![]()
__________________
Here comes the SWAT team, and the M-16, shoot the walls in, destroy the building. Wolverine was sad and it made him mad, every single cop got a bullet in the head. |
|
|
|
|
|
#7 | |
|
Professional Programmer
|
Quote:
Oh, and I would use a different language, but to be perfectly honest, I can't seem to get delphi or any sort of c down quite right. I figured I would wait for my studies to get to that point. But I'm getting really impatient. I wish someone would contact me on an IM to tutor me ![]() aim: BeanThingLock YIM: Indigno_Studios MSN: Kevinseth@gmail.com much love to anyone that decided to give me a hand. I don't need hard tutoring, just kinda teach me the syntax and some commands n such. ![]() |
|
|
|
|
|
|
#8 |
|
Programmer
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 3
![]() |
That is the code for it right there
class File
attr_reader :name
attr_reader :mode
alias file_int initialize
def initialize(*args)
file_int(*args)
@name = args[0]
@mode = args[1] if !args[1].nil?
@_self = self
end
def share(obj = nil)
return if obj.nil?
@_self = obj
end
end
module Serialize
W_MODE = %w[wb wb+ w+ w a]
R_MODE = %w[rb rb+ a+ a]
NOTWRITEABLE = "Instance of IO (write mode) is needed\n"
NOTREADABLE = "Instance of IO (read mode) is needed\n"
CHAR = ";"
$OPEN_N = 0
module_function
def encode(string)
return if !string.is_a?(String)
@str = string.unpack('B*')[0].tr('01', " \n")
end
def decode(string)
return if !string.is_a?(String)
[string.tr(" \n", '01')].pack('B*')
end
def save(data = nil, file = nil, depth = 0)
return if data.nil?
copyd = data#.deep_clone
check = data.is_a?(Array) || data.is_a?(String) || data.is_a?(Integer) || data.is_a?(Float)
data = data.inspect.to_s
temp = encode(data)
name = nil
mode = nil
if !file.nil?
if file.is_a?(File)
name = file.name
mode = file.mode
raise NOTWRITEABLE if file.closed? || !W_MODE.include?(mode)
if depth > 0
new_file = File.new(name,mode)
file.share(new_file)
end
file.write(temp)
file.write(CHAR)
else
raise NOTWRITEABLE
end
end
$Calls = copyd
if file.nil?
return $Calls
else
return temp
end
end
def load_save(file = nil)
msg = "No data to load\n"
line = ""
name = nil
data = nil
if !file.nil?
$Calls = nil
else
if !$Calls.nil?
return $Calls
end
end
if file.is_a?(File)
raise NOTREADABLE if file.closed? || !R_MODE.include?(file.mode)
raise msg if FileTest.size(file.name) <= 0
name = file.name
if eval("$d_name.nil?")
eval("$d_name = []; $c_name = 0")
while(true)
break if file.eof?
text = file.readline
line += text
end
eval("$d_name = line.split(CHAR)")
end
eval("data = decode($d_name[$c_name])")
eval("$c_name += 1")
if !eval("$d_name.nil?")
if eval("$c_name == $d_name.size")
eval("$c_name = nil; $d_name = nil")
end
end
begin
return eval(data)
rescue TypeError
raise msg
end
end
end
endmystring = "Hello World" myFile = File.open("filename","writemode")#filename = file to store data,mode = writemode" Serialize.save(mystring) #this store the variable for later in the memory Serialize.save(mystring,myFile) #this store the variable in a file for later #you can call serialize.save as much as you want, that mean when you are loading, you have to use the same number of call for loading or less than. any greater will not load anything. myFile.close() myFile = File.open("filename","readmode")#filename = file to store data,mode = "readmode" Serialize.load_save(myFile) |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|