Re: How to Write an encripted Text File???
vb Code:
Public Sub Command1_Click()
InitLUT 'this must be called before the cipher sub/function
Dim bAry() as Byte
Call FXInCipher(Form1.Text2.Text, bAry)
Open "c:\program files\visual director 2010\program\usernames\" & Form1.Text1.Text & ".pas" For Binary As #1
Put 1, 1, bAry
Close #1
End Sub
Conversely:
vb Code:
Public Sub Command1_Click()
InitLUT 'this must be called before the cipher sub/function
Dim bAry() as Byte
Open "c:\program files\visual director 2010\program\usernames\" & Form1.Text1.Text & ".pas" For Binary As #1
reDim bAry(lof(1)-1)
Get 1, 1, bAry
Close #1
msgbox FXDeCipher(bAry)
End Sub
Re: How to Write an encripted Text File???
Thanks!!
I will try what you had posted!!
Re: How to Write an encripted Text File???
Right now: It saves the binary text file.
Problem: The file's contents can't be loaded in TextBox, named: Text3.Text. User inputs the samething in Text2, then it will Command1.Enabled = True. If not, then the Command Button is never .Enabled = True.
eg:
Code:
If Form1.Text3.Text = Form1.Text2.Text Then
Form1.Command1.Enabled = True
Else
Form1.Command1.Enabled = False
End If
Re: How to Write an encripted Text File???
You have to decrypt the content of the file before assigning the contents of a file to a textbox.
vb Code:
Public Sub Command1_Click()
InitLUT 'this must be called before the cipher sub/function
Dim bAry() as Byte
Open "c:\program files\visual director 2010\program\usernames\" & Form1.Text1.Text & ".pas" For Binary As #1
reDim bAry(lof(1)-1)
Get 1, 1, bAry
Close #1
Form1.Text3.Text = FXDeCipher(bAry) 'like this
End Sub
Re: How to Write an encripted Text File???
Re: [RESOLVED] How to Write an encripted Text File???
This is how i solved it:
First I googled a hashing algorithm (I found one which is one way hashing algorithm)
Then I created a username and password, and stored the raw username and the hashed password and an access number (will tell you how i calculated this number)
When you login just hash the password and compare the username and hashed passwords combination. if they match resolve the access number.
The access number was calculated in the following way (this can be done in various ways but its the most foolproof idea i had)
I made a string with all alphabet both caps, lower case and numbers. Then I go through the username letter by letter and search for it in that alphanumeric string, adding the position in the string it is found to a variable. When all username is added up i add 4 for admin rights, 8 for level 1, 16 for level 2 and so on and so forth. to find access level when you login just perform the strign search of the username and subtract the number read from the file to the total added. if it's 4 give him admin rights, 8 levle 1 etc etc
this way even if they try to hash a password or leave it empty or something they still have to crack the "encryption" behind the access number...
Re: [RESOLVED] How to Write an encripted Text File???
Well it serves, my purpose for encription. I am quite sure that it is over 9-Bit of encription ciypher code strength.
Re: [RESOLVED] How to Write an encripted Text File???
Quote:
Originally Posted by
ThEiMp
Well it serves, my purpose for encription. I am quite sure that it is over 9-Bit of encription ciypher code strength.
Don't take this the wrong way, I do it myself at times but...
... it is considerd the height of arrogance and foolishness to write your own encryption code. It is just too easy to make a mess of or produce something very weak or flawed.
And using Asc/Chr$ here you've deisgned in a "Unicode bug" that will bite you sooner or later.
Re: [RESOLVED] How to Write an encripted Text File???
What are you talking about. Where is the bug in the source code. That has been posted???
Re: [RESOLVED] How to Write an encripted Text File???
The "bug" is that if you encrypt this way on a UK English machine, send the encryted text to say a Saudi Arabic machine, and decrypt it with your code... it will get mangled.
Just how badly depends on how many characters in the plaintext were outside the range 0 to 127 and how many within that range are mapped differently using the two codepages.
Re: [RESOLVED] How to Write an encripted Text File???
Well this is meant for plain Western English typed machines. I am going to write an add on to work with changing text formats, also for .Text .Caption and so on. But I am trying to work with it for now. But will come up with a good multi-langague written file format. Even, for things like .Text and .Captions as well. Will me multi-langague. But that will have to be written into the program. As for now, that supports my rerquirements for the file formats.
Re: [RESOLVED] How to Write an encripted Text File???
Re: [RESOLVED] How to Write an encripted Text File???
Here's a funny one too:
ASP and encryption
Quote:
What do I recommend? As both a security and VBScript expert, let me make this extremely clear:
UNDER NO CIRCUMSTANCES SHOULD YOU EVER IMPLEMENT YOUR OWN ENCRYPTION ALGORITHM. NEVER NEVER NEVER.
I assume you know who Eric Lippert is. You can blame him for little things like the FSO, major parts of the VBScript and JScript engines, VSTO, parts of C#, etc.
Re: [RESOLVED] How to Write an encripted Text File???
Quote:
Originally Posted by
dilettante
The "bug" is that if you encrypt this way on a UK English machine, send the encryted text to say a Saudi Arabic machine, and decrypt it with your code... it will get mangled.
Just how badly depends on how many characters in the plaintext were outside the range 0 to 127 and how many within that range are mapped differently using the two codepages.
that's surprising, in other basic i work (bcx) the asc and chr are only type cast,
they don't use any table to make the replacement.
only type cast,
for example:
the asc input is a string, and the output is integer/byte
chr input is integer/byte and the output is string
are you saying, in vb these functions use a table to make the converting ?
do they use api for that ?
Re: [RESOLVED] How to Write an encripted Text File???
Not sure, I didn't write it???
Re: [RESOLVED] How to Write an encripted Text File???
i'm sorry, i referred to dilettante