The output of Cryptomsg2.js
>echo(0); In left pane enter go(); and press return. =undefined >go(); Client Random # keys 245,23,232,200,114,36,105,20,254,96,85,201,114,36,105,4 69,150,99,34,208,230,34,168,128,106,45,199,203,46,28,219 Hash keys 232,65,134,243,114,36,105,20,195,103,245,243,114,36,105,1 188,177,5,173,141,150,119,10,10,7,153,174,225,238,77,145 Hash keys 242,148,162,50,115,36,105,20,180,39,16,51,115,36,105,250 217,67,207,60,54,115,75,227,116,255,243,203,112,230,97,82 Server Random # keys 217,1,45,181,115,36,105,20,79,84,156,181,115,36,105,203 215,180,29,227,242,69,139,118,47,238,145,221,141,226,213,38 { "text": [ new Uint8Array([65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94]), "Auth": new Uint8Array(16), "Mhash": new ArrayBuffer([26, 16, 180, 124, 63, 107, 133, 33, 128, 52, 101, 195, 208, 190, 102, 93]) } Client msg 1 hash OK { "text": [ new Uint8Array([65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60]), "Auth": new ArrayBuffer([3, 170, 20, 135, 37, 121, 216, 99, 141, 128, 79, 223, 167, 46, 246, 123]), "Mhash": new ArrayBuffer([99, 179, 42, 101, 76, 3, 51, 218, 226, 53, 95, 70, 171, 105, 83, 175]) } Server msg1 hash OK Server is authentic { "text": [ new Uint8Array([66, 153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69]), "Auth": new ArrayBuffer([34, 224, 5, 131, 161, 65, 136, 88, 134, 75, 54, 238, 99, 203, 160, 179]), "Mhash": new ArrayBuffer([61, 176, 71, 104, 148, 148, 164, 97, 70, 194, 169, 104, 156, 182, 148, 76]) } Client msg 2 hash OK Client is authentic { "text": [ new Uint8Array([66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34]), "Auth": new ArrayBuffer([3, 170, 20, 135, 37, 121, 216, 99, 141, 128, 79, 223, 167, 46, 246, 123]), "Mhash": new ArrayBuffer([74, 248, 250, 163, 194, 76, 103, 238, 169, 3, 248, 117, 159, 233, 64, 220]) } Trying to replay Client msg 1 hash OK Client msg 2 hash OK Client not authentic 167,33,148,163,150,43,129,28,79,255,93,113,35,215,40,72 34,224,5,131,161,65,136,88,134,75,54,238,99,203,160,179 New messages { "text": [ new Uint8Array([65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119]), "Auth": new Uint8Array(16), "Mhash": new ArrayBuffer([79, 10, 74, 218, 32, 96, 55, 0, 116, 245, 80, 95, 54, 76, 54, 114]) } Client msg 1 hash OK { "text": [ new Uint8Array([65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248]), "Auth": new ArrayBuffer([241, 254, 62, 248, 237, 77, 127, 26, 115, 224, 51, 144, 124, 210, 7, 250]), "Mhash": new ArrayBuffer([93, 70, 18, 33, 28, 195, 215, 238, 123, 48, 146, 157, 176, 143, 82, 131]) } Server msg1 hash OK Server is authentic { "text": [ new Uint8Array([66, 153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]), "Auth": new ArrayBuffer([168, 38, 120, 193, 88, 64, 50, 150, 39, 150, 95, 251, 65, 68, 138, 66]), "Mhash": new ArrayBuffer([184, 131, 13, 136, 192, 234, 14, 184, 72, 113, 231, 145, 199, 149, 231, 150]) } Client msg 2 hash OK Client is authentic { "text": [ new Uint8Array([66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) ], "Rnum": new Uint8Array([248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248]), "Auth": new ArrayBuffer([241, 254, 62, 248, 237, 77, 127, 26, 115, 224, 51, 144, 124, 210, 7, 250]), "Mhash": new ArrayBuffer([143, 19, 133, 234, 45, 4, 48, 57, 126, 126, 176, 205, 243, 97, 8, 8]) } =0
@ClearMemory041063 started
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.
The output of Cryptomsg2.js