encryption and decryption

I am putting my code from my project on here to ask for help..........
i want to use letters and not symbols and every time i encrypt it it uses symbols.

so please someone help me by altering or adjusting my code to help it just use letters

Snd.PlaySound "C:sounds ada.wav"
Message = Text1.Text
Key = Text2.Text
For i = 1 To Len(Message)
If Text2.Text = "" Then GoTo num
textChar = Mid(Message, i, 1)
keyChar = Mid(Key, (i Mod Len(Key)) + 1)
encryptedChar = Asc(textChar) Xor Asc(keyChar)
EncryptedMessage = EncryptedMessage & Chr(encryptedChar)
Next
Text3.Text = EncryptedMessage
GoTo past
num:
MsgBox ("Please enter an Encryption Key")
past:


thank you for your help!!!

Comments

  • [b][red]This message was edited by NIN666 at 2004-1-7 10:53:33[/red][/b][hr]
    : I am putting my code from my project on here to ask for help..........
    : i want to use letters and not symbols and every time i encrypt it it uses symbols.
    :
    : so please someone help me by altering or adjusting my code to help it just use letters
    :
    : Snd.PlaySound "C:sounds ada.wav"
    : Message = Text1.Text
    : Key = Text2.Text
    : For i = 1 To Len(Message)
    : If Text2.Text = "" Then GoTo num
    : textChar = Mid(Message, i, 1)
    : keyChar = Mid(Key, (i Mod Len(Key)) + 1[red],1[/red])
    : encryptedChar = [red]Chr([/red]Asc(textChar) Xor Asc(keyChar)[red])[/red]
    : EncryptedMessage = EncryptedMessage [red]+ encryptedChar[/red]
    : Next
    : Text3.Text = EncryptedMessage
    : GoTo past
    : num:
    : MsgBox ("Please enter an Encryption Key")
    : past:
    :
    :
    : thank you for your help!!!
    :

    Look at the red and try that, I think it's what you are asking for.
    [hr]Ethereal software and Mag monitors, doesn't get much better now does it?



  • : Look at the red and try that, I think it's what you are asking for.

    Nope. In VB (which is what he's using), those two lines are essentially identical to what he already had. I think what he's after is input validation/filtering though he's not yet responded to my post.
  • : : Look at the red and try that, I think it's what you are asking for.
    :
    : Nope. In VB (which is what he's using), those two lines are essentially identical to what he already had. I think what he's after is input validation/filtering though he's not yet responded to my post.
    :


    Well I've written encryption programs before, in VB too, and if that's not what he wanted I don't think I know what he actually wants. =/
    [hr]Ethereal software and Mag monitors, doesn't get much better now does it?

  • hey guys that was close but i want to be able to take the symbols out all of them and just have letters thats it just letters.

    The corrections that were made was what i was looking for but i would like to take out a few more symbols using the mod function


  • : hey guys that was close but i want to be able to take the symbols out all of them and just have letters thats it just letters.
    :
    : The corrections that were made was what i was looking for but i would like to take out a few more symbols using the mod function
    :
    :
    :

    That is another problem altogether. If I understand right now, you want to only have a-z A-Z 0-9?
    [hr]Ethereal software and Mag monitors, doesn't get much better now does it?

  • : That is another problem altogether. If I understand right now, you want to only have a-z A-Z 0-9?
    : [hr]Ethereal software and Mag monitors, doesn't get much better now does it?
    :
    :
    yeah thats exactly what i want to use a-z A-Z 0-9 and that is it
    would i have to change my code all together
    or not?
    thanks

  • [b][red]This message was edited by NIN666 at 2004-1-9 12:10:38[/red][/b][hr]
    : : That is another problem altogether. If I understand right now, you want to only have a-z A-Z 0-9?
    : : [hr]Ethereal software and Mag monitors, doesn't get much better now does it?
    : :
    : :
    : yeah thats exactly what i want to use a-z A-Z 0-9 and that is it
    : would i have to change my code all together
    : or not?
    : thanks
    :
    :

    I would recommend you writing your own function for adding to the characters and subtracting so that it bound the character to those ranges, I believe they are in some sort of sequential order, but if not you just make sure it jumps over characters it shouldnt use. Know what I mean? Sort of like writing a specific Xor function, this may not be the easiest way to fix the problem, but it would work.


    [hr]Ethereal software and Mag monitors, doesn't get much better now does it?



  • : : That is another problem altogether. If I understand right now, you want to only have a-z A-Z 0-9?
    : : [hr]Ethereal software and Mag monitors, doesn't get much better now does it?
    : :
    : :
    : yeah thats exactly what i want to use a-z A-Z 0-9 and that is it
    : would i have to change my code all together
    : or not?

    How about this? Create a 62-character string containing the characters 0-9, A-Z and a-z in ascii order. To encrypt a character, look it up in the string with INSTR() and add (MOD 62) a key value to the result, then output the character at that position.

    Note that this is an extremely weak cypher. If, instead of a constant key value, you use a sequence of random (*really* random, from coin-flipping, a BINGO machine, etc.) values as long as the message, it becomes an extremely strong cypher called a "one-time pad." If the key sequence is truly random, and you use each sequence for just one message, a one-time pad isn't even theoretically crackable, even with infinite resources, because a cyphertext could represent *any* message of the same length, and there is no way to decide (without the key) which one is correct.

    Between these extremes, various methods can be used to convert a short key into a pseudorandom sequence. If you're serious, Bruce Schneier's "Applied Cryptography", 2nd ed., will tell you more than you probably want to know about modern computer crypto.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories