Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password is visible when using OpenCatalog statement

Status
Not open for further replies.

ice76

Programmer
Sep 30, 2002
6
SG
Hi Dave,

I have read through the solutions you have
provided in the forums. I am particularly interested in the encrytp/decrypt
function that you wrote to prevent "clear text" password from appearing in
the macro. I do have this problem and I would like to know more about how
it works. Can you please enlighten me? Thanks.


Regards
Clarence
 
Clarence,

The current version of that macro routine to encrypt and decrypt passwords is called from a function library and looks like this:
Code:
FUNCTION Mix (string1$,action$)
' This function encrypts and decrypts strings
  Dim Res$,NxtChr$
  Dim Stepper%,NxtChrVal%,cnt%, x%
  Res$ = ""
  Select Case action$
    Case "E"
      Stepper = 1
    Case "D"
      Stepper = -1
  End Select
  cnt  = len(string1$)
  for x = 1 to cnt
    NxtChrVal% = Asc(Mid(string1$,x,1))+(x*Stepper)
    IF NxtChrVal% > 122 THEN NxtChrVal% = NxtChrVal% -75
    Res$ = Res$+Chr(NxtChrVal%)
  next x
  Mix = Res$
End function

The function is passed a text string and one of two action: D (to decrypt) or E (to encrypt). It works by subsituting a different ascii character for each character of the string based on an offset determined by the character's position in the string, i.e. the first character is offset one, making an "a" into a "b', the second by two, making a "b" into a "d", and so forth. The upper and lower bounds keep the string within the range of 0(zero) to z in the ascii set. You can modify these if you want to allow other characters.

Let me know if you have further questions.

Hope this helps,

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top