#130970 - 2004-12-10 12:23 AM
Re: Masking User ID
|
ShaneEP
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
|
|
|
|
#130973 - 2004-12-10 07:44 PM
Re: Masking User ID
|
NTDOC
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
|
|
|
|
#130975 - 2004-12-13 10:52 AM
Re: Masking User ID
|
Richard H.
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 569 anonymous users online.
|
|
|