So rather than go with a time limited I came up with this idea based on licenses since a lot of the software I make is now working with 50 or moreservers/computers at a time.
If I want my filepush to push out to say, 200 servers I will have to purchase 200 licenses (at $5.00 a pop you can make some mon ey on it.).
THe LoadKey function is a piece of code written from another piece of code that took random space noise to seed the randomizing code that generated it - it is fairly extensive - and it's just an idea for you to play with.
Unfortunately you'll have to reverse engineer how to read the licenses by your application, should be easy en ough.
I took my license reading capaiblity out when my company gave me a payraise
(I wrote this at home on MY company time)..
If I want my filepush to push out to say, 200 servers I will have to purchase 200 licenses (at $5.00 a pop you can make some mon ey on it.).
THe LoadKey function is a piece of code written from another piece of code that took random space noise to seed the randomizing code that generated it - it is fairly extensive - and it's just an idea for you to play with.
Unfortunately you'll have to reverse engineer how to read the licenses by your application, should be easy en ough.
I took my license reading capaiblity out when my company gave me a payraise

Code:
#Compile Exe #Dim All #Include "Win32api.inc" #Include "COMMCTRL.INC" '#Resource "resource\filepush.pbr" %PROGRAM = 1024 %INTEXTBOX = %WM_USER + 200 %OUTTEXTBOX = %WM_USER + 201 %GENERATE = %WM_USER + 202 %EXIT = %WM_USER + 203 %IDLABELUSER = %WM_USER + 204 %IDTEXTUSER = %WM_USER + 205 %IDLABELCOMPANY = %WM_USER + 206 %IDTEXTCOMPANY = %WM_USER + 207 %IDLABELCOMP = %WM_USER + 208 %IDTEXTCOMP = %WM_USER + 209 %IDLABELPROD = %WM_USER + 210 %IDTEXTPROD = %WM_USER + 211 %IDCOPYTOCLIP = %WM_USER + 212 %IDLABELLICENSE = %WM_USER + 213 %IDTEXTLICENSE = %WM_USER + 214 Global g_hIcon As Long Global g_szCCS As String Declare CallBack Function DialogProc() As Long Declare Function CopyToClipboard(sText As String) As Long Declare Function CrunchLicenseInfo(ByVal sInput As String) As String Declare Function CvtNvtByte(ByVal x As Long) As Long Declare Function Base64Dec Alias "Base64Dec"(ByVal lpStringIn As Dword, _ ByVal lpStringOut As Dword, ByVal OutBuffSiz As Dword) As Long Declare Function Base64Enc Alias "Base64Enc"(ByVal lpStringIn As Dword, _ ByVal lpStringOut As Dword, ByVal InLen As Dword, _ ByVal OutBuffSiz As Dword) As Long Declare Function EnDeCrypt Alias "EnDeCrypt"(InString As Asciiz, Passwd As Asciiz, _ OutString As Asciiz, ByVal nLen As Dword) As Long Declare Function NCryptString Alias "NCryptString" (StringIn As String, Pw As String) As String Declare Function LoadKey Lib "CCS.DLL"(KeyNum As Long) As String '============================================<WINMAIN>================================================================== Function WinMain (ByVal hInstance As Long, _ ByVal hPrevInstance As Long, _ ByVal lpCmdLine As Asciiz Ptr, _ ByVal iCmdShow As Long) As Long Local szClassName As Asciiz * 16 Local windclass As WndClassEx Local hDlg As Long g_szCCS = "Computer Creations Software" LoadIcon(hInstance, ByVal %PROGRAM) windclass.cbSize = SizeOf(windclass) windclass.style = %CS_HREDRAW Or %CS_VREDRAW windclass.lpfnWndProc = CodePtr( DialogProc ) windclass.cbClsExtra = 0 windclass.cbWndExtra = 0 windclass.hInstance = hInstance windclass.hIcon = g_hIcon windclass.hCursor = LoadCursor( %NULL, ByVal %IDC_ARROW ) windclass.hbrBackground = GetStockObject( %HOLLOW_BRUSH ) windclass.lpszMenuName = %NULL windclass.lpszClassName = VarPtr( szClassName ) windclass.hIconSm = g_hIcon RegisterClassEx windclass %DIALOG_WIDTH = 250 %DIALOG_HEIGHT = 230 %LABEL_WIDTH = 230 %PROGRESS_WIDTH = 250 Dialog New 0, "License Generator for " & g_szCCS,,, %DIALOG_WIDTH,%DIALOG_HEIGHT,%WS_MINIMIZEBOX Or %WS_CAPTION Or %WS_SYSMENU To hDlg Control Add Label, hDlg,-1,"Paste license info:",5,5,100,10 Control Add TextBox, hDlg,%INTEXTBOX,"",5,15,220,12 Control Add Label, hDlg,%IDLABELUSER,"Username:",5,35,35,10 Control Add TextBox, hDlg,%IDTEXTUSER,"",5,45,220,12 Control Add Label, hDlg,%IDLABELCOMPANY,"Company:",5,60,35,10 Control Add TextBox, hDlg,%IDTEXTCOMPANY,"",5,70,220,12 Control Add Label, hDlg,%IDLABELCOMP,"Computer Name:",5,85,100,10 Control Add TextBox, hDlg,%IDTEXTCOMP,"",5,95,220,12 Control Add Label, hDlg,%IDLABELPROD,"Product:",5,110,100,10 Control Add TextBox, hDlg,%IDTEXTPROD,"",5,120,220,12 Control Add Label, hDlg,%IDLABELLICENSE,"Licenses Requested: ",5,135,100,10 Control Add TextBox, hDlg,%IDTEXTLICENSE,"",5,145,220,12 Control Add Label, hDlg,-1,"Out to customer:",5,160,100,10 Control Add TextBox, hDlg,%OUTTEXTBOX,"",5,170,220,35 Control Add Button, hDlg,%IDCOPYTOCLIP,"&Copy to clipboard",5,210,70,14 Control Add Button, hDlg,%GENERATE,"&Generate",80,210,70,14 Control Add Button, hDlg,%EXIT,"E&xit",155,210,70,14 Dialog Show Modal hDlg Call DialogProc End Function '------------------------------------------------------------------------------------------ CallBack Function DialogProc() As Long Local lResult As Long Local sTmp As String Local zTmp As Asciiz * 128 Local OutBuff As Asciiz * 128 Static LicenseInfo As String Local wKey As String Local wRegProd As String Local wRegUser As String Local wRegComp As String Local wRegCompany As String Local wRegLicense As String Static hTest As Long 'My gen # is 'INPUT: 'OUTPUT: Select Case CbMsg Case %WM_SIZE Case %WM_INITDIALOG Control Handle CbHndl, %INTEXTBOX To hTest ' Call SAutoComplete(ByVal hTest, ByVal %FALSE) Case %WM_COMMAND Select Case LoWrd(CbWParam) Case %IDCOPYTOCLIP Call CopyToClipboard(LicenseInfo) Case %EXIT Dialog End CbHndl,%TRUE Case %GENERATE Control Get Text CbHndl,%INTEXTBOX To LicenseInfo LicenseInfo = Trim$(LicenseInfo) wKey = LoadKey(Val(Left$(LicenseInfo,3))) LicenseInfo = Right$(LicenseInfo,Len(Licenseinfo) - 3) zTmp = LicenseInfo lResult = Base64Dec(ByVal VarPtr(zTmp), ByVal VarPtr(OutBuff), ByVal SizeOf(zTmp)) LicenseInfo = Trim$(OutBuff) LicenseInfo = NCryptString(LicenseInfo,wKey) wRegProd = Parse$(LicenseInfo,"|",1) wRegComp = Parse$(LicenseInfo,"|",2) wRegUser = Parse$(LicenseInfo,"|",3) wRegCompany = Parse$(LicenseInfo,"|",4) wRegLicense = Parse$(LicenseInfo,"|",-1) Control Set Text CbHndl,%IDTEXTUSER,wRegUser Control Set Text CbHndl,%IDTEXTCOMPANY,wRegCompany Control Set Text CbHndl,%IDTEXTCOMP,wRegComp Control Set Text CbHndl,%IDTEXTPROD,wRegProd Control Set Text CbHndl,%IDTEXTLICENSE,wRegLicense LicenseInfo = wRegComp & "|" & wRegLicense'Computer name|LicenseNumbers LicenseInfo = CrunchLicenseInfo(LicenseInfo) Control Set Text CbHndl,%OUTTEXTBOX, LicenseInfo 'basically At this point we just gave them what they gave me, so now regen With different key Or ??? End Select End Select End Function '-------------------------------------------------------------- Function CrunchLicenseInfo(ByVal sInput As String) As String Local wKey As String Local wKeyNum As Long Local zTmp As Asciiz * 128 Local OutBuff As Asciiz * 128 Local lResult As Long Local zLen As Long wKeyNum = Val(Mid$(Time$,5,1) & Mid$(Time$,7,2)) wKey = loadkey(wKeyNum) 'Load a new Key sInput = NCryptString(sInput,wKey) zTmp = sInput zLen = Len(zTmp) lResult = Base64Enc(ByVal VarPtr(zTmp),ByVal VarPtr(OutBuff), ByVal zLen, ByVal SizeOf(OutBuff)) Function = Format$(wKeyNum) & OutBuff End Function '------------------------------------------------------------------------------------------ Function CopyToClipboard(sText As String) As Long Local lpMem As Asciiz Ptr Local hMem As Dword ' Allocate global memory block hMem = GlobalAlloc(%GHND, Len(sText) + 1) ' lock it and get pointer to memory location lpMem = GlobalLock(hMem) ' copy text into memory object @lpMem = sText ' unlock the memory object GlobalUnlock hMem ' add text to the clipboard OpenClipboard 0 EmptyClipboard SetClipboardData %CF_TEXT, hMem CloseClipboard GlobalFree hMem End Function '-------------------------------------------------------------- '------------------------------------------------------------------------------------------ '====================================================================================================================== ' --------------------------------------------------------- ' Local Function Called by Base64Dec ' --------------------------------------------------------- Function CvtNvtByte(ByVal x As Long) As Long Local rtn As Long ! push eax ; save eax since we alter it ! push ebx ; save ebx since we alter it ! mov eax, x ; get byte into eax ! and eax, 255 ; clear other bytes ! cmp eax, 64 ; see if its an upper case letter ! jle CvtNvtCheck47 ; if not check to see if its = 43 ! cmp eax, 91 ; can't be bigger than 90 ! jge CvtNvtCheck96 ; otherwize not what we thought ! sub eax, 65 ; subtract 65 from the original ! mov rtn, eax ; return that value to caller ! jmp CvtNvtDone ; leave the function CvtNvtCheck96: ! cmp eax, 96 ; looking for lower case letters ! jle CvtNvtRtn63 ; return 63 ! cmp eax, 123 ; see if we're less then 123 ! jge CvtNvtRtn63 ; return 63 ! sub eax, 71 ; subtract 71 and ! mov rtn, eax ; return it to the caller ! jmp CvtNvtDone ; leave the function CvtNvtCheck47: ! cmp eax, 47 ; see if its a /, 0-9 ! jle CvtNvtCheck43 ; see if its a + next ! cmp eax, 58 ; no more than 57 acceptable ! jge CvtNvtRtn63 ; return 63 ! add eax, 4 ; add 4 to eax ! mov rtn, eax ; return it to the caller ! jmp CvtNvtDone ; leave the function CvtNvtCheck43: ! cmp eax, 43 ; see if its a + sign ! jne CvtNvtRtn63 ; if not do next check ! mov ebx, 62 ; return value 62 ! mov rtn, ebx ; to the caller ! jmp CvtNvtDone ; exit function CvtNvtRtn63: ! mov ebx, 63 ; return 63 for any other bytes ! mov rtn, ebx ; not specified CvtNvtDone: ! pop ebx ; restore original ebx ! pop eax ; restore original eax Function = rtn ' Pass Return Value to caller End Function ' --------------------------------------------------------- ' BASE64 Decoding Routine: Returns 1 on Error ' 0 for Success ' ' Args: Pointr to Input Buffer, Pointer to Output Buffer, ' Output Buffer's Size. ' --------------------------------------------------------- Function Base64Dec Alias "Base64Dec"(ByVal lpStringIn As Dword, _ ByVal lpStringOut As Dword, ByVal OutBuffSiz As Dword) As Long Local rtn As Long ! push ebx ; save ebx ! push esi ; save esi ! push edi ; save edi ! mov esi, lpStringIn ; input buffer address ! and esi, esi ; null ptr check ! jz Base64DecDone ; exit function ! mov edi, lpStringOut ; output buffer address ! and edi, edi ; null ptr check ! jz Base64DecDone ; exit function ! xor ebx, ebx ; zero ebx ! xor ecx, ecx ; zero ecx ! xor edx, edx ; zero edx Base64DecLoop: ! xor eax, eax ; zero eax register ! mov bl, [esi] ; get character from input ! cmp bl, 0 ; see if it's a null terminator ! je Base64DecDone ; if so then exit function ! push ebx ; parameter for next call ! call CvtNvtByte ; call the function ! shl al, 2 ; shift bits in result left by 2 ! mov ecx, eax ; save it to ecx ! mov bl, [esi+1] ; get next char from input ! push ebx ; parameter for call ! call CvtNvtByte ; call function ! shr al, 4 ; shift result bits right by 4 ! or ecx, eax ; or result 1 with result 2 ! mov edx, ecx ; save ecx to edx ! mov bl, [esi+2] ; get third letter ! cmp bl, 61 ; see if its an = sign ! je Base64DecBC1 ; append it to the output buffer ! mov bl, [esi+1] ; get second letter ! push ebx ; paramter for call ! call CvtNvtByte ; call function ! shl al, 4 ; shift result left by 4 ! mov ecx, eax ; save the result in ecx ! mov bl, [esi+2] ; get the 3rd char from input ! push ebx ; set it as parameter for call ! call CvtNvtByte ; call the function ! shr al, 2 ; shift the result right by 2 ! or ecx, eax ; or reslult 2 with result 3 ! mov dh, cl ; save it in dh ! mov bl, [esi+3] ; get 4th char from input ! cmp bl, 61 ; see if its an = sign ! je Base64DecBC2 ; append it to the output buffer ! mov bl, [esi+2] ; get 3rd char ! push ebx ; set it as param for call ! call CvtNvtByte ; call the function ! shl al, 6 ; shift result left 6 ! mov ecx, eax ; save it to ecx ! mov bl, [esi+3] ; get the 4th char ! push ebx ; set it as parameter for call ! call CvtNvtByte ; call the function ! or ecx, eax ; or it with the modified third ! jmp Base64DecBC3 ; process the output Base64DecBC1: ! mov [edi], dl ; write byte to output ! inc edi ; update the pointer ! mov eax, 1 ; set an error code ! cmp edi, OutBuffSiz ; see if we're out of buffer space ! je Base64DecDone ; if so exit ! add esi, 4 ; prepare for next block ! jmp Base64DecLoop ; go back for more Base64DecBC2: ! mov [edi], dl ; write byte to output ! inc edi ; update the pointer ! mov eax, 1 ; set an error code ! cmp edi, OutBuffSiz ; see if we're out of buffer space ! je Base64DecDone ; if so exit ! shr edx, 8 ; move dh to dl ! jmp Base64DecBC1 ; process the last char Base64DecBC3: ! mov eax, edx ; copy edx to eax ! shr edx, 8 ; move dh to dl ! mov dh, cl ; copy cl to dh ! mov [edi], al ; write byte to output ! inc edi ; move pointer up 1 ! mov eax, 1 ; set an error code ! cmp edi, OutBuffSiz ; see if we're out of buffer space ! je Base64DecDone ; if so exit ! jmp Base64DecBC2 ; process remaining 2 bytes Base64DecDone: ! pop edi ; restore edi ! pop esi ; restore esi ! pop ebx ; restore ebx ! cmp eax, 1 ; see if we have an error ! je Base64DecError ! jmp Base64DecExit Base64DecError: ! mov rtn, eax ; save our return value in rtn Function = rtn ' and return it to caller. Base64DecExit: End Function ' --------------------------------------------------------- ' BASE64 Encoding Routine: Returns 0 for success, ' Non-Zero for Error Code ' ' Args: Pointr to Input Buffer, Pointer to Output Buffer, ' In Sring Len, Output Buffer's Size. ' ' Note: In String Len is used rather than looking for the ' zero terminator so that Binary Data can be encoded! ' ' Err Codes: 1 = OutPut Buffer Null Ptr Error ' 2 = InPut Buffer Null Ptr Error ' 4 = OutPut Buffer Too Short! ' --------------------------------------------------------- Function Base64Enc Alias "Base64Enc"(ByVal lpStringIn As Dword, _ ByVal lpStringOut As Dword, ByVal InLen As Dword, ByVal OutBuffSiz As Dword) As Long Local rtn As Long ! push ebx ; save ebx ! push esi ; save esi ! push edi ; save edi ! mov ecx, lpStringOut ; pointer to output buffer ! push ecx ; save the address in case of err ! mov eax, 1 ; Null pointer error code ! and ecx, ecx ; check for null pointer ! jz Base64EncDone ; if so get out ! mov edi, lpStringIn ; pointer to input buffer ! mov eax, 2 ; Null pointer error code ! and edi, edi ; see if its a null pointer ! jz Base64EncDone ; if so get out ! xor esi, esi ; zero esi ! mov edx, InLen ; edx contains Instr Len ! lea ebx, Base64_Nvt ; load translation table to ebx Base64EncTop: ! xor eax, eax ; error code 0 ! cmp edx, 0 ; see if we're at the end ! je Base64EncDone ; if so then exit function ! mov al, [edi] ; get character into al ! shr al, 2 ; Shift Right 2 bits ! xlatb ; translate the character ! mov [ecx], al ; save it ! inc ecx ; move pointer up 1 ! pop eax ; get original address of output ! push eax ; save it again ! mov esi, ecx ; get current Output pos ! sub esi, eax ; get current output len ! mov eax, 4 ; error code into eax ! add esi, 4 ; translate it to len ! cmp esi, OutBuffSiz ; see if we've reached the limit ! jge Base64EncDone ; if so exit with an error ! mov al, [edi+1] ; read char2 into al ! mov ah, [edi] ; read char1 into ah ! shr ax, 4 ; shift it all r by 4 ! and al, &H3F ; and the low byte w/0x3F ! xlatb ; translate the low bit ! mov [ecx], al ; save it ! inc ecx ; move pointer up 1 ! cmp edx, 1 ; see which position we are in ! jne Base64EncSec2 ; jump to section 2 ! mov al, 61 ; append the == to end ! mov [ecx], al ; save it once ! inc ecx ; move the pointer up ! mov [ecx], al ; save it once more ! mov al, 61 ; 2nd = sign ! inc ecx ; up the pointer again ! xor eax, eax ; return error code 0 ! jmp Base64EncDone ; exit the function Base64EncSec2: ! mov al, [edi+2] ; read the 3rd char into al ! mov ah, [edi+1] ; read the 2nd char into ah ! shr ax, 6 ; shift it all right 6 bits ! and al, &H3F ; and the low byte w/0x3F ! xlatb ; translate the char ! mov [ecx], al ; save it to output buffer ! inc ecx ; move output buff ptr up ! cmp edx, 2 ; see if were at pos 2 ! jne Base64EncSec3 ; if not jump to section 3 ! mov al, 61 ; otherwise add an = to end ! mov [ecx], al ; save it ! inc ecx ; update the pointer ! xor eax, eax ; return error code 0 ! jmp Base64EncDone ; exit the function Base64EncSec3: ! mov al, [edi+2] ; read 3rd char into al ! and al, &H3F ; and it with 0x3F ! xlatb ; translate it ! mov [ecx], al ; save it ! inc ecx ; update output pointer ! add edi, 3 ; prepare for next block of chars ! sub edx, 3 ; move input string pointer down ! jmp Base64EncTop ; go back to the top for next block Base64_Nvt: ! db 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 ! db 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122 ! db 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47 Base64EncDone: ! pop esi ; recall original output addr (ecx) ! cmp eax, 0 ; see if an error got us here ! jne Base64Error ; yep so handle it ! mov [ecx], al ; save null terminator ! mov rtn, eax ; return error code ! jmp Base64ExitProc ; exit the proceedure Base64Error: ! mov rtn, eax ; return error code ! and eax, 3 ; see if it was a null ptr error ! jnz Base64ExitProc ; exit directly ! xor eax, eax ; zero eax ! mov [esi], al ; write a null terminator Base64ExitProc: ! pop edi ; restore edi ! pop esi ; restore esi ! pop ebx ; restore ebx Function = rtn ' return code to caller End Function ' --------------------------------------------------------- ' RC4 Encrypt/Decrypt Routine: Returns 1 on Error, ' 0 for Success ' ' nLen = Input String Len. NOTE: Buffer Lengths Must Be ' equal to or greater than this size. We want To be able ' to encrypt Ascii Zero's so we can't look for These for ' the end of the string mark as you normally would with ' this type of data. ' ' NOTE: If you are calling from PB you are better off using ' the wrapper function below to use BASIC Strings. ' --------------------------------------------------------- Function EnDeCrypt Alias "EnDeCrypt"(InString As Asciiz, Passwd As Asciiz, OutString As Asciiz, ByVal nLen As Dword) As Long Local S As Asciiz * 256 Local K As Asciiz * 256 Local rtn As Long ! push ebx ; save ebx ! push esi ; save esi ! push edi ; save edi ! mov esi, InString ; Input String Address ! and esi, esi ; null pointer check ! jz EnDeCryptDone ; exit function ! mov edi, OutString ; Output String Address ! and edi, edi ; null pointer check ! jz EnDeCryptDone ; exit function ! mov edx, Passwd ; Password String Address ! and edx, edx ; null pointer check ! jz EnDeCryptDone ; exit function ! push esi ; save it for temp use ! push edi ; save it for temp use ! push edx ; save original pw address ! xor eax, eax ; zero eax ! lea esi, S ; address of S ! lea edi, K ; address of K EnDeCryptInitS: ! mov [esi+eax], al ; store char in S ! mov bl, [edx] ; get byte from password ! cmp bl, 0 ; see if its a null terminator ! je EnDeCryptFixPw ; if so adjust it ! mov [edi+eax], bl ; store char in K ! inc edx ; increment pw pointer ! inc eax ; increment ascii pointer ! cmp eax, 256 ; see if we're done ! jl EnDeCryptInitS ; get next character ! jmp EnDeCryptCreateTable ; go to next step EnDeCryptFixPw: ! pop edx ; get starting address of pw ! push edx ; save it again ! mov bl, [edx] ; get first char again ! mov [edi+eax], bl ; store it in K ! inc edx ; increment pw pointer ! inc eax ; increment ascii pointer ! cmp eax, 256 ; see if we're done ! jl EnDeCryptInitS ; get next character EnDeCryptCreateTable: ! xor ecx, ecx ; zero ecx ! xor edx, edx ; zero edx EnDeCryptTableLoop: ! mov al, [esi+ecx] ; get S char into al ! mov ah, [edi+ecx] ; get K char into ah ! add al, ah ; add them together ! mov ah, dl ; dl to ah ! add al, ah ; add them together ! mov edx, eax ; save it to edx ! and edx, 255 ; filter off high bits ! mov bl, [esi+ecx] ; get S char to bl ! mov al, [esi+edx] ; get K char to al ! mov [esi+ecx], al ; swap the values ! mov [esi+edx], bl ; swap the values ! inc ecx ; increment counter ! cmp ecx, 256 ; see if we're done ! jl EnDeCryptTableLoop ; get next character ! pop edx ; restore password address ! pop edi ; restore Output address ! pop esi ; restore Input address ! xor eax, eax ; zero eax ! xor ebx, ebx ; zero ebx ! xor ecx, ecx ; zero ecx ! xor edx, edx ; zero edx EnDeCryptMainLoop: ! mov eax, 1234 ; normal exit code checked on exit ! cmp edx, nLen ; See if we've reached the end yet ! jge EnDeCryptDone ; if so we're done ! mov al, [esi+edx] ; get char from input ! inc ch ; increment ch ! and ch, 255 ; range 0-255 ! push esi ; save esi ! lea esi, S ; address of S ! push eax ; save eax ! push ebx ; save ebx ! xor eax, eax ; zero eax ! mov ah, ch ; get ch ! shr eax, 8 ; move to al ! mov ebx, eax ; copy it to ebx ! mov al, [esi+ebx] ; get byte ! add cl, al ; add them up ! and cl, 255 ; range 0-255 ! pop ebx ; restore ebx ! xor eax, eax ; zero eax ! mov al, cl ; cl to al ! mov bl, [esi+eax] ; swap table bytes ! mov al, ch ; ch to al ! mov bh, [esi+eax] ; swap table bytes ! mov [esi+eax], bl ; swap table bytes ! mov al, cl ; cl to al ! mov [esi+eax], bh ; swap table bytes ! pop eax ; restore eax ! add bl, bh ; add the bytes together ! and ebx, 255 ; range 0-255 ! mov bh, [esi+ebx] ; get xor Var ! shr ebx, 8 ; move it to bl ! xor al, bl ; xor the value ! mov [edi+edx], al ; store the encrypted char ! pop esi ; restore input address ! inc edx ; increment character counter ! jmp EnDeCryptMainLoop ; get next character EnDeCryptDone: ! cmp eax, 1234 ; see if our normal exit code ! je EnDeCryptExitLab ; got us here, if so exit ! mov eax, 1 ; if not return error code ! mov rtn, eax ; to caller EnDeCryptExitLab: ! pop edi ; restore edi ! pop esi ; restore esi ! pop ebx ; restore ebx Function = rtn End Function Function NCryptString Alias "NCryptString" (StringIn As String, Pw As String)Export As String Local pBuff As String Local oBuff As String pBuff = Pw & Chr$(0) ' pad pw with a chr 0 oBuff = Space$(Len(StringIn)) ' set outbuff len ! push ebx ; save ebx ! mov eax, StringIn ; Get Input Buffer Handle to eax ! mov eax, [eax] ; get address of data ! and eax, eax ; null pointer check ! jz CryptStrDone ; leave the function ! lea ebx, pBuff ; pBuff's handle to ebx ! mov ebx, [ebx] ; pBuff's address to ebx ! lea ecx, oBuff ; oBuff's handle to ecx ! mov ecx, [ecx] ; oBuff's address to ecx ! mov edx, [eax-4] ; StringIn's Length to edx ! push edx ; last parameter for call ! push ecx ; 3rd parameter for call ! push ebx ; 2nd parameter for call ! push eax ; 1st paramter for call ! call EnDeCrypt ; call the master function ! cmp eax, 0 ; make sure there were no errors ! jne CryptStrDone ; if so then exit Function = oBuff ' set output CryptStrDone: ! pop ebx ; restore ebx End Function '------------------------------------------------------------------------------------------ '------------------------------------------------------------------------------------------ '------------------------------------------------------------------------------------------ '------------------------------------------------------------------------------------------ '------------------------------------------------------------------------------------------
Comment