(*
Transmission algorithm
Mathematica code for
Joao Carlos Leandro da Silva,
"3D cryptography"
article published on my website:
www.rainbowofprimes.com
on 26/1/2014.
c. Joao Carlos Leandro da Silva
All Rights Reserved.
*)

(* For string s which is not a string, this algorithm will print an error message. *)

(* For string s with length of string equal or greater than zero,
this algorithm will transform the given string into a sequence of binary digits. *)

(* CODE *)

ClearAll["Global`*"]

(* Define binarytransmission function *)

binarytransmission[s_]:=(If[StringQ[s],code=ToCharacterCode[s],Print["Error! Please type your text between quotation marks."]];

max=Length[code];char=Map[IntegerString,code];insert[u_String]:=StringInsert[u,"0",1];
r=1;While[r≤max,
If[StringLength[char[[r]]]==3,char[[r]]=char[[r]],char[[r]]=insert[char[[r]]]];
r++];char;

n=FromDigits[Apply[StringJoin,char]];

binarynumber=IntegerDigits[n,2])

(* EXAMPLE *)

(* Call the binarytransmission function with input "Joao" *)

binarytransmission["Joao"]