Encrypt function:
- One parameter is passed to it, defined as a string, and its called
strCryptThis
- set the encryption key (g_key) = "ISSUETRK"
- for each character in strCryptThis, have a counter ( =1 ) going and
do the following:
- take the ASCII value of the letter that the counter equals to in
g_key. assign this to the variable iKeyChar
ex: if counter=1 then take the ascii value of "I", if
counter=2, then take the ascii value of "S" and so on
- do the same as above except now do it for strCryptThis. assign it to
iStringChar
- take iKeyChar and XOR it with iStringChar and assign it to
iCryptChar
- take the charactorCode equivalent of iCryptChar and reassign it back
to iCryptChar
- take the ASCII equivalent of iCryptChar and reassign it back to
iCryptChar
here you should now have a number (still in a string format though).
- if iCryptChar is less than 10 then pad two zeros to the beginning of
it
ex: if iCryptChar is 6 then iCryptChar = "006"
- if iCryptChar is less than 100, then pad one zero to the beginning
of it
ex: if iCryptChar is 74 then iCryptChar = "074"
- concatenate this value to a variable strEncrypted
- increment the counter and repeat above steps for each charactor of
strCryptThis
- return strEncrypted
thanks Pat
- One parameter is passed to it, defined as a string, and its called
strCryptThis
- set the encryption key (g_key) = "ISSUETRK"
- for each character in strCryptThis, have a counter ( =1 ) going and
do the following:
- take the ASCII value of the letter that the counter equals to in
g_key. assign this to the variable iKeyChar
ex: if counter=1 then take the ascii value of "I", if
counter=2, then take the ascii value of "S" and so on
- do the same as above except now do it for strCryptThis. assign it to
iStringChar
- take iKeyChar and XOR it with iStringChar and assign it to
iCryptChar
- take the charactorCode equivalent of iCryptChar and reassign it back
to iCryptChar
- take the ASCII equivalent of iCryptChar and reassign it back to
iCryptChar
here you should now have a number (still in a string format though).
- if iCryptChar is less than 10 then pad two zeros to the beginning of
it
ex: if iCryptChar is 6 then iCryptChar = "006"
- if iCryptChar is less than 100, then pad one zero to the beginning
of it
ex: if iCryptChar is 74 then iCryptChar = "074"
- concatenate this value to a variable strEncrypted
- increment the counter and repeat above steps for each charactor of
strCryptThis
- return strEncrypted
thanks Pat
Comment