Message6.js
19 Aug 2016
Added encryption and permutation options to the message transport.
Set the flags at the top of this program to enable these features.
Additional module require("permutation")
The function that creates the permutation array has been modified.
Let N=16, then there are 15*13*11*9*7*5*3 = 2,027,025 combinations
If N=80, then there are 79*77*75*…*3 = 7.9777941814E+58 combinations
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=false;
var PermutationFlag=false;
In left pane enter test1();
=undefined
>test1();
Auth,Mhash, and Transport keys
f9,77,1,73,1d,86,4d,40,82,1e,29,89,0,f8,5,2c,
56,d3,9,f8,63,58,d5,35,80,63,0,6f,91,e3,56,ff,
ad,7d,48,da,84,3d,d,31,5,e9,52,9d,1e,4,93,bb,
Client builds and sends inital message
Message=
41,40,7d,c2,d1,9b,2,a6,43,c1,24,3,6d,29,d0,6a,
e2,f5,5a,9a,b0,f7,4f,fe,9f,73,17,f7,46,22,d4,53,
88,cc,f4,32,59,a1,13,4c,c3,61,eb,95,11,7c,a3,ac,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
6,d0,7,b0,2e,c7,3a,95,ec,39,14,76,2c,32,51,9d,
Server checks the message
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=true;
var PermutationFlag=false;
In left pane enter test1();
=undefined
>test1();
Auth,Mhash, and Transport keys
f,96,3d,11,4,a2,3b,f8,9a,3c,4a,13,95,62,bc,49,
7c,ec,7e,a,a7,a6,e1,39,d,44,dc,8b,89,c6,38,36,
43,97,71,b7,48,f4,a9,d0,3b,57,1c,18,33,2a,22,85,
Client builds and sends inital message
Sending Encrpyted Message=
ae,a9,64,60,ee,39,bb,4a,54,81,fc,dd,a6,1,28,34,
ca,3b,e3,a3,2,d8,d2,69,6c,94,da,c8,6f,31,5a,a5,
4,4a,5e,97,83,a2,5c,e6,f1,dc,69,a9,29,c3,18,b,
49,5d,99,ab,36,22,32,34,45,d5,f4,1,65,9b,61,ad,
38,59,c2,a5,27,30,6,30,df,f0,1f,35,41,b7,17,83,
decrypt
Message=
41,df,1d,24,2d,c7,5f,57,64,56,48,d9,cf,6,49,d8,
b4,a8,9f,48,c3,73,7d,a5,27,58,8,a8,17,95,e4,2f,
c8,56,14,5a,bc,d9,35,69,6d,91,9a,85,e8,59,f8,d0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
48,71,67,d0,3d,7a,89,10,88,7a,4c,ac,f2,ba,85,c8,
Server checks the message
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=false;
var PermutationFlag=true;
The permutation rearranges the byte order in the message.
Can you find the 0x41?
In left pane enter test1();
=undefined
>test1();
Auth,Mhash, and Transport keys
e1,b4,52,64,3c,68,ab,fc,c7,94,66,90,b6,ad,b7,a5,
29,b3,82,22,c3,d5,5e,36,97,a6,39,e3,46,77,4a,f1,
bd,6e,76,7,f,d6,37,24,8f,10,40,c2,5f,6,49,e7,
Client builds and sends inital message
Sending Permutated Message=
6d,0,ef,98,0,a8,66,ea,ed,41,a8,51,fc,9,5b,8f,
0,22,a6,0,1e,d5,e,ae,94,0,0,0,0,0,88,0,
61,8,ce,0,1b,66,c5,58,7a,d4,cb,3,5b,66,4a,0,
68,b4,f5,98,9e,0,54,51,10,b4,0,58,c1,30,50,34,
f8,3e,0,66,71,cf,f2,d4,74,91,36,c5,81,0,3d,0,
Message=
41,c1,d4,cf,b4,81,9,ea,94,6d,c5,f2,3d,66,3e,0,
54,a6,22,98,91,3,71,61,ed,58,f5,30,68,34,ce,10,
ae,58,88,8f,1b,66,f8,8,cb,ef,7a,d5,d4,4a,66,9e,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
c5,5b,51,74,e,98,51,5b,66,1e,36,a8,a8,50,fc,b4,
Server checks the message
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=true;
var PermutationFlag=true;
In left pane enter test1();
=undefined
>test1();
Auth,Mhash, and Transport keys
6,ce,ee,5b,9e,2b,7c,1c,6,cd,a2,b4,71,be,e,68,
fe,67,2a,fc,85,17,2f,66,7c,4b,42,a1,e7,de,d9,46,
19,4d,1,69,61,72,64,e0,17,3b,fb,4c,2e,9e,96,f4,
Client builds and sends inital message
Sending Permutated Message=
23,7a,a2,ba,15,8b,9,a2,ce,7d,6a,32,83,bb,20,48,
fb,ef,65,8d,79,cf,97,53,2e,30,69,98,c1,8a,62,89,
fe,8a,f9,b5,6,d8,6f,cd,e4,82,17,e0,51,28,5f,72,
d6,db,61,5e,cb,5,7a,4,7f,bd,9b,e4,24,1a,7e,d5,
6e,52,ad,a8,34,b7,6b,27,c7,be,e8,96,8b,34,94,1c,
Sending Encrpyted Message=
8d,b5,e4,fe,32,8a,1c,ce,a2,6,6a,15,fb,5,d5,ad,
83,51,6f,23,82,2e,e0,5e,cf,7e,c7,8a,1a,8b,62,f9,
ba,98,89,7a,7d,9b,65,6b,a2,79,34,97,ef,52,be,7f,
61,b7,d6,53,4,bb,bd,cb,72,7a,d8,34,a8,c1,30,20,
27,28,48,24,17,db,cd,6e,69,5f,94,8b,96,e4,e8,9,
decrypt
Message=
41,10,bf,23,b,4c,7,f8,a5,d9,9f,d5,f4,d7,23,6a,
ec,59,7c,62,5e,3f,a,1f,94,c1,af,ed,d5,a5,38,4,
59,48,4d,c6,70,c7,90,7d,b,a8,7a,f1,53,48,99,4b,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
b8,85,cc,6,a4,2b,db,b,26,58,de,8a,8e,5,dc,ea,
Server checks the message
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Message6.js
19 Aug 2016
Added encryption and permutation options to the message transport.
Set the flags at the top of this program to enable these features.
Additional module require("permutation")
The function that creates the permutation array has been modified.
Let N=16, then there are 15*13*11*9*7*5*3 = 2,027,025 combinations
If N=80, then there are 79*77*75*…*3 = 7.9777941814E+58 combinations
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=false;
var PermutationFlag=false;
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=true;
var PermutationFlag=false;
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=false;
var PermutationFlag=true;
The permutation rearranges the byte order in the message.
Can you find the 0x41?
Sample output with the flags set as follows:
// flags used in the Msg transport function
var EncryptionFlag=true;
var PermutationFlag=true;
4 Attachments