encrypt word

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

encrypt word

Post by link76 » Mon Jul 23, 2012 8:13 am

how can I encrypt / decrypt my password in a txt file?

thank you

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: encrypt word

Post by Mark » Mon Jul 23, 2012 10:47 am

Hi,

It depends on why you want to encrypt it. Look at the encrypt function in the LC dictionary.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

genie
Posts: 108
Joined: Thu Dec 01, 2011 7:19 am

Re: encrypt word

Post by genie » Thu Jan 10, 2013 9:17 am

As per dictionary, Encrypt and Decrypt command works on Mac, Windows, & Linux.

How do I DECRYPT on mobile?


Thanks,
Genie

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: encrypt word

Post by Klaus » Thu Jan 10, 2013 1:36 pm

http://forums.runrev.com/phpBB2/viewtop ... 743#p66329

Please read the "Android Release Notes" (Livecode: Menu: Help) and you will see that
encryption is not (yet) supported on ANDROID by Livecode.

The "XXX Release Notes" are the ONLY docs we have for the mobile platform!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: encrypt word

Post by Simon » Fri Jan 11, 2013 12:30 am

Hi Genie,
Would obfuscation instead of encryption work for you?

OK all you cipher guys can start laughing now. :oops:
I think the original encryption was just a letter placement number e.g. a=1, b=2, c=3 etc.

Code: Select all

function pencrypt pText
   replace comma with "#&" in pText
   put "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,1,2,3,4,5,6,7,8,9,0, ,1,@,#,$,%,^,&,*<(,),#&" into tPos
   put comma & "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" after tPos
   set the caseSensitive to true
   repeat for each line tLine in pText
      repeat for each char tChar in tLine
         put itemoffset(tChar,tPos) & comma after tMult 
      end repeat
      put cr after tMult
   end repeat
   return tMult
end pencrypt

function pdecrypt pText
   put "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,1,2,3,4,5,6,7,8,9,0, ,1,@,#,$,%,^,&,*<(,),#&" into tPos
   put comma & "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" after tPos
   set the caseSensitive to true
   repeat for each line tLine in pText
      repeat for each item tItem in tLine
         put item tItem of tPos after tMult 
      end repeat
      put cr after tMult
   end repeat
   replace "#&" with comma in tMult
   return tMult
end pdecrypt
and there it is.
Your post above becomes:
48,19,37,16,5,18,37,4,9,3,20,9,15,14,1,18,25,40,44,37,52,14,3,18,25,16,20,37,1,14,4,37,51,5,3,18,25,16,20,37,3,15,13,13,1,14,4,37,23,15,18,11,19,37,15,14,37,60,1,3,40,44,37,70,9,14,4,15,23,19,40,44,37,44,37,59,9,14,21,24,

55,15,23,37,4,15,37,56,37,51,52,50,65,72,63,67,37,15,14,37,13,15,2,9,12,5,


67,8,1,14,11,19,40,44,
54,5,14,9,5,

By re-ordering the letters in tPos it becomes more obfuscated.
Note that this is NOT encryption and can be broken if someone wanted to try. I would NEVER use this for a commercial product. But as you stated it was a "password" there is little chance of character repetition which is one way codes are broken. I guess this makes a "hangman" game.
A much better obfuscation was done by Richard Gaskin here:
http://livecodejournal.com/tutorials/ha ... s-005.html

Everybody can stop laughing now :D
Klaus, yes I did leave out your "delete the last char" :D

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply