| Hi, I wrote this little snippet to encrypt a text file to mainly prevent "normal" prying eyes. Ive tried entering many paragraphs (200k characters)for the string and it seems to work fine encrypting and decrypting.
 
 Note: It wouldn't be too difficult to add a key or salt to this code.
 
 Please give me your thoughts. Also its free to use if anyone wants. If its worthy of the codearchive, I'll post it there :)
 
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; the following is to test the encryption
; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;encrypt string
result$ = Enc_e$("Put your string to encrypt here!")
Print result$
;decrypt string
result$ = Enc_d$(result$)
Print result$
WaitKey()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ENCRYPTION FUNCTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Enc(ryption)_e(ncrypt)
;description: encrypts a string n$
;
Function Enc_e$(n$)
	l$ = Len(n$)
	For x  = 1 To l$
		t  = Asc(Mid(n$,x,1))
		r$ = r$ +  Chr$( (t-x) - f(x))		
	Next
	Return r$
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Enc(ryption)_d(ecrypt)
;description: decrypts an encrypted string n$
;
Function Enc_d$(n$)
	l$ = Len(n$)
	For x  = 1 To l$
		t  = Asc(Mid(n$,x,1))
		r$ = r$ +  Chr$( (t+x) + f(x) )		
	Next
	Return r$
End Function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;f(n) 
;description: used to aid encryption
;
Function f%(n)
	r = n Shl 1
	r = (r Mod 256)
	Return r%
End Function
 
 |