Advertisement
6_2008-2009 String Manipulation #200704

Effective Encryption Algorithm

Encrypts and decrypts strings

AI

AI சுருக்கம்: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

மூலக் குறியீடு
original-source
'THIS FUNCTION ENCRYPTS THE INPUT
Public Function DMEncrypt(strText As String)
On Error GoTo Xit
Dim Combine As String, i As Integer, Temp As String
Combine = ""
Temp = ""
For i = 1 To Len(strText) - 1 Step 2
  If Len(Trim(Str(Asc(Mid(strText, i, 1))))) < 3 Then
    Temp = "0" & Trim(Str(Asc(Mid(strText, i, 1))))
  Else
    Temp = Trim(Str(Asc(Mid(strText, i, 1))))
  End If
  Combine = Combine & Temp
  If Len(Trim(Str(Asc(Mid(strText, i + 1, 1))))) < 3 Then
    Temp = "0" & Trim(Str(Asc(Mid(strText, i + 1, 1))))
  Else
    Temp = Trim(Str(Asc(Mid(strText, i + 1, 1))))
  End If
  Combine = Combine & Temp
Next i
Temp = ""
For i = 1 To Len(Combine)
  Temp = Temp & Chr(Asc(Mid(Combine, i, 1)) + 128)
Next i
DMEncrypt = Temp
Clipboard.SetText Temp
Exit Function
Xit:
DMEncrypt = "{{ Error encrypting }}"
Exit Function
End Function
'THIS FUNCTION DECRYPTS THE INPUT
Public Function DMDecrypt(strText As String)
On Error GoTo Xit
Dim Combine As String, i As Integer, Temp As String, Temp2 As Integer
Combine = ""
For i = 1 To Len(strText)
  Combine = Combine & Chr(Asc(Mid(strText, i, 1)) - 128)
Next i
Temp = ""
For i = 1 To Len(Combine) Step 3
  Temp2 = Mid(Combine, i, 3)
  Temp = Temp & Chr(Temp2)
Next i
DMDecrypt = Temp
Exit Function
Xit:
DMDecrypt = "{{ Error encrypting }}"
Exit Function
End Function

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
#include<graphics.h>
main()
{
	union REGS i,o;
	int gd = DETECT,gm,maxx,maxy,x,y,button,cl=1,rad=10,flag=0;
	char name[50];
	initgraph(&gd,&gm,"\\tc\\bgi");
	maxx = getmaxx();
	maxy = getmaxy();
	restrictmouseptr(1,1,maxx,maxy);
	gotoxy(1,2);
	gotoxy(15,2);
	gotoxy(55,3);
	while(!kbhit())
	{
		getmousepos(&button,&x,&y);
		setfillstyle(1,2);
		fillellipse(x,y,10,rad);
		if(flag==0)
		 rad++;
		else
		 rad--;
		if(rad>=10)
		 flag=1;
		if(rad<=1)
		 flag=0;
		delay(30);
		cleardevice();

	}
	getch();
	return 0;
}
initmouse()
{
	union REGS i,o;
	i.x.ax = 0;
	/* sets the interrept interface */
	int86(0x33,&i,&o);
	return(o.x.ax);
}
showmouseptr()
{
	union REGS i,o;
	i.x.ax = 1;
	/* sets the interrept interface */
	int86(0x33,&i,&o);
	return 0;
}
restrictmouseptr(int x1,int y1,int x2,int y2)
{
	union REGS i,o;
	i.x.ax = 7;
	i.x.cx = x1;
	i.x.dx = x2;
	/* sets the interrept interface */
	int86(0x33,&i,&o);
	i.x.ax = 8;
	i.x.cx = y1;
	i.x.dx = y2;
	/* sets the interrept interface */
	int86(0x33,&i,&o);
	return 0;
}
getmousepos(int *button,int *x,int *y)
{
	union REGS i,o;
	i.x.ax = 3;
	/* sets the interrept interface */
	int86(0x33,&i,&o);
	*button = o.x.bx;
	*x = o.x.cx;
	*y = o.x.dx;
	return 0;
}
அசல் கருத்துகள் (3)
வேபேக் மெஷினிலிருந்து (Wayback Machine) மீட்டெடுக்கப்பட்டது