VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Data Encryption For Beginners

by Jonathan Roach (6 Submissions)
Category: Encryption
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (11 Votes)

Explains the basic technique used to achieve data encryption and get you on your way to understanding Cryptography in general.

Rate Data Encryption For Beginners

xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">






style='font-size:18.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'>Cryptography Primer


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>By Jonathan Roach


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Hello and welcome to
my primer article on cryptography!


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


style='font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;mso-bidi-font-family:
"Times New Roman"'>cryp-tog-ra-phy (krip-taw-graph-e)


style='font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;mso-bidi-font-family:
"Times New Roman"'>The process or skill of communicating in or deciphering


style='font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;mso-bidi-font-family:
"Times New Roman"'>secret writings or ciphers.style='font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;mso-bidi-font-family:
"Times New Roman"'>


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'>Introduction


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Prying eyes,
espionage, fraud, and theft of personal information.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>These are a few of
the reasons for concealing, masking, shadowing


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>or encrypting
information in order to minimize the chance of that


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>information being
revealed to potentially dangerous or mischievous


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>individuals/organizations.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Okay, okay... maybe
it's not that big of a deal, maybe you just want


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>to feel covert when
you send email to your friends or something.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>The method used to
achieve the above is referred to as "Cryptography",


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>and this article is
aimed at giving you a basic look into the world of


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>data encryption and
providing you with Visual Basic source code to get


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>you started on your
way.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'>What does Cryptography do?


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Cryptography
conceals or hides data in order to make it un-readable to


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>the average person,
it is used to secure documents and data by mixing


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>or scrambling the
original data into mumbo jumbo basically.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Take this generic
example of encryption, lets say you want to send an


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>email to your
friend, and you don't want anyone else to see the true


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>message you are
going to send, because... it's top secret of course.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Your original
message would look something like this:


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            "Hey Frank... I got that new
encryption handbook."


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>You would then
perform an encryption routine on the message before


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>sending your email
and the result would look something like this:


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            "Ì’ˆ/žŸ¨“ˆáÝ ??|“œ»ˆ³ßÝstyle='font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:Gulim'>?style='font-size:9.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;mso-bidi-font-family:
"Times New Roman"'>?©§† ˆ³ß?|“œ?©§†"


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>You get the idea,
the original text is all scrambled and basically not of any


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>use to anyone, or so
it appears...


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>So now you send your
encrypted mail off to Frank, if Frank is unaware of


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>encryption then he
will probably mail you back and say something along


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>the lines of
"What the heck is this stuff you sent me?".


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>However, because you
sent it off to your good buddy Frank and he is


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>using the same
encryption/decryption software that you are, and he is


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>aware of the
code/key needed to reverse your scrambled message all


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>is well and he can
view your message, while any others who may have


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>intercepted it along
the way could not, or at least had a heck of a time


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>in doing so...


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>So there you have
it, Cryptography scrambles/transforms data.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'>Cryptography Overview


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Cryptography
requires an encryption algorithm and a key; in it's basic form


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>that is.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Due to the nature of
this article I will not go into great detail on the many


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>methods of
encryption and key methods in use today but I will provide


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>you with the base
foundation for encryption/decryption.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>An encryption
algorithm is simply the engine or code that handles all of


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>the processes that
transform the original text (plaintext) into encoded text


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>(ciphertext).


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>This engine simply
performs mathematical and/or logical operations on the


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>plaintext to
transform it into the ciphertext and vice versa.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>The key as it's name
implies is just that, it is the key (code) that allows the


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>algorithm to
encrypt/decrypt data.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'>Common Cryptography Algorithms


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>There are many
different algorithms for encrypting/decrypting data in use


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>around the world
today, some of them are very complex and others are


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>more simplistic,
however they all serve the same purpose.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Below is a short
listing on some of the different cryptography algorithms;


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>DES - United States
Data Encryption Standard


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>3DES - The above,
encoded 3 times


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>RSA - Rivest, Shamir
and Adleman


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>GOST - Developed by
scientists of the former Soviet Union


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>IDEA - A component
of PGP (Pretty Good Privacy)


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>There are many more,
but the above should be a starting point for you


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>to seek out more
info on the net.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'>The One-Time Pad


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>The one-time pad is
one of the simplest encryption algorithms, it involves


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>a key being used
which is the same length as the plaintext and then using


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>simple math on the
plaintext via the key, the math could be multiplication


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>or exclusive-or
(XOR) for example;


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Dim plainText As
String


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Dim cipherKey As
String


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Dim Counter As
Integer


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Dim Char As String


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Dim keyChar As
String


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Dim cipherText As
String


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Private Sub Crypt()


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>plainText =
"CovertText"


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>cipherKey =
"password42"


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>MsgBox “Before: “
& plainText


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>'Encrypt it


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>For Counter = 1 To
Len(plainText)


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    Char = Asc(Mid(plainText, Counter, 1))


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    keyChar = Asc(Mid(cipherKey, Counter, 1))


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    cipherText = cipherText & Chr(Char Xor
keyChar)


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Next Counter


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>MsgBox “After: “
& cipherText


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>plainText =
""


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>'Decrypt it


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>For Counter = 1 To
Len(cipherText)


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    Char = Asc(Mid(cipherText, Counter, 1))


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    keyChar = Asc(Mid(cipherKey, Counter, 1))


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    plainText = plainText & Chr(Char Xor
keyChar)


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Next Counter


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>MsgBox “Back to
original: “ & plainText


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>cipherText =
""


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>End Sub


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Just copy the above
code and paste it into a new project, then add a


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>command button and
in its click event put a call to the Crypt() sub.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>As follows,


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Private Sub
Command1_Click()


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Crypt


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>End Sub


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Run the project and
click the button to see it in action.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>There is a problem
with the above encryption algorithm though, first


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>off if you want to
encrypt something that is large in size the key size


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>would also be very
large.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>For example if you
wanted to encrypt a string that is 50 characters in


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>length then your key
would also have to be 50 characters in length,


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>kind of a pain for
our good friend Frank to have to enter a 50 character


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>decoding key for a
simple message.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>This problem can be
overcome with our next topic, which deals with


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>the key length
problem by using a repeating key.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'>Repeating Key Algorithm - Viginere
Cipher


style='font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Tahoma;
mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>This type of
encryption algorithm deals with a key that repeats during


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>the
encryption/decryption process, for example the algorithm above


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>uses a character by
character algorithm, it performs math operations


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>on each character in
the plaintext and key until the length of the key


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>and plaintext is
reached - because the key and plaintext are the same


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>length.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>However with a
repeating key, our key can be any length we choose


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>as when the end of
the key is reached in our algorithm we simple start


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>again at the begin
of the key until our plaintext encryption is completed.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Take this generic
example, if our plaintext is "I have top secret codes"


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>and our key is
"Pass"; obviously the key is shorter than our plaintext.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Thus we are in our
loop to encrypt our plaintext and this is how it looks:


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            plaintext char = Istyle='mso-tab-count:1'>                        key
char = P


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            plaintext char = Spacestyle='mso-tab-count:1'>     key char = a


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            plaintext char = hstyle='mso-tab-count:1'>            key char = s


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            plaintext char = astyle='mso-tab-count:1'>            key char = s


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            plaintext char = vstyle='mso-tab-count:1'>            key char = P


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            plaintext char = estyle='mso-tab-count:1'>            key char = a


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style='mso-tab-count:1'>            plaintext char = Spacestyle='mso-tab-count:1'>     key char = s


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>You get the idea?
The key just repeats until the length of the plaintext


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>is reached. This
method is much more practical and flexible for key names


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>anyway.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Below is a sample
algorithm that uses a repeating key.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Private Sub Crypt()


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>cipherKey =
"pw201"


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>plainText =
"Top-Secret Message from Roach"


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>cipherText =
""


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>KeyIndex = 1


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>MsgBox "Before:
" & plainText, 0, "Before Encryption"


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>For Counter = 1 To
Len(plainText)


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    Char = Asc(Mid(plainText, Counter, 1))


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    keyChar = Asc(Mid(cipherKey, KeyIndex, 1))


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    cipherText = cipherText & Chr(Char Xor
keyChar)


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    KeyIndex = KeyIndex + 1


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>style="mso-spacerun: yes">    If KeyIndex > Len(cipherKey) Then
KeyIndex = 1


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Next Counter


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>MsgBox "After
Encryption: " & cipherText, 0, "Original:" & plainText


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>End Sub


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Once again you can
paste this into a new project and call the Crypt()


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>sub from a buttons
click event to try it out. To reverse the encryption


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>just run the
encrypted text back through the counter loop in place of


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>the plaintext.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Thank you for
sticking with me through this brief article on the subject,


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>I hope that you
gained a little knowledge about encryption from this.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Note: I do not claim
that you shall become an encryption expert or


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>that any of the
methods described in this article are bomb proof,


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>crack proof, water
proof... whatever, I merely wanted to share the


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>basic knowledge of
the subject.


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'> 


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Regards,


font-family:Tahoma;mso-bidi-font-family:"Times New Roman"'>Jonathan Roach




Download this snippet    Add to My Saved Code

Data Encryption For Beginners Comments

No comments have been posted about Data Encryption For Beginners. Why not be the first to post a comment about Data Encryption For Beginners.

Post your comment

Subject:
Message:
0/1000 characters