Page 2 of 2 <12
Topic Options
#130969 - 2004-12-10 12:10 AM Re: Masking User ID
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I give up trying to follow this thread. You guys are all on drugs.

Waddup with the $letter var anyway? It's not used further down.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#130970 - 2004-12-10 12:23 AM Re: Masking User ID
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
lmao...no drugs here. I believe he just has some IDs that start with Z followed by numbers and some that are only numbers or that begin with a different letter. If the ID does start with a Z then add 26 to the beginning as in my last posted code. Then again he may have wanted the 26 added even sooner than I did...Something more like...

Code:

?"Enter USer ID : "Gets $userid
If InStr ($userid,"z")
$letter="26"
EndIf
$number=Val($letter+SubStr($userid,2,8))
? $number
$moduserid=$number+334455
? 'Mod User ID: ' + $moduserid



Which if I enter Z1234 for the ID it returns 261234 for $number and 595689 for the final $moduserid. Of course this is mostly all on assumptions.

Top
#130971 - 2004-12-10 03:31 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
Sorry about the confusion I created on this thread. I was trying to work with the $number variable and I forgot to put in the last line for $letter. Citrixman got the therory right, I did not realize the substr would be treated as text and it was throwing me off on the final results. By adding VAR to the substr it allowed 334455 to be added to
$number.
_________________________
I haven't failed. I just found another way that did not work.

Top
#130972 - 2004-12-10 05:28 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
After all of the talk on this thread here is a sample of what I came up with for masking the userid. The $modletter was just a number that I picked out of a hat for a starting point.

Code:

Function Encrypt()
$encrypt=1234567
$letter = SubStr (@USERID,1,1)
$number=Val(SubStr (@USERID,2,10))
Select
Case $letter="a"
$modletter="4791"
Case $letter="b"
$modletter="1974"
Case $letter="c"
$modletter="4792"
Case $letter="d"
$modletter="2974"
Case $letter="e"
$modletter="4793"
Case $letter="f"
$modletteg="3974"
Case $letter="h"
$modletter="4794"
Case $letter="i"
$modletter="4974"
Case $letter="j"
$modletter="4795"
Case $letter="k"
$modletter="5974"
Case $letter="l"
$modletter="4796"
Case $letter="m"
$modletter="6974"
Case $letter="n"
$modletter="4797"
Case $letter="o"
$modletter="7974"
Case $letter="p"
$modletter="4798"
Case $letter="q"
$modletter="8974"
Case $letter="r"
$modletter="4799"
Case $letter="s"
$modletter="9947"
Case $letter="t"
$modletter="4801"
Case $letter="u"
$modletter="1084"
Case $letter="v"
$modletter="4802"
Case $letter="w"
$modletter="2084"
Case $letter="x"
$modletter="4803"
Case $letter="y"
$modletter="3084"
Case $letter="z"
$modletter="4804"
EndSelect
$moduserid=$modletter+($number+$encrypt)
$info=ReadProfileString("\\server\share\folder\file.ini","user",$moduserid)
If $info<>@WKSTA
exit 1
EndIf
EndFunction

_________________________
I haven't failed. I just found another way that did not work.

Top
#130973 - 2004-12-10 07:44 PM Re: Masking User ID
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well I don't have time for this because I would probably end up spending too much time on it, but I'm sure either Jooel or Howard could easily reduce this quite a bit with some type of array/hash method if they got time.
Top
#130974 - 2004-12-10 08:40 PM Re: Masking User ID
Fugazi Offline
Starting to like KiXtart

Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
That was going to be a question if somebody knew how to put this into an array?
_________________________
I haven't failed. I just found another way that did not work.

Top
#130975 - 2004-12-13 10:52 AM Re: Masking User ID
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here are a couple of generic string encrypt / decrypt functions:
Code:
Break ON
$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
;
Dim $sText,$sIn,$sOut
; Simple string encryption:
$sText="Mary had a little lamb"
+@CRLF
+"It's fleece was white as snow"
+@CRLF
+"And every where that Mary went"
+@CRLF
+"The lamb was sure to go."

$sIn=udfStringEncrypt($sText)
$sOut=udfStringDecrypt($sIn)

"ORIGINAL TEXT:" ? $sText ? ?
"ENCRYPTED:" ? $sIn ? ?
"DECRYPTED:" ? $sOut ? ?

If $sText==$sOut "Strings match." Else "Mismatch in strings!" EndIf ?
Exit 0

Function udfStringEncrypt($s,Optional $sSalt)
Dim $iStringAsc, $iSaltAsc
$udfStringEncrypt=""
If Not $sSalt $sSalt="'Twas brilLig, ANd tHe sLIthy tOves Did GYre aNd gIMble iN the wabe" EndIf
While $s
$iStringAsc=Asc($s)
$iSaltAsc=Asc($sSalt)
$udfStringEncrypt=""+Right("0"+
CStr(DecToHex(XOR($iStringAsc,$iSaltAsc)))
,2)+$udfStringEncrypt
$s=SubStr($s,2)
$sSalt=""+SubStr($sSalt,2)+Left($sSalt,1)
Loop
EndFunction

Function udfStringDecrypt($s,Optional $sSalt)
Dim $iStringAsc, $iSaltAsc
$udfStringDecrypt=""
If Not $sSalt $sSalt="'Twas brilLig, ANd tHe sLIthy tOves Did GYre aNd gIMble iN the wabe" EndIf
While $s
$iStringAsc=Execute("Exit &"+Right($s,2))
$iSaltAsc=Asc($sSalt)
$udfStringDecrypt=""+$udfStringDecrypt+Chr(XOR($iStringAsc,$iSaltAsc))
$s=SubStr($s,1,Len($s)-2)
$sSalt=""+SubStr($sSalt,2)+Left($sSalt,1)
Loop
EndFunction

; Paul Lemaire's XOR function from http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=82846&page=&view=&sb=5&o=&vc=1
Function XOR($v1,$v2)
$XOR=($v1 | $v2) & (-1 - ($v1 & $v2))
EndFunction


Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 370 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.083 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org