WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Encryption

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Simple Encryption and Decryption of Data


Just thought I'd share this bit of code which I have found usefull.

Not fool proof, but makes people think! The letters can be easily changed and for different locations/PC's

But please note: If you try and read, convert with a different code letter sequence to the one used for encription, it will not work. And I can't help you!!!

Simon Thomson
[10th September 2004 at 13:07hrs in 00minutes and 12seconds]

#DefineFunction BuildCode(plain)
;#######################################################################################
;                            BuildCode(data)
;#######################################################################################
;
;This takes the text supplied and converts it to a corresponding letter or character.
;
;#######################################################################################
;                            I M P O R T A N T   N O T E
;#######################################################################################
;PLEASE NOTE: You can add as many letters and numbers to this list as you want,
;             but make sure that you add them to the decoding list at the same time!!!
;#######################################################################################
    letters=`+,/,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,0,1,2,3,4,5,6,7,8,9, ,-,@,.,^,%%,$,£,[,],=,:`
    codeletters=`»,2,I,_,r,s,v,A,w,z,J,!,£,a,b,e,f,i,j,m,C,n,l,k,+,^,&,h,D,g,d,G,c,8,6,u,',=,#,€,;,B,",7,9,p,q,o,~,E,:,@,*,%%,$,F,y,x,t,1,H,3,5,¿,Z,±,,«,ª,²,³,{,},µ,4,©,Ø`
    encoded=""
    For x=1 To StrLen(plain)
        If x==1
            letter%x%=StrFix(plain," ",1)
        Else
            letter%x%=StrFixLeft(StrFix(plain," ",%x%)," ",1)
        EndIf
        place=ItemLocate(letter%x%,letters,",")
        encoded=StrCat(encoded,ItemExtract(place,codeletters,","))
    Next
    Return(encoded)
#EndFunction
#DefineFunction ReadCode(encripted)
;#######################################################################################
;                            ReadCode(data)
;#######################################################################################
;
; This takes the text supplied and converts into a readable string.
;
;#######################################################################################
;                            I M P O R T A N T   N O T E
;#######################################################################################
;PLEASE NOTE: You can add as many letters and numbers to this list as you want,
;             but make sure that you add them to the encoding list at the same time!!!
;#######################################################################################
    decodeletters=`+,/,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,0,1,2,3,4,5,6,7,8,9, ,-,@,.,^,%%,$,£,[,],=,:`
    letters=`»,2,I,_,r,s,v,A,w,z,J,!,£,a,b,e,f,i,j,m,C,n,l,k,+,^,&,h,D,g,d,G,c,8,6,u,',=,#,€,;,B,",7,9,p,q,o,~,E,:,@,*,%%,$,F,y,x,t,1,H,3,5,¿,Z,±,,«,ª,²,³,{,},µ,4,©,Ø`
    plain=""
    For x=1 To StrLen(encripted)
        If x==1
            letter%x%=StrFix(encripted," ",1)
        Else
            letter%x%=StrFixLeft(StrFix(encripted," ",%x%)," ",1)
        EndIf
        place=ItemLocate(letter%x%,letters,",")
        plain=StrCat(plain,ItemExtract(place,decodeletters,","))
    Next
    Return(plain)
#EndFunction

Article ID:   W16713
File Created: 2005:02:18:12:21:56
Last Updated: 2005:02:18:12:21:56