Scripting a text to binary digits converter

-=>JB<=- sundown at pacifier.com
Mon Jan 2 13:45:55 EST 2012


The scripts below will convert between ASCII and Binary
Use a repeat on each char to convert the whole sentence.

Put the whole thing in a button to test how it works and
then rewrite the code without using ask and answer.

-=>JB<=-

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASCII-Bin Convert
  Convert between ASCII-Binary
  written by John Balgenorth - 7/31/08

on mouseUp
     answer "convert" with "ASCII-Bin" or "Bin-ASCII"
     if it = "ASCII-Bin" then convABin
     if it = "Bin-ASCII" then convBinA
end mouseUp
  
on convABin
     ask "convert ASCII to Binary"
     if it = empty or the result = "cancel" then exit to top
     put it into charConv
     put chartonum(charConv) into theNum
     put baseconvert(theNum,10,2) --into fld id 1010
end convABin

on convBinA
     ask "convert Binary to ASCII"
     if it = empty or the result = "cancel" then exit to top
     put it into theNum
     put baseconvert(theNum,2,10) into charConv
     put numtochar(charConv) --into fld id 1010
end convBinA

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
On Jan 2, 2012, at 10:10 AM, Bryan McCormick wrote:

> I have seen a number of sites that use a text to binary digits converter for simple encryption. Such that "this is my text" would be written as "011101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110100011001010111100001110100"
> 
> What is the simplest way of doing this in livecode? Could something like this also be done for photos? Or better I suppose for photos would be conversion to ascii text.
> 
> Thanks in advance for ideas and pointers.
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 

On Jan 2, 2012, at 10:10 AM, Bryan McCormick wrote:

> I have seen a number of sites that use a text to binary digits converter for simple encryption. Such that "this is my text" would be written as "011101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110100011001010111100001110100"
> 
> What is the simplest way of doing this in livecode? Could something like this also be done for photos? Or better I suppose for photos would be conversion to ascii text.
> 
> Thanks in advance for ideas and pointers.
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 




More information about the use-livecode mailing list