commit 63f561e1faf74f037f4dfa915d8511d86d1855fc Author: Donovan Date: Fri May 17 14:30:26 2024 -0500 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6ef218 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea + diff --git a/darc.json b/darc.json new file mode 100644 index 0000000..255dba4 --- /dev/null +++ b/darc.json @@ -0,0 +1,1966 @@ +{ + "serverKey": [ + [ + 65, + 122, + 103, + 126 + ], + [ + 240, + 240, + 36, + 207 + ], + [ + 92, + 199, + 236, + 194 + ], + [ + 119, + 249, + 99, + 21 + ], + [ + 106, + 1, + 114, + 19 + ], + [ + 166, + 251, + 180, + 12 + ], + [ + 157, + 106, + 215, + 59 + ], + [ + 90, + 135, + 197, + 193 + ], + [ + 221, + 139, + 226, + 233 + ], + [ + 236, + 33, + 70, + 51 + ], + [ + 220, + 201, + 216, + 215 + ], + [ + 81, + 150, + 167, + 31 + ], + [ + 148, + 142, + 167, + 154 + ], + [ + 7, + 82, + 154, + 166 + ], + [ + 232, + 87, + 233, + 60 + ], + [ + 101, + 77, + 165, + 224 + ], + [ + 176, + 62, + 49, + 103 + ], + [ + 147, + 215, + 160, + 145 + ], + [ + 96, + 170, + 30, + 68 + ], + [ + 67, + 161, + 250, + 113 + ], + [ + 96, + 24, + 78, + 59 + ], + [ + 127, + 27, + 106, + 229 + ], + [ + 67, + 249, + 121, + 220 + ], + [ + 22, + 147, + 24, + 254 + ], + [ + 67, + 73, + 130, + 158 + ], + [ + 175, + 94, + 133, + 147 + ] + ], + "serverEphemeralKey": [ + [ + 102, + 67, + 14, + 139 + ], + [ + 22, + 207, + 112, + 97 + ], + [ + 118, + 242, + 15, + 0 + ], + [ + 25, + 119, + 238, + 47 + ], + [ + 227, + 16, + 186, + 192 + ], + [ + 155, + 245, + 19, + 128 + ], + [ + 43, + 167, + 85, + 144 + ], + [ + 45, + 82, + 213, + 25 + ], + [ + 99, + 220, + 147, + 136 + ], + [ + 109, + 142, + 44, + 225 + ], + [ + 78, + 172, + 221, + 211 + ], + [ + 179, + 223, + 58, + 122 + ], + [ + 167, + 226, + 244, + 172 + ], + [ + 38, + 121, + 221, + 12 + ], + [ + 242, + 3, + 203, + 72 + ], + [ + 244, + 65, + 165, + 185 + ], + [ + 73, + 12, + 236, + 191 + ], + [ + 191, + 129, + 71, + 227 + ], + [ + 3, + 206, + 59, + 169 + ], + [ + 194, + 248, + 204, + 243 + ], + [ + 113, + 144, + 63, + 111 + ], + [ + 111, + 135, + 28, + 186 + ], + [ + 174, + 12, + 56, + 209 + ], + [ + 159, + 185, + 68, + 32 + ], + [ + 176, + 173, + 48, + 226 + ], + [ + 96, + 104, + 31, + 196 + ] + ], + "functionKey": [ + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 1, + 2, + 0, + 3 + ] + ], + "functionEphemeralKey": [ + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 2, + 3, + 0 + ] + ], + "outerFunctionFunctionKey": [ + 23, + 17, + 25, + 19, + 16, + 11, + 15, + 9, + 0, + 10, + 22, + 24, + 7, + 8, + 4, + 1, + 3, + 6, + 14, + 2, + 18, + 20, + 12, + 13, + 5, + 21 + ], + "outerFunctionFunctionEphemeralKey": [ + 14, + 0, + 23, + 24, + 11, + 21, + 3, + 1, + 4, + 9, + 13, + 16, + 18, + 22, + 19, + 8, + 10, + 20, + 25, + 12, + 2, + 5, + 17, + 6, + 15, + 7 + ], + "outerFunctionEphemeralKey": [ + 19, + 6, + 20, + 10, + 23, + 13, + 12, + 17, + 3, + 25, + 24, + 21, + 15, + 14, + 18, + 4, + 8, + 7, + 1, + 0, + 5, + 2, + 16, + 22, + 11, + 9 + ], + "outerServerShuffleKey": [ + 5, + 8, + 23, + 6, + 0, + 4, + 2, + 1, + 13, + 10, + 21, + 17, + 11, + 22, + 15, + 19, + 14, + 16, + 12, + 9, + 25, + 18, + 3, + 20, + 7, + 24 + ], + "outerServerShuffleEphemeralKey": [ + 23, + 2, + 16, + 20, + 22, + 13, + 18, + 25, + 8, + 7, + 4, + 10, + 19, + 3, + 0, + 14, + 21, + 1, + 17, + 15, + 11, + 9, + 6, + 12, + 5, + 24 + ], + "outerFunctionFunctionEphemeralKeyApplied": [ + 4, + 23, + 13, + 5, + 24, + 20, + 19, + 17, + 16, + 10, + 8, + 3, + 14, + 12, + 2, + 0, + 22, + 18, + 21, + 7, + 25, + 11, + 6, + 15, + 1, + 9 + ], + "outerFunctionEphemeralKeyApplied": [ + 2, + 15, + 18, + 22, + 13, + 8, + 7, + 6, + 19, + 21, + 5, + 20, + 1, + 4, + 14, + 16, + 0, + 9, + 17, + 23, + 11, + 25, + 3, + 12, + 24, + 10 + ], + "functionEphemeralKeyApplied": [ + [ + 0, + 3, + 2, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 2, + 0, + 3, + 1 + ] + ], + "outerServerShuffleEphemeralKeyApplied": [ + 20, + 23, + 14, + 25, + 3, + 22, + 12, + 24, + 13, + 1, + 0, + 21, + 9, + 6, + 5, + 15, + 18, + 8, + 16, + 19, + 17, + 10, + 2, + 11, + 4, + 7 + ], + "interfaceConfig": [ + [ + 2, + 4, + 10, + 24 + ], + [ + 4, + 3, + 5, + 17 + ], + [ + 14, + 11, + 22, + 25 + ], + [ + 18, + 7, + 4, + 14 + ], + [ + 8, + 18, + 23, + 20 + ], + [ + 2, + 9, + 3, + 16 + ], + [ + 11, + 10, + 8, + 14 + ], + [ + 0, + 17, + 11, + 1 + ], + [ + 8, + 5, + 8, + 20 + ], + [ + 11, + 18, + 12, + 0 + ], + [ + 7, + 2, + 2, + 24 + ], + [ + 3, + 25, + 13, + 16 + ], + [ + 12, + 14, + 11, + 12 + ], + [ + 10, + 12, + 5, + 18 + ], + [ + 1, + 14, + 8, + 25 + ], + [ + 22, + 20, + 16, + 12 + ], + [ + 14, + 11, + 6, + 22 + ], + [ + 13, + 9, + 15, + 1 + ], + [ + 4, + 1, + 14, + 8 + ], + [ + 19, + 19, + 7, + 21 + ], + [ + 11, + 15, + 21, + 24 + ], + [ + 2, + 23, + 6, + 16 + ], + [ + 2, + 1, + 6, + 12 + ], + [ + 3, + 11, + 9, + 3 + ], + [ + 24, + 4, + 21, + 18 + ], + [ + 3, + 23, + 10, + 20 + ] + ], + "inputData": [ + [ + 11, + 15, + 21, + 24 + ], + [ + 3, + 11, + 9, + 3 + ], + [ + 1, + 14, + 8, + 25 + ], + [ + 3, + 23, + 10, + 20 + ], + [ + 18, + 7, + 4, + 14 + ], + [ + 2, + 1, + 6, + 12 + ], + [ + 12, + 14, + 11, + 12 + ], + [ + 24, + 4, + 21, + 18 + ], + [ + 10, + 12, + 5, + 18 + ], + [ + 4, + 3, + 5, + 17 + ], + [ + 2, + 4, + 10, + 24 + ], + [ + 2, + 23, + 6, + 16 + ], + [ + 11, + 18, + 12, + 0 + ], + [ + 11, + 10, + 8, + 14 + ], + [ + 2, + 9, + 3, + 16 + ], + [ + 22, + 20, + 16, + 12 + ], + [ + 4, + 1, + 14, + 8 + ], + [ + 8, + 5, + 8, + 20 + ], + [ + 14, + 11, + 6, + 22 + ], + [ + 19, + 19, + 7, + 21 + ], + [ + 13, + 9, + 15, + 1 + ], + [ + 7, + 2, + 2, + 24 + ], + [ + 14, + 11, + 22, + 25 + ], + [ + 3, + 25, + 13, + 16 + ], + [ + 8, + 18, + 23, + 20 + ], + [ + 0, + 17, + 11, + 1 + ] + ], + "arrayOfArrays": [ + [ + [ + 11, + 15, + 21, + 24 + ], + [ + 3, + 11, + 9, + 3 + ], + [ + 1, + 14, + 8, + 25 + ], + [ + 3, + 23, + 10, + 20 + ], + [ + 18, + 7, + 4, + 14 + ], + [ + 2, + 1, + 6, + 12 + ], + [ + 12, + 14, + 11, + 12 + ], + [ + 24, + 4, + 21, + 18 + ], + [ + 10, + 12, + 5, + 18 + ], + [ + 4, + 3, + 5, + 17 + ], + [ + 2, + 4, + 10, + 24 + ], + [ + 2, + 23, + 6, + 16 + ], + [ + 11, + 18, + 12, + 0 + ], + [ + 11, + 10, + 8, + 14 + ], + [ + 2, + 9, + 3, + 16 + ], + [ + 22, + 20, + 16, + 12 + ], + [ + 4, + 1, + 14, + 8 + ], + [ + 8, + 5, + 8, + 20 + ], + [ + 14, + 11, + 6, + 22 + ], + [ + 19, + 19, + 7, + 21 + ], + [ + 13, + 9, + 15, + 1 + ], + [ + 7, + 2, + 2, + 24 + ], + [ + 14, + 11, + 22, + 25 + ], + [ + 3, + 25, + 13, + 16 + ], + [ + 8, + 18, + 23, + 20 + ], + [ + 0, + 17, + 11, + 1 + ] + ], + [ + [ + 65, + 122, + 103, + 126 + ], + [ + 240, + 240, + 36, + 207 + ], + [ + 92, + 199, + 236, + 194 + ], + [ + 119, + 249, + 99, + 21 + ], + [ + 106, + 1, + 114, + 19 + ], + [ + 166, + 251, + 180, + 12 + ], + [ + 157, + 106, + 215, + 59 + ], + [ + 90, + 135, + 197, + 193 + ], + [ + 221, + 139, + 226, + 233 + ], + [ + 236, + 33, + 70, + 51 + ], + [ + 220, + 201, + 216, + 215 + ], + [ + 81, + 150, + 167, + 31 + ], + [ + 148, + 142, + 167, + 154 + ], + [ + 7, + 82, + 154, + 166 + ], + [ + 232, + 87, + 233, + 60 + ], + [ + 101, + 77, + 165, + 224 + ], + [ + 176, + 62, + 49, + 103 + ], + [ + 147, + 215, + 160, + 145 + ], + [ + 96, + 170, + 30, + 68 + ], + [ + 67, + 161, + 250, + 113 + ], + [ + 96, + 24, + 78, + 59 + ], + [ + 127, + 27, + 106, + 229 + ], + [ + 67, + 249, + 121, + 220 + ], + [ + 22, + 147, + 24, + 254 + ], + [ + 67, + 73, + 130, + 158 + ], + [ + 175, + 94, + 133, + 147 + ] + ], + [ + [ + 102, + 67, + 14, + 139 + ], + [ + 22, + 207, + 112, + 97 + ], + [ + 118, + 242, + 15, + 0 + ], + [ + 25, + 119, + 238, + 47 + ], + [ + 227, + 16, + 186, + 192 + ], + [ + 155, + 245, + 19, + 128 + ], + [ + 43, + 167, + 85, + 144 + ], + [ + 45, + 82, + 213, + 25 + ], + [ + 99, + 220, + 147, + 136 + ], + [ + 109, + 142, + 44, + 225 + ], + [ + 78, + 172, + 221, + 211 + ], + [ + 179, + 223, + 58, + 122 + ], + [ + 167, + 226, + 244, + 172 + ], + [ + 38, + 121, + 221, + 12 + ], + [ + 242, + 3, + 203, + 72 + ], + [ + 244, + 65, + 165, + 185 + ], + [ + 73, + 12, + 236, + 191 + ], + [ + 191, + 129, + 71, + 227 + ], + [ + 3, + 206, + 59, + 169 + ], + [ + 194, + 248, + 204, + 243 + ], + [ + 113, + 144, + 63, + 111 + ], + [ + 111, + 135, + 28, + 186 + ], + [ + 174, + 12, + 56, + 209 + ], + [ + 159, + 185, + 68, + 32 + ], + [ + 176, + 173, + 48, + 226 + ], + [ + 96, + 104, + 31, + 196 + ] + ] + ], + "incoming": [ + [ + 62, + 37, + 215, + 251 + ], + [ + 146, + 11, + 80, + 15 + ], + [ + 36, + 109, + 229, + 125 + ], + [ + 66, + 250, + 255, + 25 + ], + [ + 85, + 38, + 174, + 37 + ], + [ + 188, + 86, + 119, + 109 + ], + [ + 217, + 30, + 124, + 212 + ], + [ + 154, + 201, + 190, + 164 + ], + [ + 60, + 85, + 135, + 147 + ], + [ + 20, + 117, + 90, + 141 + ], + [ + 12, + 163, + 134, + 37 + ], + [ + 19, + 67, + 142, + 97 + ], + [ + 95, + 188, + 51, + 230 + ], + [ + 26, + 217, + 192, + 135 + ], + [ + 118, + 19, + 33, + 68 + ], + [ + 239, + 204, + 205, + 62 + ], + [ + 241, + 38, + 55, + 97 + ], + [ + 137, + 215, + 98, + 187 + ], + [ + 124, + 39, + 225, + 64 + ], + [ + 154, + 79, + 217, + 63 + ], + [ + 144, + 235, + 106, + 72 + ], + [ + 80, + 152, + 205, + 46 + ], + [ + 96, + 133, + 44, + 148 + ], + [ + 111, + 47, + 62, + 67 + ], + [ + 236, + 225, + 165, + 104 + ], + [ + 5, + 116, + 15, + 147 + ] + ] +} \ No newline at end of file diff --git a/darc_key_json/client_ephemeral_keys.json b/darc_key_json/client_ephemeral_keys.json new file mode 100644 index 0000000..5442d82 --- /dev/null +++ b/darc_key_json/client_ephemeral_keys.json @@ -0,0 +1,10 @@ +{ + "OuterClientShuffleEphemeralKey": [[1,4,2,9,5,7,8,3,0,6]], + "OuterClientShuffleFunctionEphemeralKey": [[4,3,2,5,1,6,7,8,0,9]], + "ClientEphemeralKey": [[21,149,75,73,228,81,79],[41,189,80,209,45,101,53],[139,238,141,159,30,79,214],[239,234,72,75,80,190,124],[203,225,246,200,205,195,92],[201,185,113,101,176,216,106],[14,210,125,70,53,128,57],[115,27,97,39,199,26,104],[29,4,55,5,13,57,19],[158,184,137,0,221,12,217]], + "ClientShuffleEphemeralKeyA": [[5,0,4,3,2,6,1],[0,6,2,1,5,3,4],[1,2,0,3,5,4,6],[0,2,6,3,4,5,1],[5,1,2,0,3,4,6],[1,0,3,4,5,6,2],[3,0,5,2,6,4,1],[6,4,5,3,0,2,1],[2,4,6,0,3,5,1],[4,6,2,3,5,1,0]], + "OuterClientShuffleMediumEphemeralKey": [[2,3,9,6,5,7,4,1,0,8]], + "OuterClientShuffleFunctionMediumEphemeralKey": [[0,1,6,3,4,5,7,9,2,8]], + "ClientShuffleMediumEphemeralKeyA": [[2,4,1,6,3,0,5],[5,1,6,4,0,2,3],[3,6,5,1,4,0,2],[6,4,5,2,3,1,0],[6,0,3,5,1,2,4],[6,0,3,1,4,2,5],[4,1,3,0,2,5,6],[5,0,2,1,6,4,3],[3,2,4,5,6,0,1],[1,5,0,2,3,6,4]], + "ClientMediumEphemeralKey": [[196,239,0,227,191,41,36],[99,212,122,236,132,38,217],[196,175,206,246,149,100,83],[18,216,7,225,159,221,59],[56,200,125,86,197,39,108],[214,128,152,217,7,138,12],[47,165,141,81,99,208,85],[71,79,10,15,36,139,177],[68,22,52,200,132,0,125],[205,198,219,188,190,238,23]] +} diff --git a/darc_key_json/client_persistent_keys.json b/darc_key_json/client_persistent_keys.json new file mode 100644 index 0000000..a4e6b31 --- /dev/null +++ b/darc_key_json/client_persistent_keys.json @@ -0,0 +1,30 @@ +{ + "OuterFunctionKey": [[9, 7, 4, 2, 5, 3, 0, 6, 1, 8]], + "OuterFunctionFunctionKey": [[8, 1, 4, 5, 2, 3, 7, 6, 0, 9]], + "OuterServerShuffleFunctionKey": [[3, 9, 2, 5, 0, 7, 6, 8, 1, 4]], + "MutualKey": [[197, 126, 66, 64, 226, 18, 153], [28, 15, 172, 73, 132, 222, 220], [110, 115, 107, 210, 52, 23, 116], [178, 122, 168, 93, 146, 206, 80], [22, 191, 165, 251, 58, 135, 166], [137, 78, 235, 223, 179, 194, 64], [134, 130, 154, 214, 225, 215, 97], [60, 41, 193, 9, 197, 108, 87], [198, 134, 72, 146, 247, 223, 166], [104, 81, 159, 34, 29, 200, 196]], + "FunctionKey": [[1, 5, 0, 2, 3, 6, 4], [5, 2, 6, 4, 1, 3, 0], [4, 2, 3, 5, 6, 1, 0], [0, 3, 1, 6, 5, 2, 4], [4, 1, 3, 0, 6, 5, 2], [6, 3, 4, 2, 5, 1, 0], [2, 3, 0, 4, 1, 6, 5], [4, 0, 6, 5, 2, 3, 1], [3, 2, 4, 1, 0, 5, 6], [2, 3, 4, 1, 5, 0, 6]], + "ClientShuffleKeyX": [[6, 3, 1, 4, 5, 0, 2], [6, 5, 0, 2, 3, 4, 1], [1, 4, 0, 6, 3, 2, 5], [6, 1, 4, 5, 3, 2, 0], [2, 0, 1, 4, 3, 5, 6], [3, 0, 6, 2, 1, 4, 5], [3, 2, 0, 1, 6, 4, 5], [6, 2, 3, 0, 1, 5, 4], [3, 0, 6, 5, 4, 1, 2], [3, 2, 5, 0, 4, 1, 6]], + + "MutualMediumKey": [[134, 55, 223, 228, 216, 192, 220], [84, 232, 155, 47, 216, 122, 96], [238, 56, 234, 113, 178, 232, 59], [159, 126, 156, 186, 176, 95, 207], [55, 49, 8, 218, 248, 232, 26], [244, 128, 254, 159, 227, 164, 88], [86, 49, 163, 158, 91, 29, 85], [224, 29, 111, 130, 45, 64, 242], [233, 36, 69, 153, 173, 187, 85], [190, 180, 204, 92, 117, 118, 208]], + "OuterFunctionMediumKey": [[1, 6, 0, 2, 9, 5, 8, 4, 7, 3]], + "OuterFunctionFunctionMediumKey": [[4, 1, 7, 8, 9, 6, 0, 2, 3, 5]], + "OuterServerShuffleFunctionMediumKey": [[4, 0, 5, 9, 3, 1, 7, 8, 6, 2]], + "FunctionMediumKey": [[0, 2, 5, 3, 6, 4, 1], [0, 6, 4, 3, 1, 2, 5], [1, 6, 2, 0, 4, 5, 3], [0, 3, 1, 5, 6, 2, 4], [3, 2, 0, 6, 5, 1, 4], [1, 3, 6, 4, 5, 0, 2], [5, 0, 6, 3, 1, 2, 4], [6, 4, 3, 5, 0, 1, 2], [5, 2, 3, 6, 1, 0, 4], [3, 6, 1, 0, 2, 5, 4]], + "ClientShuffleMediumKeyX": [[2, 1, 6, 0, 5, 4, 3], [3, 0, 5, 2, 6, 4, 1], [5, 3, 0, 1, 2, 6, 4], [3, 5, 4, 1, 0, 6, 2], [0, 5, 2, 4, 1, 3, 6], [5, 2, 3, 1, 4, 6, 0], [2, 1, 5, 6, 3, 0, 4], [4, 6, 0, 3, 5, 1, 2], [1, 3, 2, 0, 4, 5, 6], [3, 6, 5, 1, 0, 4, 2]], + "OuterPositionShuffleMediumKey": [[7, 5, 4, 8, 6, 3, 0, 1, 9, 2]], + "OuterPositionShuffleFunctionMediumKey": [[9, 2, 5, 0, 1, 6, 8, 4, 3, 7]], + "OuterPositionFunctionMediumKey": [[7, 2, 0, 8, 1, 6, 3, 5, 9, 4]], + "PositionFunctionMediumKey": [[1, 5, 4, 0, 6, 2, 3], [2, 4, 0, 5, 3, 6, 1], [1, 4, 0, 2, 5, 6, 3], [4, 1, 0, 3, 2, 6, 5], [4, 0, 2, 3, 5, 6, 1], [1, 0, 2, 3, 4, 6, 5], [2, 3, 1, 5, 0, 6, 4], [1, 0, 3, 2, 4, 5, 6], [4, 0, 1, 5, 2, 6, 3], [2, 1, 0, 3, 6, 5, 4]], + "PositionShuffleMediumKey": [[5, 4, 3, 1, 2, 0, 6], [0, 2, 5, 4, 6, 1, 3], [6, 3, 1, 2, 5, 0, 4], [0, 1, 6, 5, 4, 3, 2], [1, 2, 6, 0, 5, 3, 4], [2, 1, 5, 6, 0, 3, 4], [5, 3, 0, 4, 1, 2, 6], [2, 1, 4, 5, 3, 0, 6], [0, 1, 6, 2, 4, 5, 3], [3, 6, 4, 2, 5, 1, 0]], + + "ClientKey": [[148, 232, 147, 96, 20, 201, 150], [120, 0, 158, 250, 176, 223, 82], [12, 81, 193, 212, 247, 100, 1], [127, 211, 164, 202, 25, 149, 34], [214, 38, 10, 197, 195, 97, 193], [177, 120, 199, 180, 206, 184, 155], [154, 146, 186, 205, 190, 47, 169], [164, 80, 233, 207, 214, 91, 108], [123, 101, 231, 244, 92, 88, 12], [222, 193, 85, 98, 224, 145, 0]], + "ClientShuffleKeyA": [[6, 0, 3, 5, 2, 1, 4], [4, 3, 2, 5, 0, 1, 6], [5, 4, 1, 0, 2, 3, 6], [3, 6, 1, 4, 5, 2, 0], [3, 5, 4, 2, 0, 1, 6], [6, 1, 5, 4, 2, 3, 0], [0, 4, 6, 3, 5, 1, 2], [0, 6, 4, 3, 1, 2, 5], [5, 0, 6, 3, 4, 1, 2], [3, 2, 0, 4, 1, 6, 5]], + "OuterClientShuffleKey": [[6, 4, 7, 8, 0, 2, 1, 9, 5, 3]], + "OuterClientShuffleFunctionKey": [[4, 2, 1, 0, 5, 7, 8, 9, 3, 6]], + + "OuterClientShuffleMediumKey": [[6, 7, 0, 4, 1, 8, 2, 5, 3, 9]], + "OuterClientShuffleFunctionMediumKey": [[3, 2, 9, 5, 4, 7, 0, 6, 8, 1]], + "ClientShuffleMediumKeyA": [[5, 4, 0, 6, 1, 2, 3], [6, 0, 5, 3, 4, 1, 2], [5, 2, 0, 6, 3, 1, 4], [5, 4, 6, 1, 3, 2, 0], [0, 2, 3, 1, 4, 5, 6], [1, 3, 6, 4, 0, 5, 2], [2, 6, 4, 5, 1, 3, 0], [6, 3, 0, 2, 5, 4, 1], [5, 4, 1, 6, 0, 3, 2], [6, 2, 0, 4, 1, 3, 5]], + "ClientMediumKey": [[16, 193, 15, 233, 117, 250, 34], [246, 77, 93, 136, 102, 250, 63], [214, 203, 45, 87, 239, 246, 207], [97, 24, 129, 224, 42, 111, 39], [46, 178, 119, 116, 89, 226, 216], [212, 133, 56, 244, 233, 251, 117], [139, 72, 193, 199, 141, 188, 200], [60, 229, 239, 108, 154, 254, 241], [189, 192, 168, 92, 5, 121, 18], [160, 69, 107, 197, 130, 150, 168]] +} \ No newline at end of file diff --git a/darc_key_json/mutual_ephemeral_keys.json b/darc_key_json/mutual_ephemeral_keys.json new file mode 100644 index 0000000..3e9a774 --- /dev/null +++ b/darc_key_json/mutual_ephemeral_keys.json @@ -0,0 +1,680 @@ +{ + "MutualEphemeralKey": [ + [ + 106, + 113, + 9, + 54, + 49, + 4, + 207 + ], + [ + 184, + 3, + 232, + 179, + 15, + 113, + 142 + ], + [ + 129, + 44, + 164, + 54, + 1, + 32, + 201 + ], + [ + 106, + 50, + 246, + 140, + 149, + 179, + 109 + ], + [ + 210, + 11, + 69, + 193, + 77, + 245, + 62 + ], + [ + 37, + 76, + 137, + 24, + 220, + 30, + 165 + ], + [ + 40, + 57, + 147, + 225, + 24, + 176, + 103 + ], + [ + 37, + 212, + 189, + 203, + 218, + 138, + 168 + ], + [ + 73, + 227, + 38, + 164, + 20, + 239, + 24 + ], + [ + 7, + 194, + 254, + 76, + 0, + 244, + 215 + ] + ], + "FunctionEphemeralKey": [ + [ + 6, + 0, + 1, + 4, + 2, + 3, + 5 + ], + [ + 2, + 3, + 6, + 4, + 0, + 1, + 5 + ], + [ + 2, + 4, + 0, + 3, + 6, + 1, + 5 + ], + [ + 0, + 4, + 2, + 3, + 1, + 5, + 6 + ], + [ + 6, + 4, + 2, + 5, + 1, + 0, + 3 + ], + [ + 5, + 1, + 0, + 6, + 4, + 2, + 3 + ], + [ + 1, + 2, + 4, + 3, + 6, + 0, + 5 + ], + [ + 6, + 1, + 4, + 0, + 5, + 3, + 2 + ], + [ + 2, + 3, + 5, + 4, + 6, + 0, + 1 + ], + [ + 1, + 6, + 4, + 3, + 5, + 2, + 0 + ] + ], + "OuterFunctionEphemeralKey": [ + [ + 0, + 9, + 6, + 2, + 1, + 5, + 3, + 8, + 7, + 4 + ] + ], + "OuterFunctionFunctionEphemeralKey": [ + [ + 2, + 3, + 9, + 7, + 6, + 0, + 1, + 4, + 8, + 5 + ] + ], + "OuterServerShuffleFunctionEphemeralKey": [ + [ + 0, + 8, + 5, + 9, + 7, + 3, + 1, + 4, + 6, + 2 + ] + ], + "MutualMediumEphemeralKey": [ + [ + 106, + 113, + 9, + 54, + 49, + 4, + 207 + ], + [ + 184, + 3, + 232, + 179, + 15, + 113, + 142 + ], + [ + 129, + 44, + 164, + 54, + 1, + 32, + 201 + ], + [ + 106, + 50, + 246, + 140, + 149, + 179, + 109 + ], + [ + 210, + 11, + 69, + 193, + 77, + 245, + 62 + ], + [ + 37, + 76, + 137, + 24, + 220, + 30, + 165 + ], + [ + 40, + 57, + 147, + 225, + 24, + 176, + 103 + ], + [ + 37, + 212, + 189, + 203, + 218, + 138, + 168 + ], + [ + 73, + 227, + 38, + 164, + 20, + 239, + 24 + ], + [ + 7, + 194, + 254, + 76, + 0, + 244, + 215 + ] + ], + "FunctionMediumEphemeralKey": [ + [ + 1, + 0, + 5, + 6, + 4, + 3, + 2 + ], + [ + 4, + 0, + 1, + 5, + 3, + 2, + 6 + ], + [ + 6, + 4, + 0, + 3, + 1, + 5, + 2 + ], + [ + 6, + 3, + 4, + 1, + 2, + 5, + 0 + ], + [ + 4, + 5, + 2, + 3, + 1, + 6, + 0 + ], + [ + 4, + 6, + 1, + 0, + 3, + 2, + 5 + ], + [ + 5, + 0, + 6, + 4, + 2, + 1, + 3 + ], + [ + 3, + 5, + 2, + 6, + 0, + 1, + 4 + ], + [ + 0, + 1, + 3, + 6, + 2, + 4, + 5 + ], + [ + 6, + 3, + 4, + 2, + 5, + 0, + 1 + ] + ], + "PositionFunctionMediumEphemeralKey": [ + [ + 1, + 2, + 3, + 4, + 0, + 6, + 5 + ], + [ + 5, + 2, + 1, + 3, + 6, + 0, + 4 + ], + [ + 2, + 1, + 0, + 4, + 5, + 6, + 3 + ], + [ + 3, + 6, + 4, + 1, + 5, + 0, + 2 + ], + [ + 0, + 4, + 6, + 3, + 2, + 1, + 5 + ], + [ + 4, + 5, + 3, + 2, + 6, + 0, + 1 + ], + [ + 3, + 5, + 0, + 6, + 2, + 1, + 4 + ], + [ + 3, + 5, + 1, + 6, + 2, + 0, + 4 + ], + [ + 3, + 0, + 5, + 2, + 1, + 4, + 6 + ], + [ + 5, + 4, + 2, + 6, + 3, + 0, + 1 + ] + ], + "OuterFunctionMediumEphemeralKey": [ + [ + 5, + 0, + 3, + 8, + 9, + 7, + 6, + 4, + 2, + 1 + ] + ], + "OuterFunctionFunctionMediumEphemeralKey": [ + [ + 6, + 9, + 7, + 1, + 2, + 8, + 3, + 5, + 4, + 0 + ] + ], + "OuterPositionFunctionMediumEphemeralKey": [ + [ + 6, + 8, + 2, + 1, + 0, + 5, + 7, + 9, + 3, + 4 + ] + ], + "OuterServerShuffleFunctionMediumEphemeralKey": [ + [ + 8, + 0, + 9, + 6, + 7, + 4, + 2, + 1, + 3, + 5 + ] + ], + "OuterPositionShuffleFunctionMediumEphemeralKey": [ + [ + 7, + 1, + 9, + 2, + 6, + 4, + 0, + 3, + 5, + 8 + ] + ], + "PositionShuffleMediumEphemeralKey": [ + [ + 0, + 1, + 5, + 2, + 4, + 3, + 6 + ], + [ + 1, + 3, + 5, + 2, + 6, + 4, + 0 + ], + [ + 3, + 6, + 0, + 2, + 5, + 4, + 1 + ], + [ + 3, + 6, + 2, + 0, + 5, + 1, + 4 + ], + [ + 2, + 6, + 4, + 1, + 0, + 5, + 3 + ], + [ + 6, + 2, + 0, + 3, + 1, + 4, + 5 + ], + [ + 5, + 2, + 1, + 3, + 4, + 6, + 0 + ], + [ + 3, + 2, + 0, + 5, + 1, + 4, + 6 + ], + [ + 4, + 2, + 6, + 1, + 0, + 3, + 5 + ], + [ + 3, + 1, + 5, + 0, + 6, + 2, + 4 + ] + ], + "OuterPositionShuffleMediumEphemeralKey": [ + [ + 1, + 9, + 6, + 4, + 0, + 5, + 7, + 2, + 8, + 3 + ] + ] +} \ No newline at end of file diff --git a/darc_key_json/server_ephemeral_keys.json b/darc_key_json/server_ephemeral_keys.json new file mode 100644 index 0000000..11a8039 --- /dev/null +++ b/darc_key_json/server_ephemeral_keys.json @@ -0,0 +1,7 @@ +{ + "OuterServerShuffleEphemeralKey": [[7,5,2,1,8,4,3,6,9,0]], + "ServerEphemeralKey": [[206,101,8,204,115,100,89],[108,247,32,6,2,165,114],[52,169,117,54,230,48,109],[179,218,87,113,86,50,182],[248,53,202,160,133,191,208],[220,64,196,172,113,159,71],[129,99,201,133,213,131,195],[75,151,222,237,193,169,122],[131,125,69,154,243,214,89],[245,65,225,44,226,68,216]], + "ServerShuffleEphemeralKey": [[6,1,3,0,4,2,5],[3,2,1,0,4,5,6],[2,4,3,5,0,6,1],[4,1,3,6,0,2,5],[1,4,2,3,0,5,6],[6,4,5,0,2,3,1],[0,4,2,3,1,5,6],[0,6,3,5,1,2,4],[2,6,3,1,4,5,0],[5,0,4,1,6,3,2]], + "ServerMediumEphemeralKey": [[122,2,181,28,253,157,228],[209,94,236,250,2,133,44],[16,40,112,171,92,121,235],[242,194,137,155,217,175,61],[22,152,73,65,106,43,186],[101,77,107,181,210,24,204],[16,22,46,83,188,106,117],[31,144,220,193,98,30,81],[227,29,136,169,69,9,25],[79,106,14,23,137,61,59]], + "Alphabet": [[253, 144, 217, 190, 1, 49, 154], [103, 69, 139, 148, 17, 244, 36], [84, 171, 243, 99, 236, 46, 251], [128, 123, 182, 14, 176, 65, 31], [92, 241, 32, 224, 48, 223, 145], [222, 39, 131, 33, 233, 127, 73], [156, 101, 208, 162, 105, 169, 107], [80, 0, 83, 61, 125, 177, 164], [134, 64, 212, 111, 172, 26, 60], [242, 78, 245, 137, 115, 120, 149]] +} diff --git a/darc_key_json/server_persistent_keys.json b/darc_key_json/server_persistent_keys.json new file mode 100644 index 0000000..8bea08e --- /dev/null +++ b/darc_key_json/server_persistent_keys.json @@ -0,0 +1,26 @@ +{ + "OuterFunctionKey": [[9, 7, 4, 2, 5, 3, 0, 6, 1, 8]], + "OuterFunctionFunctionKey": [[8, 1, 4, 5, 2, 3, 7, 6, 0, 9]], + "OuterServerShuffleFunctionKey": [[3, 9, 2, 5, 0, 7, 6, 8, 1, 4]], + "MutualKey": [[197, 126, 66, 64, 226, 18, 153], [28, 15, 172, 73, 132, 222, 220], [110, 115, 107, 210, 52, 23, 116], [178, 122, 168, 93, 146, 206, 80], [22, 191, 165, 251, 58, 135, 166], [137, 78, 235, 223, 179, 194, 64], [134, 130, 154, 214, 225, 215, 97], [60, 41, 193, 9, 197, 108, 87], [198, 134, 72, 146, 247, 223, 166], [104, 81, 159, 34, 29, 200, 196]], + "FunctionKey": [[1, 5, 0, 2, 3, 6, 4], [5, 2, 6, 4, 1, 3, 0], [4, 2, 3, 5, 6, 1, 0], [0, 3, 1, 6, 5, 2, 4], [4, 1, 3, 0, 6, 5, 2], [6, 3, 4, 2, 5, 1, 0], [2, 3, 0, 4, 1, 6, 5], [4, 0, 6, 5, 2, 3, 1], [3, 2, 4, 1, 0, 5, 6], [2, 3, 4, 1, 5, 0, 6]], + "ClientShuffleKeyX": [[6, 3, 1, 4, 5, 0, 2], [6, 5, 0, 2, 3, 4, 1], [1, 4, 0, 6, 3, 2, 5], [6, 1, 4, 5, 3, 2, 0], [2, 0, 1, 4, 3, 5, 6], [3, 0, 6, 2, 1, 4, 5], [3, 2, 0, 1, 6, 4, 5], [6, 2, 3, 0, 1, 5, 4], [3, 0, 6, 5, 4, 1, 2], [3, 2, 5, 0, 4, 1, 6]], + + "MutualMediumKey": [[134, 55, 223, 228, 216, 192, 220], [84, 232, 155, 47, 216, 122, 96], [238, 56, 234, 113, 178, 232, 59], [159, 126, 156, 186, 176, 95, 207], [55, 49, 8, 218, 248, 232, 26], [244, 128, 254, 159, 227, 164, 88], [86, 49, 163, 158, 91, 29, 85], [224, 29, 111, 130, 45, 64, 242], [233, 36, 69, 153, 173, 187, 85], [190, 180, 204, 92, 117, 118, 208]], + "OuterFunctionMediumKey": [[1, 6, 0, 2, 9, 5, 8, 4, 7, 3]], + "OuterFunctionFunctionMediumKey": [[4, 1, 7, 8, 9, 6, 0, 2, 3, 5]], + "OuterServerShuffleFunctionMediumKey": [[4, 0, 5, 9, 3, 1, 7, 8, 6, 2]], + "FunctionMediumKey": [[0, 2, 5, 3, 6, 4, 1], [0, 6, 4, 3, 1, 2, 5], [1, 6, 2, 0, 4, 5, 3], [0, 3, 1, 5, 6, 2, 4], [3, 2, 0, 6, 5, 1, 4], [1, 3, 6, 4, 5, 0, 2], [5, 0, 6, 3, 1, 2, 4], [6, 4, 3, 5, 0, 1, 2], [5, 2, 3, 6, 1, 0, 4], [3, 6, 1, 0, 2, 5, 4]], + "ClientShuffleMediumKeyX": [[2, 1, 6, 0, 5, 4, 3], [3, 0, 5, 2, 6, 4, 1], [5, 3, 0, 1, 2, 6, 4], [3, 5, 4, 1, 0, 6, 2], [0, 5, 2, 4, 1, 3, 6], [5, 2, 3, 1, 4, 6, 0], [2, 1, 5, 6, 3, 0, 4], [4, 6, 0, 3, 5, 1, 2], [1, 3, 2, 0, 4, 5, 6], [3, 6, 5, 1, 0, 4, 2]], + "OuterPositionShuffleMediumKey": [[7, 5, 4, 8, 6, 3, 0, 1, 9, 2]], + "OuterPositionShuffleFunctionMediumKey": [[9, 2, 5, 0, 1, 6, 8, 4, 3, 7]], + "OuterPositionFunctionMediumKey": [[7, 2, 0, 8, 1, 6, 3, 5, 9, 4]], + "PositionFunctionMediumKey": [[1, 5, 4, 0, 6, 2, 3], [2, 4, 0, 5, 3, 6, 1], [1, 4, 0, 2, 5, 6, 3], [4, 1, 0, 3, 2, 6, 5], [4, 0, 2, 3, 5, 6, 1], [1, 0, 2, 3, 4, 6, 5], [2, 3, 1, 5, 0, 6, 4], [1, 0, 3, 2, 4, 5, 6], [4, 0, 1, 5, 2, 6, 3], [2, 1, 0, 3, 6, 5, 4]], + "PositionShuffleMediumKey": [[5, 4, 3, 1, 2, 0, 6], [0, 2, 5, 4, 6, 1, 3], [6, 3, 1, 2, 5, 0, 4], [0, 1, 6, 5, 4, 3, 2], [1, 2, 6, 0, 5, 3, 4], [2, 1, 5, 6, 0, 3, 4], [5, 3, 0, 4, 1, 2, 6], [2, 1, 4, 5, 3, 0, 6], [0, 1, 6, 2, 4, 5, 3], [3, 6, 4, 2, 5, 1, 0]], + + "OuterServerShuffleKey": [[4, 9, 6, 0, 7, 5, 3, 1, 2, 8]], + "ServerKey": [[242, 97, 234, 194, 76, 104, 44], [232, 187, 4, 235, 28, 253, 239], [135, 213, 186, 200, 121, 14, 36], [16, 119, 58, 129, 53, 73, 8], [190, 27, 252, 176, 97, 8, 138], [116, 158, 97, 219, 187, 13, 179], [101, 112, 112, 80, 213, 35, 178], [196, 171, 60, 254, 251, 236, 206], [210, 226, 52, 138, 164, 63, 170], [146, 143, 69, 69, 141, 151, 174]], + "ServerShuffleKey": [[5, 2, 3, 0, 6, 4, 1], [5, 2, 6, 3, 0, 1, 4], [1, 3, 5, 0, 2, 6, 4], [6, 2, 1, 4, 5, 0, 3], [2, 3, 4, 1, 5, 6, 0], [3, 2, 0, 1, 5, 4, 6], [2, 6, 0, 3, 4, 1, 5], [3, 0, 4, 6, 2, 5, 1], [5, 3, 2, 0, 6, 4, 1], [1, 4, 5, 3, 2, 6, 0]], + + "ServerMediumKey": [[112, 102, 52, 70, 128, 146, 63], [237, 152, 85, 249, 104, 196, 236], [102, 8, 226, 21, 208, 141, 226], [156, 142, 127, 216, 244, 176, 108], [180, 69, 102, 8, 144, 57, 116], [71, 231, 161, 63, 102, 253, 15], [124, 217, 105, 12, 79, 35, 60], [255, 142, 198, 151, 250, 242, 195], [207, 75, 238, 78, 51, 122, 150], [253, 208, 32, 232, 53, 47, 22]] +} diff --git a/permutation_function_playground.ipynb b/permutation_function_playground.ipynb new file mode 100644 index 0000000..6e05dee --- /dev/null +++ b/permutation_function_playground.ipynb @@ -0,0 +1,51 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true, + "ExecuteTime": { + "end_time": "2024-04-26T18:17:33.998346Z", + "start_time": "2024-04-26T18:17:33.995935Z" + } + }, + "outputs": [], + "source": [ + "import random" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "random" + ], + "metadata": { + "collapsed": false + } + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/__pycache__/__init__.cpython-310.pyc b/src/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..daa0410 Binary files /dev/null and b/src/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/__pycache__/darc_key.cpython-310.pyc b/src/__pycache__/darc_key.cpython-310.pyc new file mode 100644 index 0000000..f17773d Binary files /dev/null and b/src/__pycache__/darc_key.cpython-310.pyc differ diff --git a/src/__pycache__/models.cpython-310.pyc b/src/__pycache__/models.cpython-310.pyc new file mode 100644 index 0000000..85080e8 Binary files /dev/null and b/src/__pycache__/models.cpython-310.pyc differ diff --git a/src/__pycache__/utils.cpython-310.pyc b/src/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000..f0082a8 Binary files /dev/null and b/src/__pycache__/utils.cpython-310.pyc differ diff --git a/src/darc_key.py b/src/darc_key.py new file mode 100644 index 0000000..3a86de8 --- /dev/null +++ b/src/darc_key.py @@ -0,0 +1,360 @@ +from src.models import AlphabetKey, OuterShuffleKey, InnerShuffleKey, PersistentKeys, EphemeralKeys, DarcKey, Phase1Session, Session, TxData, Medium +import json + + +def get_test_keys(): + with open("../testDarcKeys.json", 'r') as fp: + test_data = json.load(fp) + + persistent_keys = PersistentKeys( + serverKey=AlphabetKey( + matrix=test_data["persistentKeys"]["serverKey"] + ), + functionKey=InnerShuffleKey( + matrix=test_data["persistentKeys"]["functionKey"] + ), + serverShuffleKey=InnerShuffleKey( + matrix=test_data["persistentKeys"]["serverShuffleKey"] + ), + outerFunctionKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerFunctionKey"]] + ), + outerFunctionFunctionKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerFunctionFunctionKey"]] + ), + outerServerShuffleKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerServerShuffleKey"]] + ), + outerServerShuffleFunctionKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerServerShuffleFunctionKey"]] + ), + clientKey=AlphabetKey( + matrix=test_data["persistentKeys"]["clientKey"] + ), + sharedKey=AlphabetKey( + matrix=test_data["persistentKeys"]["sharedKey"] + ), + clientShuffleKeyX=InnerShuffleKey( + matrix=test_data["persistentKeys"]["clientShuffleKeyX"] + ), + clientShuffleKeyA=InnerShuffleKey( + matrix=test_data["persistentKeys"]["clientShuffleKeyA"] + ), + functionMediumKey=InnerShuffleKey( + matrix=test_data["persistentKeys"]["functionMediumKey"] + ), + clientShuffleMediumKeyX=InnerShuffleKey( + matrix=test_data["persistentKeys"]["clientShuffleMediumKeyX"] + ), + inputMediumData=AlphabetKey( + matrix=test_data["persistentKeys"]["inputMediumData"] + ), + serverMediumKey=InnerShuffleKey( + matrix=test_data["persistentKeys"]["serverMediumKey"] + ), + outerFunctionMediumKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerFunctionMediumKey"]] + ), + outerFunctionFunctionMediumKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerFunctionFunctionMediumKey"]] + ), + outerServerShuffleMediumKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerServerShuffleMediumKey"]] + ), + outerServerShuffleFunctionMediumKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerServerShuffleFunctionMediumKey"]] + ), + sharedMediumKey=AlphabetKey( + matrix=test_data["persistentKeys"]["sharedMediumKey"] + ), + outerPositionFunctionMediumKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerPositionFunctionMediumKey"]] + ), + outerPositionShuffleMediumKey=OuterShuffleKey( + matrix=[test_data["persistentKeys"]["outerPositionShuffleMediumKey"]] + ), + clientMediumKey=AlphabetKey( + matrix=test_data["persistentKeys"]["clientMediumKey"] + ), + positionFunctionMediumKey=InnerShuffleKey( + matrix=test_data["persistentKeys"]["positionFunctionMediumKey"] + ), + clientShuffleMediumKeyA=InnerShuffleKey( + matrix=test_data["persistentKeys"]["clientShuffleMediumKeyA"] + ) + ) + + ephemeral_keys = EphemeralKeys( + serverEphemeralKey=AlphabetKey( + matrix=test_data["ephemeralKeys"]["serverEphemeralKey"] + ), + sharedEphemeralKey=AlphabetKey( + matrix=test_data["ephemeralKeys"]["sharedEphemeralKey"] + ), + functionEphemeralKey=InnerShuffleKey( + matrix=test_data["ephemeralKeys"]["functionEphemeralKey"] + ), + outerFunctionEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerFunctionEphemeralKey"]] + ), + outerFunctionFunctionEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerFunctionFunctionEphemeralKey"]] + ), + outerServerShuffleFunctionEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerServerShuffleFunctionEphemeralKey"]] + ), + serverShuffleEphemeralKey=InnerShuffleKey( + matrix=test_data["ephemeralKeys"]["serverShuffleEphemeralKey"] + ), + outerServerShuffleEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerServerShuffleEphemeralKey"]] + ), + serverMediumEphemeralKey=AlphabetKey( + matrix=test_data["ephemeralKeys"]["serverMediumEphemeralKey"] + ), + sharedMediumEphemeralKey=AlphabetKey( + matrix=test_data["ephemeralKeys"]["sharedMediumEphemeralKey"] + ), + functionMediumEphemeralKey=InnerShuffleKey( + matrix=test_data["ephemeralKeys"]["functionMediumEphemeralKey"] + ), + positionFunctionMediumEphemeralKey=InnerShuffleKey( + matrix=test_data["ephemeralKeys"]["positionFunctionMediumEphemeralKey"] + ), + outerFunctionMediumEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerFunctionMediumEphemeralKey"]] + ), + outerFunctionFunctionMediumEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerFunctionFunctionMediumEphemeralKey"]] + ), + outerPositionFunctionMediumEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerPositionFunctionMediumEphemeralKey"]] + ), + outerServerShuffleFunctionMediumEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerServerShuffleFunctionMediumEphemeralKey"]] + ), + outerServerShuffleMediumEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerServerShuffleMediumEphemeralKey"]] + ), + outerPositionShuffleMediumEphemeralKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerPositionShuffleMediumEphemeralKey"]] + ), + interfaceConfig=AlphabetKey( + matrix=test_data["ephemeralKeys"]["interfaceConfig"] + ), + outerClientShuffleKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerClientShuffleKey"]] + ), + outerClientShuffleMediumKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerClientShuffleMediumKey"]] + ), + outerClientShuffleFunctionKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerClientShuffleFunctionKey"]] + ), + outerClientShuffleFunctionMediumKey=OuterShuffleKey( + matrix=[test_data["ephemeralKeys"]["outerClientShuffleFunctionMediumKey"]] + ), + clientEphemeral=AlphabetKey( + matrix=test_data["ephemeralKeys"]["clientEphemeral"] + ), + clientEphemeralMedium=AlphabetKey( + matrix=test_data["ephemeralKeys"]["clientEphemeralMedium"] + ), + clientShuffleEphemeralA=InnerShuffleKey( + matrix=test_data["ephemeralKeys"]["clientShuffleEphemeralA"] + ), + clientShuffleEphemeralMediumA=InnerShuffleKey( + matrix=test_data["ephemeralKeys"]["clientShuffleEphemeralMediumA"] + ) + ) + return persistent_keys, ephemeral_keys + + +def test1(): + with open("../darc.json", 'r') as fp: + darc = json.load(fp) + + serverEphemeralKey = AlphabetKey(matrix=darc["serverEphemeralKey"]) + serverKey = AlphabetKey(matrix=darc["serverKey"]) + + functionEphemeralKey = InnerShuffleKey(matrix=darc["functionEphemeralKey"]) + functionKey = InnerShuffleKey(matrix=darc["functionKey"]) + + outerFunctionEphemeralKey = OuterShuffleKey(matrix=[darc["outerFunctionEphemeralKey"]]) + outerFunctionFunctionEphemeralKey = OuterShuffleKey(matrix=[darc["outerFunctionFunctionEphemeralKey"]]) + outerFunctionFunctionKey = OuterShuffleKey(matrix=[darc["outerFunctionFunctionKey"]]) + + outerServerShuffleEphemeralKey = OuterShuffleKey(matrix=[darc["outerServerShuffleEphemeralKey"]]) + outerServerShuffleKey = OuterShuffleKey(matrix=[darc["outerServerShuffleKey"]]) + interfaceConfig = AlphabetKey(matrix=darc["interfaceConfig"]) + + outerFunctionFunctionKeyApplied = outerFunctionFunctionKey << outerFunctionFunctionEphemeralKey + outerFunctionKeyApplied = outerFunctionFunctionKey << outerFunctionEphemeralKey + functionKeyApplied = functionKey << functionEphemeralKey + outerServerShuffleKeyApplied = outerServerShuffleKey << outerServerShuffleEphemeralKey + inputData = interfaceConfig < outerServerShuffleKeyApplied + + serverKeyShuffled = serverKey < outerFunctionKeyApplied + serverEphemeralKeyShuffled = serverEphemeralKey < outerFunctionKeyApplied + functionEphemeralKeyAppliedShuffled = functionKeyApplied < outerFunctionFunctionKeyApplied + incoming = ((inputData ^ (serverKeyShuffled << functionEphemeralKeyAppliedShuffled)) ^ + (serverEphemeralKeyShuffled << functionEphemeralKeyAppliedShuffled)) + + +def translate(outerFunctionFunction: DarcKey, innerFunction: DarcKey, outerFunction: DarcKey, inputData: DarcKey, repeatKeys: list[DarcKey]): + innerFunctionShuffled = innerFunction < outerFunctionFunction + repeatKeysShuffled = [(darc_key < outerFunction) << innerFunctionShuffled for darc_key in repeatKeys] + result = inputData + for darc_key in repeatKeysShuffled: + result = result ^ darc_key + return result + + +def compute_incoming(persistent_keys, ephemeral_keys): + functionEphemeralKeyApplied = persistent_keys.functionKey << ephemeral_keys.functionEphemeralKey + outerFunctionEphemeralKeyApplied = persistent_keys.outerFunctionKey << ephemeral_keys.outerFunctionEphemeralKey + outerFunctionFunctionEphemeralKeyApplied = persistent_keys.outerFunctionFunctionKey << ephemeral_keys.outerFunctionFunctionEphemeralKey + outerServerShuffleEphemeralKeyApplied = persistent_keys.outerServerShuffleKey << ephemeral_keys.outerServerShuffleEphemeralKey + outerServerShuffleFunctionEphemeralKeyApplied = persistent_keys.outerServerShuffleFunctionKey << ephemeral_keys.outerServerShuffleFunctionEphemeralKey + inputData = ephemeral_keys.interfaceConfig < outerServerShuffleEphemeralKeyApplied + serverShuffleEphemeralKeyApplied = ephemeral_keys.serverShuffleEphemeralKey << persistent_keys.serverShuffleKey + serverShuffleEphemeralKeyApplied = serverShuffleEphemeralKeyApplied < outerServerShuffleFunctionEphemeralKeyApplied + inputData = inputData << serverShuffleEphemeralKeyApplied + + incoming = translate(outerFunctionFunctionEphemeralKeyApplied, functionEphemeralKeyApplied, outerFunctionEphemeralKeyApplied, inputData, [persistent_keys.serverKey, ephemeral_keys.serverEphemeralKey]) + return incoming + + +def compute_medium_temp(persistent_keys, ephemeral_keys): + + functionMediumKey = persistent_keys.functionMediumKey + inputMediumData = persistent_keys.inputMediumData + outerFunctionMediumKey = persistent_keys.outerFunctionMediumKey + outerFunctionFunctionMediumKey = persistent_keys.outerFunctionFunctionMediumKey + functionEphemeralKeyApplied = functionMediumKey << ephemeral_keys.functionMediumEphemeralKey + outerFunctionEphemeralKeyApplied = outerFunctionMediumKey << ephemeral_keys.outerFunctionMediumEphemeralKey + outerFunctionFunctionEphemeralKeyApplied = outerFunctionFunctionMediumKey << ephemeral_keys.outerFunctionFunctionMediumEphemeralKey + mediumTemp = translate(outerFunctionFunctionEphemeralKeyApplied, functionEphemeralKeyApplied, outerFunctionEphemeralKeyApplied, inputMediumData, [ephemeral_keys.serverMediumEphemeralKey]) + return mediumTemp + +def medium_translation(persistent_keys: PersistentKeys, ephemeral_keys: EphemeralKeys, mediumTemp: DarcKey): + + clientKey = persistent_keys.clientMediumKey + sharedKey = persistent_keys.sharedMediumKey + functionKey = persistent_keys.functionMediumKey + outerFunctionFunctionKey = persistent_keys.outerFunctionFunctionMediumKey + outerFunctionKey = persistent_keys.outerFunctionMediumKey + outerServerShuffleFunctionKey = persistent_keys.outerServerShuffleFunctionMediumKey + clientShuffleKeyA = persistent_keys.clientShuffleMediumKeyA + outerClientShuffleKey = ephemeral_keys.outerClientShuffleMediumKey + outerClientShuffleFunctionKey = ephemeral_keys.outerClientShuffleFunctionMediumKey + clientEphemeral = ephemeral_keys.clientEphemeralMedium + clientShuffleEphemeralA = ephemeral_keys.clientShuffleEphemeralMediumA + + outerFunctionFunctionEphemeral = ephemeral_keys.outerFunctionFunctionMediumEphemeralKey + functionEphemeral = ephemeral_keys.functionMediumEphemeralKey + outerFunctionEphemeral = ephemeral_keys.outerFunctionMediumEphemeralKey + outerServerShuffleFunctionEphemeral = ephemeral_keys.outerServerShuffleFunctionMediumEphemeralKey + appliedOuterServerShuffleFunctionKey = outerServerShuffleFunctionKey << outerServerShuffleFunctionEphemeral + functionSalt = functionKey << functionEphemeral + appliedClientShuffleKeyA = clientShuffleKeyA << clientShuffleEphemeralA + appliedOuterFunctionKey = outerFunctionKey << outerFunctionEphemeral + appliedOuterFunctionFunctionKey = outerFunctionFunctionKey << outerFunctionFunctionEphemeral + valuesArray = mediumTemp + + preResult = translate(appliedOuterFunctionFunctionKey, functionSalt, appliedOuterFunctionKey, valuesArray, [clientEphemeral, clientKey, sharedKey]) + + result = preResult << (appliedClientShuffleKeyA < appliedOuterServerShuffleFunctionKey) + outerClientShuffleKeyShuffled = outerClientShuffleKey << outerClientShuffleFunctionKey + result = result < outerClientShuffleKeyShuffled + return result + + +def phase1(persistent_keys: PersistentKeys, ephemeral_keys: EphemeralKeys) -> Phase1Session: + incoming = compute_incoming(persistent_keys, ephemeral_keys) + mediumTemp = compute_medium_temp(persistent_keys, ephemeral_keys) + medium_translated = medium_translation(persistent_keys, ephemeral_keys, mediumTemp) + + session = Session( + guid="", + interfaceConfig=ephemeral_keys.interfaceConfig, + serverEphemeralKey=ephemeral_keys.serverEphemeralKey, + functionEphemeralKey=ephemeral_keys.functionEphemeralKey, + serverShuffleEphemeralKey=ephemeral_keys.serverShuffleEphemeralKey, + outerServerShuffleEphemeralKey=ephemeral_keys.outerServerShuffleEphemeralKey, + outerFunctionEphemeralKey=ephemeral_keys.outerFunctionEphemeralKey, + outerFunctionFunctionEphemeralKey=ephemeral_keys.outerFunctionFunctionEphemeralKey, + outerServerShuffleFunctionEphemeralKey=ephemeral_keys.outerServerShuffleFunctionEphemeralKey, + serverMediumEphemeralKey=ephemeral_keys.serverMediumEphemeralKey, + functionMediumEphemeralKey=ephemeral_keys.functionMediumEphemeralKey, + outerServerShuffleMediumEphemeralKey=ephemeral_keys.outerServerShuffleMediumEphemeralKey, + outerFunctionMediumEphemeralKey=ephemeral_keys.outerFunctionMediumEphemeralKey, + outerFunctionFunctionMediumEphemeralKey=ephemeral_keys.outerFunctionFunctionMediumEphemeralKey, + outerServerShuffleFunctionMediumEphemeralKey=ephemeral_keys.outerServerShuffleFunctionMediumEphemeralKey, + positionFunctionMediumEphemeralKey=ephemeral_keys.positionFunctionMediumEphemeralKey, + outerPositionFunctionMediumEphemeralKey=ephemeral_keys.outerPositionFunctionMediumEphemeralKey, + sharedEphemeralKey=ephemeral_keys.sharedEphemeralKey, + sharedMediumEphemeralKey=ephemeral_keys.sharedMediumEphemeralKey, + outerPositionShuffleMediumEphemeralKey=ephemeral_keys.outerPositionShuffleMediumEphemeralKey + ) + + txData = TxData( + data=incoming, + functionEphemeralKey=ephemeral_keys.functionEphemeralKey, + outerServerShuffleEphemeralKey=ephemeral_keys.outerServerShuffleEphemeralKey, + outerFunctionFunctionEphemeralKey=ephemeral_keys.outerFunctionFunctionEphemeralKey, + outerFunctionEphemeralKey=ephemeral_keys.outerFunctionEphemeralKey, + outerServerShuffleFunctionEphemeralKey=ephemeral_keys.outerServerShuffleFunctionEphemeralKey, + sharedEphemeralKey=ephemeral_keys.sharedEphemeralKey, + outerClientShuffleKey=ephemeral_keys.outerClientShuffleKey, + outerClientShuffleFunctionKey=ephemeral_keys.outerClientShuffleFunctionKey, + clientEphemeral=ephemeral_keys.clientEphemeral, + clientShuffleEphemeralA=ephemeral_keys.clientShuffleEphemeralA, + clientShuffleEphemeralB=~ephemeral_keys.clientShuffleEphemeralA + ) + + medium = Medium( + data=medium_translated, + functionEphemeralKey=ephemeral_keys.functionMediumEphemeralKey, + outerServerShuffleEphemeralKey=ephemeral_keys.outerServerShuffleMediumEphemeralKey, + outerFunctionFunctionEphemeralKey=ephemeral_keys.outerFunctionFunctionMediumEphemeralKey, + outerFunctionEphemeralKey=ephemeral_keys.outerFunctionMediumEphemeralKey, + outerServerShuffleFunctionEphemeralKey=ephemeral_keys.outerServerShuffleFunctionMediumEphemeralKey, + sharedEphemeralKey=ephemeral_keys.sharedMediumEphemeralKey, + positionFunctionMediumEphemeralKey=ephemeral_keys.positionFunctionMediumEphemeralKey, + outerPositionFunctionMediumEphemeralKey=ephemeral_keys.outerPositionFunctionMediumEphemeralKey, + outerPositionShuffleMediumEphemeralKey=ephemeral_keys.outerPositionShuffleMediumEphemeralKey, + outerClientShuffleMediumKey=ephemeral_keys.outerClientShuffleMediumKey, + outerClientShuffleFunctionMediumKey=ephemeral_keys.outerClientShuffleFunctionMediumKey, + clientEphemeralMedium=ephemeral_keys.clientEphemeralMedium, + clientShuffleEphemeralMediumA=ephemeral_keys.clientShuffleEphemeralMediumA, + clientShuffleEphemeralMediumB=~ephemeral_keys.clientShuffleEphemeralMediumA + ) + return Phase1Session(session=session, tx_data=txData, medium=medium) + + +def encrypted_alphabet(persistent_keys: PersistentKeys, txdata: TxData) -> AlphabetKey: + """ generateDataTranslationFixedKeys = function (persistantKeys, inputData) """ + appliedOuterServerShuffleFunctionKey = persistent_keys.outerServerShuffleFunctionKey << txdata.outerServerShuffleFunctionEphemeralKey + functionSalt = persistent_keys.functionKey << txdata.functionEphemeralKey + appliedClientShuffleKeyA = persistent_keys.clientShuffleKeyA << txdata.clientShuffleEphemeralA + appliedOuterFunctionKey = persistent_keys.outerFunctionKey << txdata.outerFunctionEphemeralKey + appliedOuterFunctionFunctionKey = persistent_keys.outerFunctionFunctionKey << txdata.outerFunctionFunctionEphemeralKey + appliedClientShuffleKeyAShuffled = appliedClientShuffleKeyA < appliedOuterServerShuffleFunctionKey + outerClientShuffleKeyShuffled = txdata.outerClientShuffleKey << txdata.outerClientShuffleFunctionKey + result = translate(appliedOuterFunctionFunctionKey, functionSalt, appliedOuterFunctionKey, txdata.data, [txdata.clientEphemeral, persistent_keys.clientKey, persistent_keys.sharedKey]) + result = result << appliedClientShuffleKeyAShuffled + result = result < outerClientShuffleKeyShuffled + return result + + +def compute_outgoing(persistent_keys: PersistentKeys, txdata: TxData, message: str, session: Session) -> AlphabetKey: + pass + + +if __name__ == "__main__": + persistent_keys, ephemeral_keys = get_test_keys() + + phase1_output = phase1(persistent_keys, ephemeral_keys) + alphabet = encrypted_alphabet(persistent_keys, phase1_output.tx_data) + diff --git a/src/mimick_csharp_test.py b/src/mimick_csharp_test.py new file mode 100644 index 0000000..d73690b --- /dev/null +++ b/src/mimick_csharp_test.py @@ -0,0 +1,389 @@ +from src.models import ServerEphemeralKeys, ServerPersistentKeys, ClientEphemeralKeys, ClientPersistentKeys, \ + MutualEphemeralKeys, AlphabetKey, DarcKey, OuterShuffleKey +import json + +height = 10 +width = 7 +block_size = 10 + + +def translate_data(server_persistent_keys: ServerPersistentKeys, server_ephemeral_keys: ServerEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + function_ephemeral_key_applied = server_persistent_keys.FunctionKey << mutual_ephemeral_keys.FunctionEphemeralKey + outer_function_ephemeral_key_applied = server_persistent_keys.OuterFunctionKey << mutual_ephemeral_keys.OuterFunctionEphemeralKey + outer_function_function_ephemeral_key_applied = server_persistent_keys.OuterFunctionFunctionKey << mutual_ephemeral_keys.OuterFunctionFunctionEphemeralKey + outer_server_shuffle_ephemeral_key_applied = server_persistent_keys.OuterServerShuffleKey << server_ephemeral_keys.OuterServerShuffleEphemeralKey + outer_server_shuffle_function_ephemeral_key_applied = server_persistent_keys.OuterServerShuffleFunctionKey << mutual_ephemeral_keys.OuterServerShuffleFunctionEphemeralKey + input_data = server_ephemeral_keys.Alphabet < outer_server_shuffle_ephemeral_key_applied + server_shuffle_ephemeral_key_applied = server_ephemeral_keys.ServerShuffleEphemeralKey << server_persistent_keys.ServerShuffleKey # TODO: should this be the other way around? + server_shuffle_ephemeral_key_applied = server_shuffle_ephemeral_key_applied < outer_server_shuffle_function_ephemeral_key_applied + input_data = input_data << server_shuffle_ephemeral_key_applied + + # substitute_function_operands + outer_function_function = outer_function_function_ephemeral_key_applied + inner_function = function_ephemeral_key_applied + outer_function = outer_function_ephemeral_key_applied + operand = input_data + operand1 = server_persistent_keys.ServerKey < outer_function + operand2 = server_ephemeral_keys.ServerEphemeralKey < outer_function + + inner_function_shuffled = inner_function < outer_function_function + operand = operand ^ (operand1 << inner_function_shuffled) ^ (operand2 << inner_function_shuffled) + return operand + +def translate_medium(server_persistent_keys: ServerPersistentKeys, server_ephemeral_keys: ServerEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + + function_ephemeral_key_applied = server_persistent_keys.FunctionMediumKey << mutual_ephemeral_keys.FunctionMediumEphemeralKey + outer_function_ephemeral_key_applied = server_persistent_keys.OuterFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionMediumEphemeralKey + outer_function_function_ephemeral_key_applied = server_persistent_keys.OuterFunctionFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionFunctionMediumEphemeralKey + + input_data = AlphabetKey(matrix=[[0 for _ in range(width)] for _ in range(height)]) + + # substitute_function_operands + outer_function_function = outer_function_function_ephemeral_key_applied + inner_function = function_ephemeral_key_applied + outer_function = outer_function_ephemeral_key_applied + operand = input_data + operand1 = server_persistent_keys.ServerMediumKey < outer_function + operand2 = server_ephemeral_keys.ServerMediumEphemeralKey < outer_function + + inner_function_shuffled = inner_function < outer_function_function + operand = operand ^ (operand1 << inner_function_shuffled) ^ (operand2 << inner_function_shuffled) + return operand + + +def darc_phase1(server_persistent_keys: ServerPersistentKeys, server_ephemeral_keys: ServerEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + alphabet = translate_data(server_persistent_keys, server_ephemeral_keys, mutual_ephemeral_keys) + medium = translate_medium(server_persistent_keys, server_ephemeral_keys, mutual_ephemeral_keys) + return alphabet, medium + + +def receive_alphabet(alphabet: DarcKey, client_persistent_keys: ClientPersistentKeys, client_ephemeral_keys: ClientEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + function_key_applied = client_persistent_keys.FunctionKey << mutual_ephemeral_keys.FunctionEphemeralKey + outer_function_key_applied = client_persistent_keys.OuterFunctionKey << mutual_ephemeral_keys.OuterFunctionEphemeralKey + outer_function_function_key_applied = client_persistent_keys.OuterFunctionFunctionKey << mutual_ephemeral_keys.OuterFunctionFunctionEphemeralKey + + inner_function_key_applied = function_key_applied < outer_function_function_key_applied + operand = alphabet + operand1 = client_ephemeral_keys.ClientEphemeralKey < outer_function_key_applied + operand2 = client_persistent_keys.ClientKey < outer_function_key_applied + operand3 = client_persistent_keys.MutualKey < outer_function_key_applied + + result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied) + + outer_server_shuffle_function_key_applied = client_persistent_keys.OuterServerShuffleFunctionKey << mutual_ephemeral_keys.OuterServerShuffleFunctionEphemeralKey + client_shuffle_key_a_applied = client_persistent_keys.ClientShuffleKeyA << client_ephemeral_keys.ClientShuffleEphemeralKeyA + + result = result << (client_shuffle_key_a_applied < outer_server_shuffle_function_key_applied) + + outer_client_shuffle_key_applied = client_persistent_keys.OuterClientShuffleKey << client_ephemeral_keys.OuterClientShuffleEphemeralKey + outer_client_shuffle_function_key_applied = client_persistent_keys.OuterClientShuffleFunctionKey << client_ephemeral_keys.OuterClientShuffleFunctionEphemeralKey + outer_client_shuffle_key_applied = outer_client_shuffle_key_applied << outer_client_shuffle_function_key_applied + result = result < outer_client_shuffle_key_applied + return result + + +def receive_medium(medium: DarcKey, client_peristent_keys: ClientPersistentKeys, client_ephemeral_keys: ClientEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + function_key_applied = client_peristent_keys.FunctionMediumKey << mutual_ephemeral_keys.FunctionMediumEphemeralKey + outer_function_key_applied = client_peristent_keys.OuterFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionMediumEphemeralKey + outer_function_function_key_applied = client_peristent_keys.OuterFunctionFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionFunctionMediumEphemeralKey + + inner_function_key_applied = function_key_applied < outer_function_function_key_applied + operand = medium + operand1 = client_ephemeral_keys.ClientMediumEphemeralKey < outer_function_key_applied + operand2 = client_peristent_keys.ClientMediumKey < outer_function_key_applied + operand3 = client_peristent_keys.MutualMediumKey < outer_function_key_applied + + result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied) + + client_shuffle_key_a_applied = client_peristent_keys.ClientShuffleMediumKeyA << client_ephemeral_keys.ClientShuffleMediumEphemeralKeyA + outer_server_shuffle_function_key_applied = client_peristent_keys.OuterServerShuffleFunctionMediumKey << mutual_ephemeral_keys.OuterServerShuffleFunctionMediumEphemeralKey + client_shuffle_key_a_applied = client_shuffle_key_a_applied < outer_server_shuffle_function_key_applied + result = result << client_shuffle_key_a_applied + + outer_client_shuffle_key_applied = client_peristent_keys.OuterClientShuffleMediumKey << client_ephemeral_keys.OuterClientShuffleMediumEphemeralKey + outer_client_shuffle_function_key_applied = client_peristent_keys.OuterClientShuffleFunctionMediumKey << client_ephemeral_keys.OuterClientShuffleFunctionMediumEphemeralKey + outer_client_shuffle_key_applied = outer_client_shuffle_key_applied << outer_client_shuffle_function_key_applied + result = result < outer_client_shuffle_key_applied + + return result + + +def darc_phase2(alphabet: DarcKey, medium: DarcKey, client_peristent_keys: ClientPersistentKeys, client_ephemeral_keys: ClientEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + alphabet = receive_alphabet(alphabet, client_peristent_keys, client_ephemeral_keys, mutual_ephemeral_keys) + medium = receive_medium(medium, client_peristent_keys, client_ephemeral_keys, mutual_ephemeral_keys) + return alphabet, medium + + + +def transmit_alphabet(alphabet: DarcKey, client_peristent_keys: ClientPersistentKeys, client_ephemeral_keys: ClientEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + outer_server_shuffle_function_key_applied = client_peristent_keys.OuterServerShuffleFunctionKey << mutual_ephemeral_keys.OuterServerShuffleFunctionEphemeralKey + outer_client_shuffle_key_applied = client_peristent_keys.OuterClientShuffleKey << client_ephemeral_keys.OuterClientShuffleEphemeralKey + outer_client_shuffle_function_key_applied = client_peristent_keys.OuterClientShuffleFunctionKey << client_ephemeral_keys.OuterClientShuffleFunctionEphemeralKey + + input_outer_client_shuffle_key = outer_client_shuffle_key_applied << outer_client_shuffle_function_key_applied + input_outer_server_shuffle_function_key = outer_server_shuffle_function_key_applied << input_outer_client_shuffle_key + outer_function_function_key_applied = client_peristent_keys.OuterFunctionFunctionKey << mutual_ephemeral_keys.OuterFunctionFunctionEphemeralKey + outer_function_function_key_applied = outer_function_function_key_applied << input_outer_client_shuffle_key + + function_key_applied = client_peristent_keys.FunctionKey << mutual_ephemeral_keys.FunctionEphemeralKey + function_key_applied = function_key_applied < outer_function_function_key_applied + + reordered_shuffle_key_x = client_peristent_keys.ClientShuffleKeyX < input_outer_server_shuffle_function_key + + function_ephemeral_key_applied = function_key_applied << reordered_shuffle_key_x + + client_shuffle_key_b = (~client_persistent_keys.ClientShuffleKeyA) << client_peristent_keys.ClientShuffleKeyX + client_shuffle_ephemeral_key_b = ~client_ephemeral_keys.ClientShuffleEphemeralKeyA + input_client_shuffle_key_b = client_shuffle_ephemeral_key_b << client_shuffle_key_b + input_client_shuffle_key_b = input_client_shuffle_key_b < input_outer_server_shuffle_function_key + shuffled_items = alphabet << input_client_shuffle_key_b + + outer_function_key_applied = client_peristent_keys.OuterFunctionKey << mutual_ephemeral_keys.OuterFunctionEphemeralKey + input_outer_function_key = outer_function_key_applied << input_outer_client_shuffle_key + + inner_function_key_applied = function_ephemeral_key_applied + operand = shuffled_items + operand1 = client_ephemeral_keys.ClientEphemeralKey < input_outer_function_key + operand2 = client_peristent_keys.ClientKey < input_outer_function_key + operand3 = mutual_ephemeral_keys.MutualEphemeralKey < input_outer_function_key + + result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied) + return result + + +def transmit_medium(medium: DarcKey, client_peristent_keys: ClientPersistentKeys, client_ephemeral_keys: ClientEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + client_shuffle_ephemeral_key_b = ~client_ephemeral_keys.ClientShuffleMediumEphemeralKeyA + outer_server_shuffle_function_key_applied = client_peristent_keys.OuterServerShuffleFunctionMediumKey << mutual_ephemeral_keys.OuterServerShuffleFunctionMediumEphemeralKey + outer_client_shuffle_key_applied = client_peristent_keys.OuterClientShuffleMediumKey << client_ephemeral_keys.OuterClientShuffleMediumEphemeralKey + + outer_client_suffle_function_key_applied = client_peristent_keys.OuterClientShuffleFunctionMediumKey << client_ephemeral_keys.OuterClientShuffleFunctionMediumEphemeralKey + input_outer_client_shuffle_key = outer_client_shuffle_key_applied << outer_client_suffle_function_key_applied + input_outer_server_shuffle_function_key = outer_server_shuffle_function_key_applied << input_outer_client_shuffle_key + + outer_function_function_key_applied = client_peristent_keys.OuterFunctionFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionFunctionMediumEphemeralKey + outer_function_function_key_applied = outer_function_function_key_applied << input_outer_client_shuffle_key + + function_key_applied = client_peristent_keys.FunctionMediumKey << mutual_ephemeral_keys.FunctionMediumEphemeralKey + function_key_applied = function_key_applied < outer_function_function_key_applied + + reordered_shuffle_key_x = client_peristent_keys.ClientShuffleMediumKeyX < input_outer_server_shuffle_function_key + + function_ephemeral_key_applied = function_key_applied << reordered_shuffle_key_x + + client_shuffle_key_b = (~client_peristent_keys.ClientShuffleMediumKeyA) << client_peristent_keys.ClientShuffleMediumKeyX + input_client_shuffle_key_b = client_shuffle_ephemeral_key_b << client_shuffle_key_b + input_client_shuffle_key_b = input_client_shuffle_key_b < input_outer_server_shuffle_function_key + shuffled_items = medium << input_client_shuffle_key_b + outer_function_key_applied = client_peristent_keys.OuterFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionMediumEphemeralKey + input_outer_function_key = outer_function_key_applied << input_outer_client_shuffle_key + + inner_function_key_applied = function_ephemeral_key_applied + operand = shuffled_items + operand1 = client_ephemeral_keys.ClientMediumEphemeralKey < input_outer_function_key + operand2 = client_peristent_keys.ClientMediumKey < input_outer_function_key + operand3 = mutual_ephemeral_keys.MutualMediumEphemeralKey < input_outer_function_key + + result = operand ^ (operand1 << inner_function_key_applied) ^ (operand2 << inner_function_key_applied) ^ (operand3 << inner_function_key_applied) + return result + + +def darc_phase3(alphabet: DarcKey, medium: DarcKey, client_peristent_keys: ClientPersistentKeys, client_ephemeral_keys: ClientEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + alphabet = transmit_alphabet(alphabet, client_peristent_keys, client_ephemeral_keys, mutual_ephemeral_keys) + medium = transmit_medium(medium, client_peristent_keys, client_ephemeral_keys, mutual_ephemeral_keys) + return alphabet, medium + +def merge_message(alphabet: DarcKey, medium: DarcKey, client_peristent_keys: ClientPersistentKeys, client_ephemeral_keys: ClientEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys, input_sequence: list[int]): + outer_client_shuffle_alphabet_key_applied = client_peristent_keys.OuterClientShuffleKey << client_ephemeral_keys.OuterClientShuffleEphemeralKey + outer_client_shuffle_function_alphabet_key_applied = client_peristent_keys.OuterClientShuffleFunctionKey << client_ephemeral_keys.OuterClientShuffleFunctionEphemeralKey + outer_client_shuffle_alphabet_key_applied = ~(outer_client_shuffle_alphabet_key_applied << outer_client_shuffle_function_alphabet_key_applied) + + msg_len = len(input_sequence) + eof_arr = AlphabetKey.init_matrix(width, height, 255).matrix[0] + + if msg_len < height: + padded_input_sequence = OuterShuffleKey.init_matrix(height) + padded_input_sequence.matrix = [input_sequence + padded_input_sequence.matrix[0][msg_len:]] + else: + padded_input_sequence = OuterShuffleKey(matrix=[input_sequence]) + + input_sequence_applied = outer_client_shuffle_alphabet_key_applied << padded_input_sequence + + outer_client_shuffle_medium_key_applied = client_peristent_keys.OuterClientShuffleMediumKey << client_ephemeral_keys.OuterClientShuffleMediumEphemeralKey + outer_client_shuffle_function_medium_key_applied = client_peristent_keys.OuterClientShuffleFunctionMediumKey << client_ephemeral_keys.OuterClientShuffleFunctionMediumEphemeralKey + + outer_client_shuffle_medium_key_applied = outer_client_shuffle_medium_key_applied << outer_client_shuffle_function_medium_key_applied + + input_sequence_applied = input_sequence_applied << outer_client_shuffle_medium_key_applied + message = alphabet < input_sequence_applied + + message_pad_key = ~outer_client_shuffle_medium_key_applied + + if msg_len < height: + message.matrix[message_pad_key.matrix[0][msg_len]] = eof_arr + + position_function_key_applied = client_peristent_keys.PositionFunctionMediumKey << mutual_ephemeral_keys.PositionFunctionMediumEphemeralKey + outer_position_function_key_applied = client_peristent_keys.OuterPositionFunctionMediumKey << mutual_ephemeral_keys.OuterPositionFunctionMediumEphemeralKey + outer_position_shuffle_key_applied = client_peristent_keys.OuterPositionShuffleMediumKey << mutual_ephemeral_keys.OuterPositionShuffleMediumEphemeralKey + + outer_position_function_key_applied = outer_position_shuffle_key_applied << outer_position_function_key_applied + + outer_client_shuffle_medium_key_applied = ~outer_client_shuffle_medium_key_applied + outer_position_function_key_applied = ~(outer_client_shuffle_medium_key_applied << outer_position_function_key_applied) + + inner_function_key_applied = position_function_key_applied < outer_position_function_key_applied + + operand = medium + operand1 = message + + message = operand ^ (operand1 << inner_function_key_applied) + + + outer_position_shuffle_function_key_applied = client_peristent_keys.OuterPositionShuffleFunctionMediumKey << mutual_ephemeral_keys.OuterPositionShuffleFunctionMediumEphemeralKey + position_shuffle_key_applied = client_peristent_keys.PositionShuffleMediumKey << mutual_ephemeral_keys.PositionShuffleMediumEphemeralKey + + outer_position_shuffle_key_applied = outer_client_shuffle_medium_key_applied << outer_position_shuffle_key_applied + outer_position_shuffle_function_key_applied = outer_position_shuffle_function_key_applied << outer_position_function_key_applied + + message = message << (position_shuffle_key_applied < outer_position_shuffle_function_key_applied) + message = message < outer_position_shuffle_key_applied + return message + + +def darc_phase_4(darc_message: DarcKey, server_persistent_keys: ServerPersistentKeys, server_ephemeral_keys: ServerEphemeralKeys, mutual_ephemeral_keys: MutualEphemeralKeys): + outer_position_function_ephemeral_key_applied = server_persistent_keys.OuterPositionFunctionMediumKey << mutual_ephemeral_keys.OuterPositionFunctionMediumEphemeralKey + outer_position_shuffle_ephemeral_key_applied = server_persistent_keys.OuterPositionShuffleMediumKey << mutual_ephemeral_keys.OuterPositionShuffleMediumEphemeralKey + + outer_position_function_ephemeral_key_applied = ~(outer_position_shuffle_ephemeral_key_applied << outer_position_function_ephemeral_key_applied) + outer_position_shuffle_ephemeral_key_applied = ~outer_position_shuffle_ephemeral_key_applied + + outer_position_shuffle_function_ephemeral_key_applied = server_persistent_keys.OuterPositionShuffleFunctionMediumKey << mutual_ephemeral_keys.OuterPositionShuffleFunctionMediumEphemeralKey + outer_position_shuffle_function_ephemeral_key_applied = outer_position_shuffle_function_ephemeral_key_applied << outer_position_function_ephemeral_key_applied + + outer_function_function_medium_ephemeral_key_applied = server_persistent_keys.OuterFunctionFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionFunctionMediumEphemeralKey + outer_server_shuffle_function_ephemeral_key_applied = server_persistent_keys.OuterServerShuffleFunctionKey << mutual_ephemeral_keys.OuterServerShuffleFunctionEphemeralKey + + outer_server_shuffle_function_medium_ephemeral_key_applied = server_persistent_keys.OuterServerShuffleFunctionMediumKey << mutual_ephemeral_keys.OuterServerShuffleFunctionMediumEphemeralKey + + function_medium_ephemeral_key_applied = server_persistent_keys.FunctionMediumKey << mutual_ephemeral_keys.FunctionMediumEphemeralKey + + client_shuffle_medium_key_x = server_persistent_keys.ClientShuffleMediumKeyX < outer_server_shuffle_function_medium_ephemeral_key_applied + client_shuffle_medium_key_x = (function_medium_ephemeral_key_applied < outer_function_function_medium_ephemeral_key_applied) << client_shuffle_medium_key_x + + position_shuffle_ephemeral_key_applied = server_persistent_keys.PositionShuffleMediumKey << mutual_ephemeral_keys.PositionShuffleMediumEphemeralKey + + position_shuffle_ephemeral_key_applied = position_shuffle_ephemeral_key_applied < outer_position_shuffle_function_ephemeral_key_applied + client_shuffle_medium_key_x = client_shuffle_medium_key_x << position_shuffle_ephemeral_key_applied + + + outer_function_medium_ephemeral_key_applied = server_persistent_keys.OuterFunctionMediumKey << mutual_ephemeral_keys.OuterFunctionMediumEphemeralKey + + rx_data = darc_message < outer_position_shuffle_ephemeral_key_applied + + inner_key = client_shuffle_medium_key_x + operand = rx_data + operand1 = server_persistent_keys.ServerMediumKey < outer_function_medium_ephemeral_key_applied + operand2 = server_ephemeral_keys.ServerMediumEphemeralKey < outer_function_medium_ephemeral_key_applied + operand3 = server_persistent_keys.MutualMediumKey < outer_function_medium_ephemeral_key_applied + operand4 = mutual_ephemeral_keys.MutualMediumEphemeralKey < outer_function_medium_ephemeral_key_applied + + rx_data = operand ^ (operand1 << inner_key) ^ (operand2 << inner_key) ^ (operand3 << inner_key) ^ (operand4 << inner_key) + + + """ + + FunctionTranslation PositionFunctionKey = ServerPersistentKeys.PositionFunctionMediumKey; + FunctionTranslation PositionFunctionEphemeralKey = MutualEphemeralKeys.PositionFunctionMediumEphemeralKey; + FunctionTranslation PositionFunctionEphemeralKeyApplied = new FunctionTranslation { Data = Transform.TransformationCompliment(Transform.PermuteInnerTransformation(PositionFunctionKey.Data, PositionFunctionEphemeralKey.Data)) }; + + + #region Inner Shuffle + + RxData = Transform.PermuteInnerTransformation( + RxData.Convert(), + Transform.PermuteInnerTransformation( + Transform.TransformationCompliment( + PositionShuffleEphemeralKeyApplied.Data + ), + Transform.PermuteOuterTransformation( + PositionFunctionEphemeralKeyApplied.Data.Convert(), + OuterPositionFunctionEphemeralKeyApplied.Data).Convert())).Convert(); + """ + position_function_ephemeral_key_applied = server_persistent_keys.PositionFunctionMediumKey << mutual_ephemeral_keys.PositionFunctionMediumEphemeralKey + rx_data = rx_data << (~(position_shuffle_ephemeral_key_applied) << (~position_function_ephemeral_key_applied < outer_position_function_ephemeral_key_applied)) + + client_shuffle_key_x = server_persistent_keys.ClientShuffleKeyX < outer_server_shuffle_function_ephemeral_key_applied + outer_function_function_ephemeral_key_applied = server_persistent_keys.OuterFunctionFunctionKey << mutual_ephemeral_keys.OuterFunctionFunctionEphemeralKey + + function_ephemeral_key_applied = server_persistent_keys.FunctionKey << mutual_ephemeral_keys.FunctionEphemeralKey + function_ephemeral_key_applied = (function_ephemeral_key_applied < outer_function_function_ephemeral_key_applied) << client_shuffle_key_x + server_shuffle_ephemeral_key_applied = ~(server_persistent_keys.ServerShuffleKey << server_persistent_keys.ClientShuffleKeyX) << ~(server_ephemeral_keys.ServerShuffleEphemeralKey) + server_shuffle_ephemeral_key_applied = ~(server_shuffle_ephemeral_key_applied < outer_server_shuffle_function_ephemeral_key_applied) + + outer_server_shuffle_ephemeral_key_applied = server_persistent_keys.OuterServerShuffleKey << server_ephemeral_keys.OuterServerShuffleEphemeralKey + alphabet = server_ephemeral_keys.Alphabet + alpha_prep = (alphabet < outer_server_shuffle_ephemeral_key_applied) << server_shuffle_ephemeral_key_applied + + outer_function_ephemeral_key_applied = server_persistent_keys.OuterFunctionKey << mutual_ephemeral_keys.OuterFunctionEphemeralKey + + inner_key = function_ephemeral_key_applied + operand = alpha_prep + operand1 = server_persistent_keys.ServerKey < outer_function_ephemeral_key_applied + operand2 = server_ephemeral_keys.ServerEphemeralKey < outer_function_ephemeral_key_applied + operand3 = server_persistent_keys.MutualKey < outer_function_ephemeral_key_applied + operand4 = mutual_ephemeral_keys.MutualEphemeralKey < outer_function_ephemeral_key_applied + alpha_prep = operand ^ (operand1 << inner_key) ^ (operand2 << inner_key) ^ (operand3 << inner_key) ^ (operand4 << inner_key) + + return resolve_message(alpha_prep.matrix, rx_data.matrix) + + +def resolve_message(translated_alphabet, translated_messasge): + alphabet_map = {str(key): idx for idx, key in enumerate(translated_alphabet)} + encoded_message = [str(alpha) for alpha in translated_messasge] + + message = [] + for alpha in encoded_message: + if alpha in alphabet_map.keys(): + message.append(alphabet_map[alpha]) + else: + break + return message + +if __name__ == "__main__": + with open("../darc_key_json/client_persistent_keys.json") as fp: + client_persistent_keys = json.load(fp) + + with open("../darc_key_json/client_ephemeral_keys.json") as fp: + client_ephemeral_keys = json.load(fp) + + with open("../darc_key_json/server_persistent_keys.json") as fp: + server_persistent_keys = json.load(fp) + + with open("../darc_key_json/server_ephemeral_keys.json") as fp: + server_ephemeral_keys = json.load(fp) + + with open("../darc_key_json/mutual_ephemeral_keys.json") as fp: + mutual_ephemeral_keys = json.load(fp) + + client_persistent_keys = {k: {"matrix": v} for k, v in client_persistent_keys.items()} + client_ephemeral_keys = {k: {"matrix": v} for k, v in client_ephemeral_keys.items()} + server_persistent_keys = {k: {"matrix": v} for k, v in server_persistent_keys.items()} + server_ephemeral_keys = {k: {"matrix": v} for k, v in server_ephemeral_keys.items()} + mutual_ephemeral_keys = {k: {"matrix": v} for k, v in mutual_ephemeral_keys.items()} + + client_persistent_keys = ClientPersistentKeys(**client_persistent_keys) + client_ephemeral_keys = ClientEphemeralKeys(**client_ephemeral_keys) + server_persistent_keys = ServerPersistentKeys(**server_persistent_keys) + server_ephemeral_keys = ServerEphemeralKeys(**server_ephemeral_keys) + mutual_ephemeral_keys = MutualEphemeralKeys(**mutual_ephemeral_keys) + + (phase1_alphabet, phase1_medium) = darc_phase1(server_persistent_keys, server_ephemeral_keys, mutual_ephemeral_keys) + (phase2_alphabet, phase2_medium) = darc_phase2(phase1_alphabet, phase1_medium, client_persistent_keys, client_ephemeral_keys, mutual_ephemeral_keys) + (phase3_alphabet, phase3_medium) = darc_phase3(phase2_alphabet, phase2_medium, client_persistent_keys, client_ephemeral_keys, mutual_ephemeral_keys) +# original_message = [0, 2, 4, 6, 0, 5, 9, 9, 1, 7] + + original_message = [0, 2, 4, 6] + darc_message = merge_message(phase3_alphabet, phase3_medium, client_persistent_keys, client_ephemeral_keys, mutual_ephemeral_keys, original_message) + + message = darc_phase_4(darc_message, server_persistent_keys, server_ephemeral_keys, mutual_ephemeral_keys) + print(original_message) + print(message) diff --git a/src/mimick_excel.py b/src/mimick_excel.py new file mode 100644 index 0000000..f495d32 --- /dev/null +++ b/src/mimick_excel.py @@ -0,0 +1,1030 @@ +from src.models import DarcKey, DarcKeyTypes + +if __name__ == "__main__": + height = 10 + width = 7 + + + """ + Alphabet Values 10 28 38 41 51 64 70 15 25 33 48 56 69 71 13 22 36 47 54 60 72 12 24 31 43 58 63 73 11 21 39 49 53 65 74 18 20 32 45 52 61 75 14 29 37 44 57 68 76 19 23 34 40 59 62 77 17 27 35 42 55 67 78 16 26 30 46 50 66 79 + """ + # Alphabet Values + alphabet_values = DarcKey(matrix=[ + ['10', '28', '38', '41', '51', '64', '70'], + ['15', '25', '33', '48', '56', '69', '71'], + ['13', '22', '36', '47', '54', '60', '72'], + ['12', '24', '31', '43', '58', '63', '73'], + ['11', '21', '39', '49', '53', '65', '74'], + ['18', '20', '32', '45', '52', '61', '75'], + ['14', '29', '37', '44', '57', '68', '76'], + ['19', '23', '34', '40', '59', '62', '77'], + ['17', '27', '35', '42', '55', '67', '78'], + ['16', '26', '30', '46', '50', '66', '79'] + ], key_type=DarcKeyTypes.alphabet) + + """ Persistent Keys Generation """ + """ + Outer (Mutual) (Substitution) Function Key 9 7 4 2 5 3 0 6 1 8 + Outer (Mutual) (Substitution) Function Function Key 8 1 4 5 2 3 7 6 0 9 + Outer Server (Mutual) Shuffle (Permutation) Function Key 3 9 2 5 0 7 6 8 1 4 + Outer Client Shuffle (Permutation) Key 6 4 7 8 0 2 1 9 5 3 + Outer Client Shuffle (Permutation) Function Key 4 2 1 0 5 7 8 9 3 6 + Outer Server Shuffle (Permutation) Key 4 9 6 0 7 5 3 1 2 8 + """ + # Outer (Mutual) (Substitution) Function Key + outer_mutual_substitution_function_key = DarcKey(matrix=[['9', '7', '4', '2', '5', '3', '0', '6', '1', '8']], key_type=DarcKeyTypes.outer_shuffle) + # Outer (Mutual) (Substitution) Function Function Key + outer_mutual_substitution_function_function_key = DarcKey(matrix=[['8', '1', '4', '5', '2', '3', '7', '6', '0', '9']], key_type=DarcKeyTypes.outer_shuffle) + # Outer Server (Mutual) Shuffle (Permutation) Function Key + outer_mutual_shuffle_permutation_function_key = DarcKey(matrix=[['3', '9', '2', '5', '0', '7', '6', '8', '1', '4']], key_type=DarcKeyTypes.outer_shuffle) + # Outer Client Shuffle (Permutation) Key + outer_client_shuffle_permutation_key = DarcKey(matrix=[['6', '4', '7', '8', '0', '2', '1', '9', '5', '3']], key_type=DarcKeyTypes.outer_shuffle) + # Outer Client Shuffle (Permutation) Function Key + outer_client_shuffle_permutation_function_key = DarcKey(matrix=[['4', '2', '1', '0', '5', '7', '8', '9', '3', '6']], key_type=DarcKeyTypes.outer_shuffle) + # Outer Server Shuffle (Permutation) Key + outer_server_shuffle_permutation_key = DarcKey(matrix=[['4', '9', '6', '0', '7', '5', '3', '1', '2', '8']], key_type=DarcKeyTypes.outer_shuffle) + + """ + (Mutual) (Substitution) Function Key 1 5 0 2 3 6 4 5 2 6 4 1 3 0 4 2 3 5 6 1 0 0 3 1 6 5 2 4 4 1 3 0 6 5 2 6 3 4 2 5 1 0 2 3 0 4 1 6 5 4 0 6 5 2 3 1 3 2 4 1 0 5 6 2 3 4 1 5 0 6 + Client Shuffle (Permutation) Key X 6 3 1 4 5 0 2 6 5 0 2 3 4 1 1 4 0 6 3 2 5 6 1 4 5 3 2 0 2 0 1 4 3 5 6 3 0 6 2 1 4 5 3 2 0 1 6 4 5 6 2 3 0 1 5 4 3 0 6 5 4 1 2 3 2 5 0 4 1 6 + Client Shuffle (Permutation) Key A (remove A) 6 0 3 5 2 1 4 4 3 2 5 0 1 6 5 4 1 0 2 3 6 3 6 1 4 5 2 0 3 5 4 2 0 1 6 6 1 5 4 2 3 0 0 4 6 3 5 1 2 0 6 4 3 1 2 5 5 0 6 3 4 1 2 3 2 0 4 1 6 5 + Server Shuffle (Permutation) Key 5 2 3 0 6 4 1 5 2 6 3 0 1 4 1 3 5 0 2 6 4 6 2 1 4 5 0 3 2 3 4 1 5 6 0 3 2 0 1 5 4 6 2 6 0 3 4 1 5 3 0 4 6 2 5 1 5 3 2 0 6 4 1 1 4 5 3 2 6 0 + """ + # (Mutual) (Substitution) Function Key + mutual_substitution_function_key = DarcKey(matrix=[ + ['1', '5', '0', '2', '3', '6', '4'], + ['5', '2', '6', '4', '1', '3', '0'], + ['4', '2', '3', '5', '6', '1', '0'], + ['0', '3', '1', '6', '5', '2', '4'], + ['4', '1', '3', '0', '6', '5', '2'], + ['6', '3', '4', '2', '5', '1', '0'], + ['2', '3', '0', '4', '1', '6', '5'], + ['4', '0', '6', '5', '2', '3', '1'], + ['3', '2', '4', '1', '0', '5', '6'], + ['2', '3', '4', '1', '5', '0', '6'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # Client Shuffle (Permutation) Key X + client_shuffle_permutation_key_x = DarcKey(matrix=[ + ['6', '3', '1', '4', '5', '0', '2'], + ['6', '5', '0', '2', '3', '4', '1'], + ['1', '4', '0', '6', '3', '2', '5'], + ['6', '1', '4', '5', '3', '2', '0'], + ['2', '0', '1', '4', '3', '5', '6'], + ['3', '0', '6', '2', '1', '4', '5'], + ['3', '2', '0', '1', '6', '4', '5'], + ['6', '2', '3', '0', '1', '5', '4'], + ['3', '0', '6', '5', '4', '1', '2'], + ['3', '2', '5', '0', '4', '1', '6'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # Client Shuffle (Permutation) Key A (remove A) + client_shuffle_permutation_key_a = DarcKey(matrix=[ + ['6', '0', '3', '5', '2', '1', '4'], + ['4', '3', '2', '5', '0', '1', '6'], + ['5', '4', '1', '0', '2', '3', '6'], + ['3', '6', '1', '4', '5', '2', '0'], + ['3', '5', '4', '2', '0', '1', '6'], + ['6', '1', '5', '4', '2', '3', '0'], + ['0', '4', '6', '3', '5', '1', '2'], + ['0', '6', '4', '3', '1', '2', '5'], + ['5', '0', '6', '3', '4', '1', '2'], + ['3', '2', '0', '4', '1', '6', '5'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # Server Shuffle (Permutation) Key + server_shuffle_permutation_key = DarcKey(matrix=[ + ['5', '2', '3', '0', '6', '4', '1'], + ['5', '2', '6', '3', '0', '1', '4'], + ['1', '3', '5', '0', '2', '6', '4'], + ['6', '2', '1', '4', '5', '0', '3'], + ['2', '3', '4', '1', '5', '6', '0'], + ['3', '2', '0', '1', '5', '4', '6'], + ['2', '6', '0', '3', '4', '1', '5'], + ['3', '0', '4', '6', '2', '5', '1'], + ['5', '3', '2', '0', '6', '4', '1'], + ['1', '4', '5', '3', '2', '6', '0'] + ], key_type=DarcKeyTypes.inner_shuffle) + + """ + Shared (Mutual) (Substitution) Component 1 81 150 209 32 246 219 15 100 15 50 179 52 1 142 98 34 170 6 195 115 117 205 169 12 151 139 91 114 192 153 175 62 249 230 103 56 54 44 107 125 122 219 28 16 32 27 95 248 200 152 121 40 198 19 55 59 189 227 175 102 171 135 170 182 144 202 64 253 89 196 + Shared (Mutual) (Substitution) Component 2 48 87 34 220 7 126 227 92 232 22 55 20 202 27 53 121 169 82 73 194 136 66 190 253 113 231 210 137 189 76 54 114 39 144 74 71 47 179 12 209 213 187 110 46 81 150 252 48 79 50 166 60 45 116 88 123 167 175 228 65 204 171 186 56 140 58 124 85 95 199 + Shared (Mutual) (Substitution) Component 3 102 134 242 33 236 198 117 64 217 214 101 254 216 28 63 6 193 57 57 149 219 46 206 213 239 207 23 188 146 185 119 73 126 123 248 96 61 106 92 239 209 167 150 168 220 110 162 117 247 175 141 235 39 117 140 186 225 198 28 249 80 106 206 204 81 141 187 235 53 173 + Shared (Mutual) (Substitution) Component 4 236 98 244 78 32 92 199 122 89 139 227 31 100 136 111 144 78 34 20 19 16 245 75 82 73 80 188 45 165 117 28 215 119 104 22 119 11 96 75 126 196 57 197 92 232 211 74 106 131 93 109 141 51 16 54 248 101 199 185 6 95 129 246 198 27 60 7 17 167 12 + Shared (Mutual) (Substitution) Component 5 253 68 183 115 57 179 113 85 25 128 100 215 10 142 26 25 247 144 3 30 241 91 221 157 30 233 114 176 201 223 59 64 175 161 148 230 185 178 69 191 169 220 239 77 2 106 58 12 174 244 18 203 208 85 137 129 178 105 242 166 162 137 94 226 186 254 165 198 1 68 + """ + + # Shared (Mutual) (Substitution) Component 1 + shared_mutual_substitution_component_1 = DarcKey(matrix=[ + ['81', '150', '209', '32', '246', '219', '15'], + ['100', '15', '50', '179', '52', '1', '142'], + ['98', '34', '170', '6', '195', '115', '117'], + ['205', '169', '12', '151', '139', '91', '114'], + ['192', '153', '175', '62', '249', '230', '103'], + ['56', '54', '44', '107', '125', '122', '219'], + ['28', '16', '32', '27', '95', '248', '200'], + ['152', '121', '40', '198', '19', '55', '59'], + ['189', '227', '175', '102', '171', '135', '170'], + ['182', '144', '202', '64', '253', '89', '196'] + ], key_type=DarcKeyTypes.alphabet) + + # Shared (Mutual) (Substitution) Component 2 + shared_mutual_substitution_component_2 = DarcKey(matrix=[ + ['48', '87', '34', '220', '7', '126', '227'], + ['92', '232', '22', '55', '20', '202', '27'], + ['53', '121', '169', '82', '73', '194', '136'], + ['66', '190', '253', '113', '231', '210', '137'], + ['189', '76', '54', '114', '39', '144', '74'], + ['71', '47', '179', '12', '209', '213', '187'], + ['110', '46', '81', '150', '252', '48', '79'], + ['50', '166', '60', '45', '116', '88', '123'], + ['167', '175', '228', '65', '204', '171', '186'], + ['56', '140', '58', '124', '85', '95', '199'] + ], key_type=DarcKeyTypes.alphabet) + + # Shared (Mutual) (Substitution) Component 3 + shared_mutual_substitution_component_3 = DarcKey(matrix=[ + ['102', '134', '242', '33', '236', '198', '117'], + ['64', '217', '214', '101', '254', '216', '28'], + ['63', '6', '193', '57', '57', '149', '219'], + ['46', '206', '213', '239', '207', '23', '188'], + ['146', '185', '119', '73', '126', '123', '248'], + ['96', '61', '106', '92', '239', '209', '167'], + ['150', '168', '220', '110', '162', '117', '247'], + ['175', '141', '235', '39', '117', '140', '186'], + ['225', '198', '28', '249', '80', '106', '206'], + ['204', '81', '141', '187', '235', '53', '173'] + ], key_type=DarcKeyTypes.alphabet) + + # Shared (Mutual) (Substitution) Component 4 + shared_mutual_substitution_component_4 = DarcKey(matrix=[ + ['236', '98', '244', '78', '32', '92', '199'], + ['122', '89', '139', '227', '31', '100', '136'], + ['111', '144', '78', '34', '20', '19', '16'], + ['245', '75', '82', '73', '80', '188', '45'], + ['165', '117', '28', '215', '119', '104', '22'], + ['119', '11', '96', '75', '126', '196', '57'], + ['197', '92', '232', '211', '74', '106', '131'], + ['93', '109', '141', '51', '16', '54', '248'], + ['101', '199', '185', '6', '95', '129', '246'], + ['198', '27', '60', '7', '17', '167', '12'] + ], key_type=DarcKeyTypes.alphabet) + + # Shared (Mutual) (Substitution) Component 5 + shared_mutual_substitution_component_5 = DarcKey(matrix=[ + ['253', '68', '183', '115', '57', '179', '113'], + ['85', '25', '128', '100', '215', '10', '142'], + ['26', '25', '247', '144', '3', '30', '241'], + ['91', '221', '157', '30', '233', '114', '176'], + ['201', '223', '59', '64', '175', '161', '148'], + ['230', '185', '178', '69', '191', '169', '220'], + ['239', '77', '2', '106', '58', '12', '174'], + ['244', '18', '203', '208', '85', '137', '129'], + ['178', '105', '242', '166', '162', '137', '94'], + ['226', '186', '254', '165', '198', '1', '68'] + ], key_type=DarcKeyTypes.alphabet) + + """ + Shared (Mutual) Client (Substitution) Component 240 15 88 14 250 164 163 163 56 44 73 159 63 176 73 243 215 9 10 177 36 120 89 247 92 152 209 95 130 128 3 126 120 77 105 232 156 52 52 145 3 116 17 124 135 199 154 130 221 101 78 248 180 114 83 72 58 66 170 59 212 240 221 67 53 80 35 124 28 197 + Shared (Mutual) Server (Substitution) Component 115 96 164 85 150 162 142 252 185 145 200 150 27 195 186 199 82 103 152 178 130 139 104 18 104 198 177 181 118 143 110 202 118 85 83 104 216 226 79 228 177 42 59 114 204 213 229 98 164 54 240 249 203 153 181 84 29 23 83 59 148 165 19 238 22 232 255 41 234 113 + Client (Substitution) Component 1 151 187 247 139 183 232 14 230 143 212 92 0 130 233 129 77 103 15 159 192 98 97 208 37 14 53 62 138 38 141 174 232 134 14 171 87 79 75 191 122 214 18 9 204 152 159 21 178 171 30 130 4 1 166 248 96 87 179 192 93 61 129 106 43 41 3 232 20 10 163 + Client (Substitution) Component 2 39 161 162 158 47 242 245 115 157 174 130 210 253 157 95 103 134 162 131 19 170 53 217 182 156 83 184 228 97 49 114 75 158 248 138 204 22 121 176 205 115 146 117 154 87 237 2 56 114 24 241 213 73 236 37 12 156 230 70 205 108 187 32 194 40 99 190 143 24 119 + """ + # Shared (Mutual) Client (Substitution) Component + shared_mutual_client_substitution_component = DarcKey(matrix=[ + ['240', '15', '88', '14', '250', '164', '163'], + ['163', '56', '44', '73', '159', '63', '176'], + ['73', '243', '215', '9', '10', '177', '36'], + ['120', '89', '247', '92', '152', '209', '95'], + ['130', '128', '3', '126', '120', '77', '105'], + ['232', '156', '52', '52', '145', '3', '116'], + ['17', '124', '135', '199', '154', '130', '221'], + ['101', '78', '248', '180', '114', '83', '72'], + ['58', '66', '170', '59', '212', '240', '221'], + ['67', '53', '80', '35', '124', '28', '197'] + ], key_type=DarcKeyTypes.alphabet) + + # Shared (Mutual) Server (Substitution) Component + shared_mutual_server_substitution_component = DarcKey(matrix=[ + ['115', '96', '164', '85', '150', '162', '142'], + ['252', '185', '145', '200', '150', '27', '195'], + ['186', '199', '82', '103', '152', '178', '130'], + ['139', '104', '18', '104', '198', '177', '181'], + ['118', '143', '110', '202', '118', '85', '83'], + ['104', '216', '226', '79', '228', '177', '42'], + ['59', '114', '204', '213', '229', '98', '164'], + ['54', '240', '249', '203', '153', '181', '84'], + ['29', '23', '83', '59', '148', '165', '19'], + ['238', '22', '232', '255', '41', '234', '113'] + ], key_type=DarcKeyTypes.alphabet) + + # Client (Substitution) Component 1 + client_substitution_component_1 = DarcKey(matrix=[ + ['151', '187', '247', '139', '183', '232', '14'], + ['230', '143', '212', '92', '0', '130', '233'], + ['129', '77', '103', '15', '159', '192', '98'], + ['97', '208', '37', '14', '53', '62', '138'], + ['38', '141', '174', '232', '134', '14', '171'], + ['87', '79', '75', '191', '122', '214', '18'], + ['9', '204', '152', '159', '21', '178', '171'], + ['30', '130', '4', '1', '166', '248', '96'], + ['87', '179', '192', '93', '61', '129', '106'], + ['43', '41', '3', '232', '20', '10', '163'] + ], key_type=DarcKeyTypes.alphabet) + + # Client (Substitution) Component 2 + client_substitution_component_2 = DarcKey(matrix=[ + ['39', '161', '162', '158', '47', '242', '245'], + ['115', '157', '174', '130', '210', '253', '157'], + ['95', '103', '134', '162', '131', '19', '170'], + ['53', '217', '182', '156', '83', '184', '228'], + ['97', '49', '114', '75', '158', '248', '138'], + ['204', '22', '121', '176', '205', '115', '146'], + ['117', '154', '87', '237', '2', '56', '114'], + ['24', '241', '213', '73', '236', '37', '12'], + ['156', '230', '70', '205', '108', '187', '32'], + ['194', '40', '99', '190', '143', '24', '119'] + ], key_type=DarcKeyTypes.alphabet) + + + """ + Server (Substitution) Component 1 202 199 197 48 92 205 182 45 16 19 85 99 114 163 154 232 143 138 159 248 190 87 79 134 207 88 120 175 17 133 198 222 231 227 231 171 170 43 215 22 83 139 154 228 211 44 35 228 82 49 175 11 224 248 215 206 109 101 208 62 247 59 175 86 26 53 57 171 135 80 + Server (Substitution) Component 2 141 198 40 43 65 91 15 41 26 29 55 179 239 92 165 193 247 134 24 232 157 170 132 223 231 45 92 130 209 198 33 38 130 183 83 103 183 30 163 134 8 123 62 192 47 67 198 127 155 210 95 229 182 67 248 60 242 146 72 38 147 46 235 136 129 85 244 243 183 172 + Client (Substitution) Key 148 232 147 96 20 201 150 120 0 158 250 176 223 82 12 81 193 212 247 100 1 127 211 164 202 25 149 34 214 38 10 197 195 97 193 177 120 199 180 206 184 155 154 146 186 205 190 47 169 164 80 233 207 214 91 108 123 101 231 244 92 88 12 222 193 85 98 224 145 0 + Server (Substitution) Key 163 247 59 226 186 179 35 140 180 54 88 40 252 97 229 247 16 206 186 125 81 221 222 54 22 190 18 122 126 130 83 142 152 238 237 76 168 77 176 198 119 104 121 96 80 75 138 219 122 92 210 20 56 232 219 245 111 1 155 236 15 184 0 36 31 143 5 112 206 106 + """ + # Server (Substitution) Component 1 + server_substitution_component_1 = DarcKey(matrix=[ + ['202', '199', '197', '48', '92', '205', '182'], + ['45', '16', '19', '85', '99', '114', '163'], + ['154', '232', '143', '138', '159', '248', '190'], + ['87', '79', '134', '207', '88', '120', '175'], + ['17', '133', '198', '222', '231', '227', '231'], + ['171', '170', '43', '215', '22', '83', '139'], + ['154', '228', '211', '44', '35', '228', '82'], + ['49', '175', '11', '224', '248', '215', '206'], + ['109', '101', '208', '62', '247', '59', '175'], + ['86', '26', '53', '57', '171', '135', '80'] + ], key_type=DarcKeyTypes.alphabet) + # Server (Substitution) Component 2 + server_substitution_component_2 = DarcKey(matrix=[ + ['141', '198', '40', '43', '65', '91', '15'], + ['41', '26', '29', '55', '179', '239', '92'], + ['165', '193', '247', '134', '24', '232', '157'], + ['170', '132', '223', '231', '45', '92', '130'], + ['209', '198', '33', '38', '130', '183', '83'], + ['103', '183', '30', '163', '134', '8', '123'], + ['62', '192', '47', '67', '198', '127', '155'], + ['210', '95', '229', '182', '67', '248', '60'], + ['242', '146', '72', '38', '147', '46', '235'], + ['136', '129', '85', '244', '243', '183', '172'] + ], key_type=DarcKeyTypes.alphabet) + + # Client (Substitution) Key + client_substitution_key = DarcKey(matrix=[ + ['148', '232', '147', '96', '20', '201', '150'], + ['120', '0', '158', '250', '176', '223', '82'], + ['12', '81', '193', '212', '247', '100', '1'], + ['127', '211', '164', '202', '25', '149', '34'], + ['214', '38', '10', '197', '195', '97', '193'], + ['177', '120', '199', '180', '206', '184', '155'], + ['154', '146', '186', '205', '190', '47', '169'], + ['164', '80', '233', '207', '214', '91', '108'], + ['123', '101', '231', '244', '92', '88', '12'], + ['222', '193', '85', '98', '224', '145', '0'] + ], key_type=DarcKeyTypes.alphabet) + # Server (Substitution) Key + server_substitution_key = DarcKey(matrix=[ + ['163', '247', '59', '226', '186', '179', '35'], + ['140', '180', '54', '88', '40', '252', '97'], + ['229', '247', '16', '206', '186', '125', '81'], + ['221', '222', '54', '22', '190', '18', '122'], + ['126', '130', '83', '142', '152', '238', '237'], + ['76', '168', '77', '176', '198', '119', '104'], + ['121', '96', '80', '75', '138', '219', '122'], + ['92', '210', '20', '56', '232', '219', '245'], + ['111', '1', '155', '236', '15', '184', '0'], + ['36', '31', '143', '5', '112', '206', '106'] + ], + key_type=DarcKeyTypes.alphabet + ) + + # Shared (Mutual) (Substitution) Key + shared_mutual_substitution_key = shared_mutual_substitution_component_1 ^ client_substitution_key + + # Shared (Mutual) Client (Substitution) Key Scratch + shared_mutual_client_substitution_key_scratch = shared_mutual_substitution_component_1 ^ shared_mutual_server_substitution_component + + # Shared (Mutual) Server (Substitution) Key Scratch + shared_mutual_server_substitution_key_scratch = shared_mutual_substitution_component_1 ^ shared_mutual_client_substitution_component + + # Client Mutual (Substitution) Key 1 = Client (Substitution) Component 1 ^ Shared (Mutual) (Substitution) Component 4 + client_mutual_substitution_key_1 = client_substitution_component_1 ^ shared_mutual_substitution_component_4 + + # Client Mutual (Substitution) Key 2 = Client (Substitution) Component 2 ^ Shared (Mutual) (Substitution) Component 2 ^ Shared (Mutual) Client (Substitution) Key Scratch + client_mutual_substitution_key_2 = client_substitution_component_2 ^ shared_mutual_substitution_component_2 ^ shared_mutual_client_substitution_key_scratch + + # Client Mutual (Substitution) Key 3 = Client (Substitution) Component 2 ^ Shared (Mutual) Client (Substitution) Component ^ Shared (Mutual) (Substitution) Component 1 ^ Shared (Mutual) (Substitution) Component 3 + client_mutual_substitution_key_3 = client_substitution_component_2 ^ shared_mutual_client_substitution_component ^ shared_mutual_substitution_component_1 ^ shared_mutual_substitution_component_3 + + # Client Mutual (Substitution) Key 4 = Client (Substitution) Component 1 ^ Shared (Mutual) (Substitution) Component 5 + client_mutual_substitution_key_4 = client_substitution_component_1 ^ shared_mutual_substitution_component_5 + + # Server Mutual (Substitution) Key 1 = Server (Substitution) Component 1 ^ Shared (Mutual) (Substitution) Component 4 + server_mutual_substitution_key_1 = server_substitution_component_1 ^ shared_mutual_substitution_component_4 + + # Server Mutual (Substitution) Key 2 = Server (Substitution) Component 2 ^ Shared (Mutual) (Substitution) Component 1 ^ Shared (Mutual) (Substitution) Component 2 ^ Shared (Mutual) Server (Substitution) Component + server_mutual_substitution_key_2 = server_substitution_component_2 ^ shared_mutual_substitution_component_1 ^ shared_mutual_substitution_component_2 ^ shared_mutual_server_substitution_component + + # Server Mutual (Substitution) Key 3 = Server (Substitution) Component 2 ^ Shared (Mutual) (Substitution) Component 3 ^ Shared (Mutual) Server (Substitution) Key Scratch + server_mutual_substitution_key_3 = server_substitution_component_2 ^ shared_mutual_substitution_component_3 ^ shared_mutual_server_substitution_key_scratch + + # Server Mutual (Substitution) Key 4 = Server (Substitution) Component 1 ^ Shared (Mutual) (Substitution) Component 5 + server_mutual_substitution_key_4 = server_substitution_component_1 ^ shared_mutual_substitution_component_5 + + + """ Ephemeral Key Generation """ + """ + Outer (Mutual) (Substitution) Function Ephemeral Key 0 9 6 2 1 5 3 8 7 4 + Outer (Mutual) (Substitution) Function Function Ephemeral Key 2 3 9 7 6 0 1 4 8 5 + Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key 0 8 5 9 7 3 1 4 6 2 + Outer Client Shuffle (Permutation) Ephemeral Key 1 4 2 9 5 7 8 3 0 6 + Outer Client Shuffle (Permutation) Function Ephemeral Key 4 3 2 5 1 6 7 8 0 9 + Outer Server Shuffle (Permutation) Ephemeral Key 7 5 2 1 8 4 3 6 9 0 + """ + # Outer (Mutual) (Substitution) Function Ephemeral Key + outer_mutual_substitution_function_ephemeral_key = DarcKey(matrix=[ + ['0', '9', '6', '2', '1', '5', '3', '8', '7', '4'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # Outer (Mutual) (Substitution) Function Function Ephemeral Key + outer_mutual_substitution_function_function_ephemeral_key = DarcKey(matrix=[ + ['2', '3', '9', '7', '6', '0', '1', '4', '8', '5'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key + outer_server_mutual_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[ + ['0', '8', '5', '9', '7', '3', '1', '4', '6', '2'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # Outer Client Shuffle (Permutation) Ephemeral Key + outer_client_shuffle_permutation_ephemeral_key = DarcKey(matrix=[ + ['1', '4', '2', '9', '5', '7', '8', '3', '0', '6'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # Outer Client Shuffle (Permutation) Function Ephemeral Key + outer_client_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[ + ['4', '3', '2', '5', '1', '6', '7', '8', '0', '9'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # Outer Server Shuffle (Permutation) Ephemeral Key + outer_server_shuffle_permutation_ephemeral_key = DarcKey(matrix=[ + ['7', '5', '2', '1', '8', '4', '3', '6', '9', '0'] + ], key_type=DarcKeyTypes.outer_shuffle) + + """ + (Mutual) (Substitution) Function Ephemeral Key 6 0 1 4 2 3 5 2 3 6 4 0 1 5 2 4 0 3 6 1 5 0 4 2 3 1 5 6 6 4 2 5 1 0 3 5 1 0 6 4 2 3 1 2 4 3 6 0 5 6 1 4 0 5 3 2 2 3 5 4 6 0 1 1 6 4 3 5 2 0 + Client Shuffle (Permutation) Ephemeral Key A (remove A) 5 0 4 3 2 6 1 0 6 2 1 5 3 4 1 2 0 3 5 4 6 0 2 6 3 4 5 1 5 1 2 0 3 4 6 1 0 3 4 5 6 2 3 0 5 2 6 4 1 6 4 5 3 0 2 1 2 4 6 0 3 5 1 4 6 2 3 5 1 0 + Server Shuffle (Permutation) Ephemeral Key 1 (remove 1) 6 1 3 0 4 2 5 3 2 1 0 4 5 6 2 4 3 5 0 6 1 4 1 3 6 0 2 5 1 4 2 3 0 5 6 6 4 5 0 2 3 1 0 4 2 3 1 5 6 0 6 3 5 1 2 4 2 6 3 1 4 5 0 5 0 4 1 6 3 2 + """ + # (Mutual) (Substitution) Function Ephemeral Key + mutual_substitution_function_ephemeral_key = DarcKey(matrix=[ + ['6', '0', '1', '4', '2', '3', '5'], + ['2', '3', '6', '4', '0', '1', '5'], + ['2', '4', '0', '3', '6', '1', '5'], + ['0', '4', '2', '3', '1', '5', '6'], + ['6', '4', '2', '5', '1', '0', '3'], + ['5', '1', '0', '6', '4', '2', '3'], + ['1', '2', '4', '3', '6', '0', '5'], + ['6', '1', '4', '0', '5', '3', '2'], + ['2', '3', '5', '4', '6', '0', '1'], + ['1', '6', '4', '3', '5', '2', '0'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # Client Shuffle (Permutation) Ephemeral Key A (remove A) + client_shuffle_permutation_ephemeral_key_a = DarcKey(matrix=[ + ['5', '0', '4', '3', '2', '6', '1'], + ['0', '6', '2', '1', '5', '3', '4'], + ['1', '2', '0', '3', '5', '4', '6'], + ['0', '2', '6', '3', '4', '5', '1'], + ['5', '1', '2', '0', '3', '4', '6'], + ['1', '0', '3', '4', '5', '6', '2'], + ['3', '0', '5', '2', '6', '4', '1'], + ['6', '4', '5', '3', '0', '2', '1'], + ['2', '4', '6', '0', '3', '5', '1'], + ['4', '6', '2', '3', '5', '1', '0'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # Server Shuffle (Permutation) Ephemeral Key 1 (remove 1) + server_shuffle_permutation_ephemeral_key_1 = DarcKey(matrix=[ + ['6', '1', '3', '0', '4', '2', '5'], + ['3', '2', '1', '0', '4', '5', '6'], + ['2', '4', '3', '5', '0', '6', '1'], + ['4', '1', '3', '6', '0', '2', '5'], + ['1', '4', '2', '3', '0', '5', '6'], + ['6', '4', '5', '0', '2', '3', '1'], + ['0', '4', '2', '3', '1', '5', '6'], + ['0', '6', '3', '5', '1', '2', '4'], + ['2', '6', '3', '1', '4', '5', '0'], + ['5', '0', '4', '1', '6', '3', '2'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # Server (Substitution) Ephemeral Unique Component Function + server_substitution_ephemeral_unique_component_function = 5 + + """ + Shared (Mutual) (Substitution) Ephemeral Key 106 113 9 54 49 4 207 184 3 232 179 15 113 142 129 44 164 54 1 32 201 106 50 246 140 149 179 109 210 11 69 193 77 245 62 37 76 137 24 220 30 165 40 57 147 225 24 176 103 37 212 189 203 218 138 168 73 227 38 164 20 239 24 7 194 254 76 0 244 215 + Client (Substitution) Ephemeral Key 21 149 75 73 228 81 79 41 189 80 209 45 101 53 139 238 141 159 30 79 214 239 234 72 75 80 190 124 203 225 246 200 205 195 92 201 185 113 101 176 216 106 14 210 125 70 53 128 57 115 27 97 39 199 26 104 29 4 55 5 13 57 19 158 184 137 0 221 12 217 + Server (Substitution) Ephemeral Random Component 191 50 229 60 201 64 45 31 88 90 8 153 6 228 117 63 38 90 236 207 254 64 219 36 3 119 205 171 172 138 153 52 161 137 216 49 150 210 129 174 190 54 81 230 135 200 218 31 52 128 253 177 220 1 83 3 204 199 43 50 148 215 6 79 124 128 30 74 242 85 + """ + + # Shared (Mutual) (Substitution) Ephemeral Key + shared_mutual_substitution_ephemeral_key = DarcKey(matrix=[ + ['106', '113', '9', '54', '49', '4', '207'], + ['184', '3', '232', '179', '15', '113', '142'], + ['129', '44', '164', '54', '1', '32', '201'], + ['106', '50', '246', '140', '149', '179', '109'], + ['210', '11', '69', '193', '77', '245', '62'], + ['37', '76', '137', '24', '220', '30', '165'], + ['40', '57', '147', '225', '24', '176', '103'], + ['37', '212', '189', '203', '218', '138', '168'], + ['73', '227', '38', '164', '20', '239', '24'], + ['7', '194', '254', '76', '0', '244', '215'] + ], key_type=DarcKeyTypes.alphabet) + + # Client (Substitution) Ephemeral Key + client_substitution_ephemeral_key = DarcKey(matrix=[ + ['21', '149', '75', '73', '228', '81', '79'], + ['41', '189', '80', '209', '45', '101', '53'], + ['139', '238', '141', '159', '30', '79', '214'], + ['239', '234', '72', '75', '80', '190', '124'], + ['203', '225', '246', '200', '205', '195', '92'], + ['201', '185', '113', '101', '176', '216', '106'], + ['14', '210', '125', '70', '53', '128', '57'], + ['115', '27', '97', '39', '199', '26', '104'], + ['29', '4', '55', '5', '13', '57', '19'], + ['158', '184', '137', '0', '221', '12', '217'] + ], key_type=DarcKeyTypes.alphabet) + + # Server (Substitution) Ephemeral Random Component + server_substitution_ephemeral_random_component = DarcKey(matrix=[ + ['191', '50', '229', '60', '201', '64', '45'], + ['31', '88', '90', '8', '153', '6', '228'], + ['117', '63', '38', '90', '236', '207', '254'], + ['64', '219', '36', '3', '119', '205', '171'], + ['172', '138', '153', '52', '161', '137', '216'], + ['49', '150', '210', '129', '174', '190', '54'], + ['81', '230', '135', '200', '218', '31', '52'], + ['128', '253', '177', '220', '1', '83', '3'], + ['204', '199', '43', '50', '148', '215', '6'], + ['79', '124', '128', '30', '74', '242', '85'] + ], key_type=DarcKeyTypes.alphabet) + + """ + Server (Substitution) Ephemeral Unique Component 7 190 58 75 135 15 214 149 244 224 + """ + + # Server (Substitution) Ephemeral Unique Component + server_substitution_ephemeral_unique_component = DarcKey(matrix=[ + ['7', '190', '58', '75', '135', '15', '214', '149', '244', '224'] + ], key_type=DarcKeyTypes.alphabet) + + # Outer (Mutual) Function Function Ephemeral Key Applied = Outer (Mutual) (Substitution) Function Function Key << Outer (Mutual) (Substitution) Function Function Ephemeral Key + outer_mutual_function_function_ephemeral_key_applied = outer_mutual_substitution_function_function_key << outer_mutual_substitution_function_function_ephemeral_key + + # Inner (Mutual) Function Applied Key = (Mutual) (Substitution) Function Key << (Mutual) (Substitution) Function Ephemeral Key + inner_mutual_function_applied_key = mutual_substitution_function_key << mutual_substitution_function_ephemeral_key + + # Inner (Mutual) Function Key Scratch = Inner (Mutual) Function Applied Key << Outer (Mutual) Function Function Ephemeral Key Applied + inner_mutual_function_key_scratch = inner_mutual_function_applied_key < outer_mutual_function_function_ephemeral_key_applied + + # Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied = Outer Server (Mutual) Shuffle (Permutation) Function Key << Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key + outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied = outer_mutual_shuffle_permutation_function_key << outer_server_mutual_shuffle_permutation_function_ephemeral_key + + # Client Shuffle (Permutation) Key X Scratch = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + client_shuffle_permutation_key_x_scratch = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # Inner Function Key Scratch 2 = Inner (Mutual) Function Key Scratch << Client Shuffle (Permutation) Key X Scratch + inner_function_key_scratch_2 = inner_mutual_function_key_scratch << client_shuffle_permutation_key_x_scratch + + # Outer (Mutual) Function Ephemeral Key Applied = Outer (Mutual) (Substitution) Function Key < Outer (Mutual) (Substitution) Function Ephemeral Key + outer_mutual_function_ephemeral_key_applied = outer_mutual_substitution_function_key << outer_mutual_substitution_function_ephemeral_key + + # Server (Substitution) Key Scratch = Server (Substitution) Key < Outer (Mutual) Function Ephemeral Key Applied + server_substitution_key_scratch = server_substitution_key < outer_mutual_function_ephemeral_key_applied + + # Shared (Mutual) (Substitution) Key Scratch = Shared (Mutual) (Substitution) Key < Outer (Mutual) Function Ephemeral Key Applied + shared_mutual_substitution_key_scratch = shared_mutual_substitution_key < outer_mutual_function_ephemeral_key_applied + + # Shared (Mutual) (Substitution) Ephemeral Key Server Scratch = Shared (Mutual) (Substitution) Ephemeral Key < Outer (Mutual) Function Ephemeral Key Applied + shared_mutual_substitution_ephemeral_key_server_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied + + # line 78 + # Server Client Shuffle (Permutation) = Server Shuffle (Permutation) Key << Client Shuffle (Permutation) Key X + server_client_shuffle_permutation = server_shuffle_permutation_key << client_shuffle_permutation_key_x + + # Server Client Shuffle (Permutation) Inverse + server_client_shuffle_permutation_inverse = ~server_client_shuffle_permutation + + # Server Shuffle (Permutation) Ephemeral Key 1 Inverse (remove 1) = ~(Server Shuffle (Permutation) Ephemeral Key 1 (remove 1)) + server_shuffle_permutation_ephemeral_key_1_inverse = ~server_shuffle_permutation_ephemeral_key_1 + + # Server Shuffle (Permutation) Ephemeral Key Applied = Server Client Shuffle (Permutation) Inverse < Server Shuffle (Permutation) Ephemeral Key 1 Inverse (remove 1) + server_shuffle_permutation_ephemeral_key_applied = server_client_shuffle_permutation_inverse << server_shuffle_permutation_ephemeral_key_1_inverse + + # line 82 + # Server Shuffle (Permutation) Ephemeral Key Applied Scratch = Server Shuffle (Permutation) Ephemeral Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + server_shuffle_permutation_ephemeral_key_applied_scratch = server_shuffle_permutation_ephemeral_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # Server Shuffle (Permutation) Ephemeral Key Applied Scratch Inverse = ~Server Shuffle (Permutation) Ephemeral Key Applied Scratch + server_shuffle_permutation_ephemeral_key_applied_scratch_inverse = ~server_shuffle_permutation_ephemeral_key_applied_scratch + + # Outer Server Shuffle (Permutation) Ephemeral Key Applied = Outer Server Shuffle (Permutation) Key < Outer Server Shuffle (Permutation) Ephemeral Key + outer_server_shuffle_permutation_ephemeral_key_applied = outer_server_shuffle_permutation_key << outer_server_shuffle_permutation_ephemeral_key + + # Alphabet Scratch 1 = Alphabet Values < Outer Server Shuffle (Permutation) Ephemeral Key Applied + alphabet_scratch_1 = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied + + # Alphabet Scratch 2 = Alphabet Scratch 1 << Server Shuffle (Permutation) Ephemeral Key Applied Scratch Inverse + alphabet_scratch_2 = alphabet_scratch_1 << server_shuffle_permutation_ephemeral_key_applied_scratch_inverse + + # Server (Substitution) Ephemeral Component Scratch 1 = Server (Substitution) Ephemeral Random Component.column_substitution( Server (Substitution) Ephemeral Unique Component Function ,Server (Substitution) Ephemeral Unique Component) + server_substitution_ephemeral_component_scratch_1 = server_substitution_ephemeral_random_component.column_substitution( + server_substitution_ephemeral_unique_component_function, + server_substitution_ephemeral_unique_component.matrix[0] + ) + + # Server (Substitution) Ephemeral Component Scratch 2 = Server (Substitution) Ephemeral Component Scratch 1 < Outer (Mutual) Function Ephemeral Key Applied + server_substitution_ephemeral_component_scratch_2 = server_substitution_ephemeral_component_scratch_1 < outer_mutual_function_ephemeral_key_applied + + """ + # Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2) + =BITXOR( + # Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) + BITXOR( + # Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2) + BITXOR( + # Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) + BITXOR( + BN86, # Alphabet Scratch 2 + # Server (Substitution) Key Scratch << Inner Function Key Scratch 2 + HLOOKUP( + BN73, # Inner Function Key Scratch 2 + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB75) - ROW($BD$5) + 1, # Server (Substitution) Key Scratch + FALSE + ) + ), + + # Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2 + HLOOKUP( + BN73, # Inner Function Key Scratch 2 + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB88) - ROW($BD$5) + 1, # Server (Substitution) Ephemeral Component Scratch 2 + FALSE + ) + ), + # Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2 + HLOOKUP( + BN73, # Inner Function Key Scratch 2 + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB76) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Key Scratch + FALSE + ) + ), + # Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2 + HLOOKUP( + BN73, # Inner Function Key Scratch 2 + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB77) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Ephemeral Key Server Scratch + FALSE + ) + ) + + """ + # Server (Substitution) Ephemeral Component Scratch 3 = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2) + server_substitution_ephemeral_component_scratch_3 = alphabet_scratch_2 ^ (server_substitution_key_scratch << inner_function_key_scratch_2) ^ (server_substitution_ephemeral_component_scratch_2 << inner_function_key_scratch_2) ^ (shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2) + + # Inner Function Key Scratch 2 Inverse = ~Inner Function Key Scratch 2 + inner_function_key_scratch_2_inverse = ~inner_function_key_scratch_2 + + # Server (Substitution) Ephemeral Key Scratch = Server (Substitution) Ephemeral Component Scratch 3 << Inner Function Key Scratch 2 Inverse + server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_component_scratch_3 << inner_function_key_scratch_2_inverse + + # Outer (Mutual) Function Ephemeral Key Applied Inverse = ~Outer (Mutual) Function Ephemeral Key Applied + outer_mutual_function_ephemeral_key_applied_inverse = ~outer_mutual_function_ephemeral_key_applied + + # Server (Substitution) Ephemeral Key = Server (Substitution) Ephemeral Key Scratch < Outer (Mutual) Function Ephemeral Key Applied Inverse + server_substitution_ephemeral_key = server_substitution_ephemeral_key_scratch < outer_mutual_function_ephemeral_key_applied_inverse + """ + server_substitution_ephemeral_key_expected = 159 243 217 236 133 191 86 8 248 18 181 54 164 252 86 139 223 48 37 67 24 126 115 91 230 221 105 196 56 172 101 158 124 89 183 228 118 232 199 12 229 156 157 115 233 158 138 123 11 211 238 246 43 210 158 65 62 158 234 252 88 81 243 67 209 43 108 31 29 28 + """ + server_substitution_ephemeral_key_expected = DarcKey(matrix=[ + ['159', '243', '217', '236', '133', '191', '86'], + ['8', '248', '18', '181', '54', '164', '252'], + ['86', '139', '223', '48', '37', '67', '24'], + ['126', '115', '91', '230', '221', '105', '196'], + ['56', '172', '101', '158', '124', '89', '183'], + ['228', '118', '232', '199', '12', '229', '156'], + ['157', '115', '233', '158', '138', '123', '11'], + ['211', '238', '246', '43', '210', '158', '65'], + ['62', '158', '234', '252', '88', '81', '243'], + ['67', '209', '43', '108', '31', '29', '28'] + ], key_type=DarcKeyTypes.alphabet) + + # compare server_substitution_ephemeral_key_expected to server_substitution_ephemeral_key + assert server_substitution_ephemeral_key_expected == server_substitution_ephemeral_key + + + # line 94 + """ Server Tx (Phase 1) """ + + # Inner Server Shuffle (Permutation) Key Applied = Server Shuffle (Permutation) Ephemeral Key 1 (remove 1) << Server Shuffle (Permutation) Key + inner_server_shuffle_permutation_key_applied = server_shuffle_permutation_ephemeral_key_1 << server_shuffle_permutation_key + + # Outer Server Shuffle (Permutation) Key Applied = Inner Server Shuffle (Permutation) Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + outer_server_shuffle_permutation_key_applied = inner_server_shuffle_permutation_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # Server (Substitution) Ephemeral Key Scratch = Server (Substitution) Ephemeral Key < Outer (Mutual) Function Ephemeral Key Applied + server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied + + + # Server (Substitution) Key Scratch 2 = Server (Substitution) Key Scratch + server_substitution_key_scratch_2 = server_substitution_key_scratch + + # line 105 + # Outer (Mutual) Function Function Ephemeral Key Applied = Outer (Mutual) (Substitution) Function Function Key << Outer (Mutual) (Substitution) Function Function Ephemeral Key + outer_mutual_function_function_ephemeral_key_applied = outer_mutual_substitution_function_function_key << outer_mutual_substitution_function_function_ephemeral_key + + + # line 108 + """ Server Tx (Phase 1) """ + + # Client (Substitution) Key A Scratch = Client (Substitution) Key < Outer (Mutual) Function Ephemeral Key Applied + client_substitution_key_a_scratch = client_substitution_key < outer_mutual_function_ephemeral_key_applied + + # Client (Substitution) Ephemeral Key A Scratch = Client (Substitution) Ephemeral Key < Outer (Mutual) Function Ephemeral Key Applied + client_substitution_ephemeral_key_a_scratch = client_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied + + # Client Shuffle (Permutation) Key A Applied (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) << Client Shuffle (Permutation) Ephemeral Key A (remove A) + client_shuffle_permutation_key_a_applied = client_shuffle_permutation_key_a << client_shuffle_permutation_ephemeral_key_a + + # Client Shuffle (Permutation) Key A Scratch (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + client_shuffle_permutation_key_a_scratch = client_shuffle_permutation_key_a_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # Outer Client Shuffle (Permutation) Ephemeral Key Applied = Outer Client Shuffle (Permutation) Key << Outer Client Shuffle (Permutation) Ephemeral Key + outer_client_shuffle_permutation_ephemeral_key_applied = outer_client_shuffle_permutation_key << outer_client_shuffle_permutation_ephemeral_key + + # Outer Client Shuffle (Permutation) Function Ephemeral Key Applied = Outer Client Shuffle (Permutation) Function Key << Outer Client Shuffle (Permutation) Function Ephemeral Key + outer_client_shuffle_permutation_function_ephemeral_key_applied = outer_client_shuffle_permutation_function_key << outer_client_shuffle_permutation_function_ephemeral_key + + # Outer Client Shuffle (Permutation) Function Key Applied = Outer Client Shuffle (Permutation) Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Ephemeral Key Applied + outer_client_shuffle_permutation_function_key_applied = outer_client_shuffle_permutation_ephemeral_key_applied << outer_client_shuffle_permutation_function_ephemeral_key_applied + + # Outer Client Shuffle (Permutation) Function Key Applied Inverse = ~Outer Client Shuffle (Permutation) Function Key Applied + outer_client_shuffle_permutation_function_key_applied_inverse = ~outer_client_shuffle_permutation_function_key_applied + + """ + Alphabet Input Sequence 0 2 4 6 8 1 3 5 7 9 + """ + + alphabet_input_sequence = DarcKey(matrix=[ + ['0', '2', '4', '6', '8', '1', '3', '5', '7', '9'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # Alphabet Input Sequence Scratch = Outer Client Shuffle (Permutation) Function Key Applied Inverse << Alphabet Input Sequence + alphabet_input_sequence_scratch = outer_client_shuffle_permutation_function_key_applied_inverse << alphabet_input_sequence + + + # line 130 + """ Client Tx (Phase 3) """ + + # Client Shuffle (Permutation) Key A Inverse (remove A) = ~Client Shuffle (Permutation) Key A (remove A) + client_shuffle_permutation_key_a_inverse = ~client_shuffle_permutation_key_a + + # Client Shuffle (Permutation) Key B (remove B) = Client Shuffle (Permutation) Key A Inverse (remove A) << Client Shuffle (Permutation) Key X + client_shuffle_permutation_key_b = client_shuffle_permutation_key_a_inverse << client_shuffle_permutation_key_x + + # Client Shuffle (Permutation) Ephemeral Key A (remove A) Inverse = ~Client Shuffle (Permutation) Ephemeral Key A (remove A) + client_shuffle_permutation_ephemeral_key_a_inverse = ~client_shuffle_permutation_ephemeral_key_a + + + # Client Shuffle (Permutation) Key B Applied = Client Shuffle (Permutation) Ephemeral Key B << Client Shuffle (Permutation) Key B (remove B) + client_shuffle_permutation_key_b_applied = client_shuffle_permutation_ephemeral_key_a_inverse << client_shuffle_permutation_key_b + + # Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch = Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied + outer_server_mutual_shuffle_permutation_function_key_scratch = outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied + + # Client Shuffle (Permutation) Key B Scratch = Client Shuffle (Permutation) Key B Applied < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch + client_shuffle_permutation_key_b_scratch = client_shuffle_permutation_key_b_applied < outer_server_mutual_shuffle_permutation_function_key_scratch + + # Client Shuffle (Permutation) Key X Scratch 2 = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch + client_shuffle_permutation_key_x_scratch_2 = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_key_scratch + + # line 144 + # Outer Function Function Key Scratch = Outer (Mutual) Function Function Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied + outer_function_function_key_scratch = outer_mutual_function_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied + + # Inner (Mutual) Function Key Client Scratch = Inner (Mutual) Function Applied Key < Outer Function Function Key Scratch + inner_mutual_function_key_client_scratch = inner_mutual_function_applied_key < outer_function_function_key_scratch + + # line 147 + # (Mutual) Function Key Scratch 2 = Inner (Mutual) Function Key Client Scratch << client_shuffle_permutation_key_x_scratch_2 + mutual_function_key_scratch_2 = inner_mutual_function_key_client_scratch << client_shuffle_permutation_key_x_scratch_2 + + # Outer (Mutual) Function Key Scratch = Outer (Mutual) Function Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied + outer_mutual_function_key_scratch = outer_mutual_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied + + # Client (Substitution) Key B Scratch = Client (Substitution) Key < Outer (Mutual) Function Key Scratch + client_substitution_key_b_scratch = client_substitution_key < outer_mutual_function_key_scratch + + # Client (Substitution) Ephemeral Key B Scratch = Client (Substitution) Ephemeral Key < Outer (Mutual) Function Key Scratch + client_substitution_ephemeral_key_b_scratch = client_substitution_ephemeral_key < outer_mutual_function_key_scratch + + + # Shared (Mutual) (Substitution) Ephemeral Key Client Scratch = Shared (Mutual) (Substitution) Ephemeral Key < Outer (Mutual) Function Key Scratch + shared_mutual_substitution_ephemeral_key_client_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_key_scratch + + # Shared (Mutual) (Substitution) Ephemeral Key Client Scratch + # DARC Message Data TODO: unsure how to compute this + + # DARC Message Data Check = DARC Message Data < Alphabet Input Sequence Scratch + + # line 175 + """ Server Rx (Phase 4) """ + + """ + Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2) + =BITXOR( + Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) + BITXOR( + Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2) + BITXOR( + Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) + BITXOR( + BN216, # Alphabet Scratch 2 + Server (Substitution) Key Scratch << Inner Function Key Scratch 2 + HLOOKUP( + BN184, # Inner Function Key Scratch 2 + INDIRECT(ADDRESS(@CELL("row", $BD$5), @CELL("col", BN$5) - BN$5) & ":" & ADDRESS(@CELL("row", $BB$242), @CELL("col", BN$5) - BN$5 + $E$2 - 1)), + ROW($BB197) - ROW($BD$5) + 1, # Server (Substitution) Key Scratch + FALSE + ) + ), + Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2 + HLOOKUP( + BN184, # Inner Function Key Scratch 2 + INDIRECT(ADDRESS(@CELL("row", $BD$5), @CELL("col", BN$5) - BN$5) & ":" & ADDRESS(@CELL("row", $BB$242), @CELL("col", BN$5) - BN$5 + $E$2 - 1)), + ROW($BB201) - ROW($BD$5) + 1, # Server (Substitution) Ephemeral Key Scratch + FALSE + ) + ), + (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) + HLOOKUP( + BN184, # Inner Function Key Scratch 2 + INDIRECT(ADDRESS(@CELL("row", $BD$5), @CELL("col", BN$5) - BN$5) & ":" & ADDRESS(@CELL("row", $BB$242), @CELL("col", BN$5) - BN$5 + $E$2 - 1)), + ROW($BB202) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Key Scratch + FALSE + ) + ), + (Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2) + HLOOKUP( + BN184, # Inner Function Key Scratch 2 + INDIRECT(ADDRESS(@CELL("row", $BD$5), @CELL("col", BN$5) - BN$5) & ":" & ADDRESS(@CELL("row", $BB$242), @CELL("col", BN$5) - BN$5 + $E$2 - 1)), + ROW($BB203) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Ephemeral Key Server Scratch + FALSE + ) + ) + + """ + + # Translation (Substitution) = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2) + translation_substitution = alphabet_scratch_2 ^ (server_substitution_key_scratch << inner_function_key_scratch_2) ^ (server_substitution_ephemeral_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2) + + """ Final """ + + """ Server Tx (Phase 1) """ + # Outer Shuffle (Permutation) = Alphabet Values << Outer Server Shuffle (Permutation) Ephemeral Key Applied + outer_shuffle_permutation = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied + + # Inner Shuffle (Permutation) = Outer Shuffle (Permutation) << Outer Server Shuffle (Permutation) Key Applied + inner_shuffle_permutation = outer_shuffle_permutation << outer_server_shuffle_permutation_key_applied + + """ + # Inner Shuffle (Permutation) ^ (Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch 2 << Inner (Mutual) Function Key Scratch) + =BITXOR( + # Inner Shuffle (Permutation) ^ (Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) + BITXOR( + # Inner Shuffle (Permutation) + @INDIRECT( + ADDRESS( + ROW(BN225), + COLUMN(BN225), + 4, + 1 + ) + ), + # Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch + HLOOKUP( + BN107, # Inner (Mutual) Function Key Scratch + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + @ROW($BB103) - ROW($BD$5) + 1, # Server (Substitution) Ephemeral Key Scratch + FALSE + ) + ), + # Server (Substitution) Key Scratch 2 << Inner (Mutual) Function Key Scratch + HLOOKUP( + BN107, # Inner (Mutual) Function Key Scratch + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + @ROW($BB104) - ROW($BD$5) + 1, # Server (Substitution) Key Scratch 2 + FALSE + ) + ) + """ + # Translation (Substitution) = Inner Shuffle (Permutation) ^ (Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch 2 << Inner (Mutual) Function Key Scratch) + translation_substitution = inner_shuffle_permutation ^ (server_substitution_ephemeral_key_scratch << inner_mutual_function_key_scratch) ^ (server_substitution_key_scratch_2 << inner_mutual_function_key_scratch) + + """ Client Rx (Phase 2) """ + """ + # Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch) + =BITXOR( + # Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch) + BITXOR( + # Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) + BITXOR( + BN226, # Translation (Substitution) + # Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch + HLOOKUP( + BN111, # Inner (Mutual) Function Key Scratch + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB115) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Key Scratch + FALSE + ) + ), + # Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch + HLOOKUP( + BN111, # Inner (Mutual) Function Key Scratch + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB113) - ROW($BD$5) + 1, # Client (Substitution) Key A Scratch + FALSE + ) + ), + Client (Substitution) Ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch + HLOOKUP( + BN111, # Inner (Mutual) Function Key Scratch + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB114) - ROW($BD$5) + 1, # Client (Substitution) Ephemeral Key A Scratch + FALSE + ) + ) + + """ + # Translation (Substitution) - Client Data = Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch) + translation_substitution_client_data = translation_substitution ^ (shared_mutual_substitution_key_scratch << inner_mutual_function_key_scratch) ^ (client_substitution_key_a_scratch << inner_mutual_function_key_scratch) ^ (client_substitution_ephemeral_key_a_scratch << inner_mutual_function_key_scratch) + + # Inner Shuffle (Permutation) - CSKA+CSEKA = Translation (Substitution) - Client Data << Client Shuffle (Permutation) Key A Scratch (remove A) + inner_shuffle_permutation_cska_cseka = translation_substitution_client_data << client_shuffle_permutation_key_a_scratch + + # Outer Shuffle (Permutation) - Client Rest = Inner Shuffle (Permutation) - CSKA+CSEKA << Outer Client Shuffle (Permutation) Function Key Applied + outer_shuffle_permutation_client_rest = inner_shuffle_permutation_cska_cseka < outer_client_shuffle_permutation_function_key_applied + """ Client Tx (Phase 3) """ + # Inner Shuffle (Permutation) - CSEKB +CSKB = Outer Shuffle (Permutation) - Client Rest << Client Shuffle (Permutation) Key B Scratch + inner_shuffle_permutation_csekb_cskb = outer_shuffle_permutation_client_rest << client_shuffle_permutation_key_b_scratch + + """ + # Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Client (Substitution) Ephemeral Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2) + =BITXOR( + # Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Client (Substitution) Ephemeral Key B Scratch << (Mutual) Function Key Scratch 2) + BITXOR( + # Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2) + BITXOR( + BN230, # Inner Shuffle (Permutation) - CSEKB +CSKB + # Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2 + HLOOKUP( + BN147, # (Mutual) Function Key Scratch 2 + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB150) - ROW($BD$5) + 1, # Client (Substitution) Key B Scratch + FALSE + ) + ), + # Client (Substitution) Ephemeral Key B Scratch << (Mutual) Function Key Scratch 2 + HLOOKUP( + BN147, # (Mutual) Function Key Scratch 2 + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB151) - ROW($BD$5) + 1, # Client (Substitution) Ephemeral Key B Scratch + FALSE + ) + ), + # Shared (Mutual) (Substitution) Ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2 + HLOOKUP( + BN147, # (Mutual) Function Key Scratch 2 + INDIRECT( + ADDRESS( + @CELL("row", $BD$5), + @CELL("col", BN$5) - BN$5 + ) & ":" & ADDRESS( + @CELL("row", $BB$242), + @CELL("col", BN$5) - BN$5 + $E$2 - 1 + ) + ), + ROW($BB152) - ROW($BD$5) + 1, # Shared (Mutual) (Substitution) Ephemeral Key Client Scratch + FALSE + ) + ) + """ + # Translation (Substitution) DARC Data = Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Client (Substitution) Ephemeral Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2) + translation_substitution_darc_data = inner_shuffle_permutation_csekb_cskb ^ (client_substitution_key_b_scratch << mutual_function_key_scratch_2) ^ (client_substitution_ephemeral_key_b_scratch << mutual_function_key_scratch_2) ^ (shared_mutual_substitution_ephemeral_key_client_scratch << mutual_function_key_scratch_2) + a = 1 + """ Server Rx (Phase 4) """ + + """ Server Rx (Phase 4) """ + + a = 1 diff --git a/src/mimick_excel_cleaned.py b/src/mimick_excel_cleaned.py new file mode 100644 index 0000000..9725c83 --- /dev/null +++ b/src/mimick_excel_cleaned.py @@ -0,0 +1,487 @@ +from src.models import DarcKey, DarcKeyTypes + + +if __name__ == "__main__": + height = 10 + width = 7 + + # B_o_m + # 2 Outer (Mutual) (Substitution) Function Key + outer_mutual_substitution_function_key = DarcKey(matrix=[['9', '7', '4', '2', '5', '3', '0', '6', '1', '8']], key_type=DarcKeyTypes.outer_shuffle) + + # 3 Outer (Mutual) (Substitution) Function Function Key + outer_mutual_substitution_function_function_key = DarcKey(matrix=[['8', '1', '4', '5', '2', '3', '7', '6', '0', '9']], key_type=DarcKeyTypes.outer_shuffle) + # 4 Outer Server (Mutual) Shuffle (Permutation) Function Key + outer_mutual_shuffle_permutation_function_key = DarcKey(matrix=[['3', '9', '2', '5', '0', '7', '6', '8', '1', '4']], key_type=DarcKeyTypes.outer_shuffle) + # 5 Outer Client Shuffle (Permutation) Key + outer_client_shuffle_permutation_key = DarcKey(matrix=[['6', '4', '7', '8', '0', '2', '1', '9', '5', '3']], key_type=DarcKeyTypes.outer_shuffle) + # 6 Outer Client Shuffle (Permutation) Function Key + outer_client_shuffle_permutation_function_key = DarcKey(matrix=[['4', '2', '1', '0', '5', '7', '8', '9', '3', '6']], key_type=DarcKeyTypes.outer_shuffle) + # 7 Outer Server Shuffle (Permutation) Key + outer_server_shuffle_permutation_key = DarcKey(matrix=[['4', '9', '6', '0', '7', '5', '3', '1', '2', '8']], key_type=DarcKeyTypes.outer_shuffle) + + # 15 Outer (Mutual) (Substitution) Function Ephemeral Key + outer_mutual_substitution_function_ephemeral_key = DarcKey(matrix=[ + ['0', '9', '6', '2', '1', '5', '3', '8', '7', '4'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # 16 Outer (Mutual) (Substitution) Function Function Ephemeral Key + outer_mutual_substitution_function_function_ephemeral_key = DarcKey(matrix=[ + ['2', '3', '9', '7', '6', '0', '1', '4', '8', '5'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # 17 Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key + outer_server_mutual_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[ + ['0', '8', '5', '9', '7', '3', '1', '4', '6', '2'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # 18 Outer Client Shuffle (Permutation) Ephemeral Key + outer_client_shuffle_permutation_ephemeral_key = DarcKey(matrix=[ + ['1', '4', '2', '9', '5', '7', '8', '3', '0', '6'] + + ], key_type=DarcKeyTypes.outer_shuffle) + # 19 Outer Client Shuffle (Permutation) Function Ephemeral Key + outer_client_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[ + ['4', '3', '2', '5', '1', '6', '7', '8', '0', '9'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # 20 Outer Server Shuffle (Permutation) Ephemeral Key + outer_server_shuffle_permutation_ephemeral_key = DarcKey(matrix=[ + ['7', '5', '2', '1', '8', '4', '3', '6', '9', '0'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # 29 Alphabet Input Sequence the message + alphabet_input_sequence = DarcKey(matrix=[ + ['0', '2', '4', '6', '8', '1', '3', '5', '7', '9'] + ], key_type=DarcKeyTypes.outer_shuffle) + + # 1 Alphabet Values + alphabet_values = DarcKey(matrix=[ + ['10', '28', '38', '41', '51', '64', '70'], + ['15', '25', '33', '48', '56', '69', '71'], + ['13', '22', '36', '47', '54', '60', '72'], + ['12', '24', '31', '43', '58', '63', '73'], + ['11', '21', '39', '49', '53', '65', '74'], + ['18', '20', '32', '45', '52', '61', '75'], + ['14', '29', '37', '44', '57', '68', '76'], + ['19', '23', '34', '40', '59', '62', '77'], + ['17', '27', '35', '42', '55', '67', '78'], + ['16', '26', '30', '46', '50', '66', '79'] + ], key_type=DarcKeyTypes.alphabet) + + # 8 (Mutual) (Substitution) Function Key + mutual_substitution_function_key = DarcKey(matrix=[ + ['1', '5', '0', '2', '3', '6', '4'], + ['5', '2', '6', '4', '1', '3', '0'], + ['4', '2', '3', '5', '6', '1', '0'], + ['0', '3', '1', '6', '5', '2', '4'], + ['4', '1', '3', '0', '6', '5', '2'], + ['6', '3', '4', '2', '5', '1', '0'], + ['2', '3', '0', '4', '1', '6', '5'], + ['4', '0', '6', '5', '2', '3', '1'], + ['3', '2', '4', '1', '0', '5', '6'], + ['2', '3', '4', '1', '5', '0', '6'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # 9 Client Shuffle (Permutation) Key X + client_shuffle_permutation_key_x = DarcKey(matrix=[ + ['6', '3', '1', '4', '5', '0', '2'], + ['6', '5', '0', '2', '3', '4', '1'], + ['1', '4', '0', '6', '3', '2', '5'], + ['6', '1', '4', '5', '3', '2', '0'], + ['2', '0', '1', '4', '3', '5', '6'], + ['3', '0', '6', '2', '1', '4', '5'], + ['3', '2', '0', '1', '6', '4', '5'], + ['6', '2', '3', '0', '1', '5', '4'], + ['3', '0', '6', '5', '4', '1', '2'], + ['3', '2', '5', '0', '4', '1', '6'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # 10 Client Shuffle (Permutation) Key A (remove A) + client_shuffle_permutation_key_a = DarcKey(matrix=[ + ['6', '0', '3', '5', '2', '1', '4'], + ['4', '3', '2', '5', '0', '1', '6'], + ['5', '4', '1', '0', '2', '3', '6'], + ['3', '6', '1', '4', '5', '2', '0'], + ['3', '5', '4', '2', '0', '1', '6'], + ['6', '1', '5', '4', '2', '3', '0'], + ['0', '4', '6', '3', '5', '1', '2'], + ['0', '6', '4', '3', '1', '2', '5'], + ['5', '0', '6', '3', '4', '1', '2'], + ['3', '2', '0', '4', '1', '6', '5'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # 11 Server Shuffle (Permutation) Key + server_shuffle_permutation_key = DarcKey(matrix=[ + ['5', '2', '3', '0', '6', '4', '1'], + ['5', '2', '6', '3', '0', '1', '4'], + ['1', '3', '5', '0', '2', '6', '4'], + ['6', '2', '1', '4', '5', '0', '3'], + ['2', '3', '4', '1', '5', '6', '0'], + ['3', '2', '0', '1', '5', '4', '6'], + ['2', '6', '0', '3', '4', '1', '5'], + ['3', '0', '4', '6', '2', '5', '1'], + ['5', '3', '2', '0', '6', '4', '1'], + ['1', '4', '5', '3', '2', '6', '0'] + ], key_type=DarcKeyTypes.inner_shuffle) + + + + # 21 (Mutual) (Substitution) Function Ephemeral Key + mutual_substitution_function_ephemeral_key = DarcKey(matrix=[ + ['6', '0', '1', '4', '2', '3', '5'], + ['2', '3', '6', '4', '0', '1', '5'], + ['2', '4', '0', '3', '6', '1', '5'], + ['0', '4', '2', '3', '1', '5', '6'], + ['6', '4', '2', '5', '1', '0', '3'], + ['5', '1', '0', '6', '4', '2', '3'], + ['1', '2', '4', '3', '6', '0', '5'], + ['6', '1', '4', '0', '5', '3', '2'], + ['2', '3', '5', '4', '6', '0', '1'], + ['1', '6', '4', '3', '5', '2', '0'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # 22 Client Shuffle (Permutation) Ephemeral Key A (remove A) + client_shuffle_permutation_ephemeral_key_a = DarcKey(matrix=[ + ['5', '0', '4', '3', '2', '6', '1'], + ['0', '6', '2', '1', '5', '3', '4'], + ['1', '2', '0', '3', '5', '4', '6'], + ['0', '2', '6', '3', '4', '5', '1'], + ['5', '1', '2', '0', '3', '4', '6'], + ['1', '0', '3', '4', '5', '6', '2'], + ['3', '0', '5', '2', '6', '4', '1'], + ['6', '4', '5', '3', '0', '2', '1'], + ['2', '4', '6', '0', '3', '5', '1'], + ['4', '6', '2', '3', '5', '1', '0'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # 23 Server Shuffle (Permutation) Ephemeral Key 1 (remove 1) + server_shuffle_permutation_ephemeral_key_1 = DarcKey(matrix=[ + ['6', '1', '3', '0', '4', '2', '5'], + ['3', '2', '1', '0', '4', '5', '6'], + ['2', '4', '3', '5', '0', '6', '1'], + ['4', '1', '3', '6', '0', '2', '5'], + ['1', '4', '2', '3', '0', '5', '6'], + ['6', '4', '5', '0', '2', '3', '1'], + ['0', '4', '2', '3', '1', '5', '6'], + ['0', '6', '3', '5', '1', '2', '4'], + ['2', '6', '3', '1', '4', '5', '0'], + ['5', '0', '4', '1', '6', '3', '2'] + ], key_type=DarcKeyTypes.inner_shuffle) + + # 12 Shared (Mutual) (Substitution) Component 1 + shared_mutual_substitution_component_1 = DarcKey(matrix=[ + ['81', '150', '209', '32', '246', '219', '15'], + ['100', '15', '50', '179', '52', '1', '142'], + ['98', '34', '170', '6', '195', '115', '117'], + ['205', '169', '12', '151', '139', '91', '114'], + ['192', '153', '175', '62', '249', '230', '103'], + ['56', '54', '44', '107', '125', '122', '219'], + ['28', '16', '32', '27', '95', '248', '200'], + ['152', '121', '40', '198', '19', '55', '59'], + ['189', '227', '175', '102', '171', '135', '170'], + ['182', '144', '202', '64', '253', '89', '196'] + ], key_type=DarcKeyTypes.alphabet) + + + # 13 Client (Substitution) Key + client_substitution_key = DarcKey(matrix=[ + ['148', '232', '147', '96', '20', '201', '150'], + ['120', '0', '158', '250', '176', '223', '82'], + ['12', '81', '193', '212', '247', '100', '1'], + ['127', '211', '164', '202', '25', '149', '34'], + ['214', '38', '10', '197', '195', '97', '193'], + ['177', '120', '199', '180', '206', '184', '155'], + ['154', '146', '186', '205', '190', '47', '169'], + ['164', '80', '233', '207', '214', '91', '108'], + ['123', '101', '231', '244', '92', '88', '12'], + ['222', '193', '85', '98', '224', '145', '0'] + ], key_type=DarcKeyTypes.alphabet) + + # 14 Server (Substitution) Key + server_substitution_key = DarcKey(matrix=[ + ['163', '247', '59', '226', '186', '179', '35'], + ['140', '180', '54', '88', '40', '252', '97'], + ['229', '247', '16', '206', '186', '125', '81'], + ['221', '222', '54', '22', '190', '18', '122'], + ['126', '130', '83', '142', '152', '238', '237'], + ['76', '168', '77', '176', '198', '119', '104'], + ['121', '96', '80', '75', '138', '219', '122'], + ['92', '210', '20', '56', '232', '219', '245'], + ['111', '1', '155', '236', '15', '184', '0'], + ['36', '31', '143', '5', '112', '206', '106'] + ], + key_type=DarcKeyTypes.alphabet + ) + + # 24 Server (Substitution) Ephemeral Unique Component Function + server_substitution_ephemeral_unique_component_function = 5 + + # 25 Shared (Mutual) (Substitution) Ephemeral Key + shared_mutual_substitution_ephemeral_key = DarcKey(matrix=[ + ['106', '113', '9', '54', '49', '4', '207'], + ['184', '3', '232', '179', '15', '113', '142'], + ['129', '44', '164', '54', '1', '32', '201'], + ['106', '50', '246', '140', '149', '179', '109'], + ['210', '11', '69', '193', '77', '245', '62'], + ['37', '76', '137', '24', '220', '30', '165'], + ['40', '57', '147', '225', '24', '176', '103'], + ['37', '212', '189', '203', '218', '138', '168'], + ['73', '227', '38', '164', '20', '239', '24'], + ['7', '194', '254', '76', '0', '244', '215'] + ], key_type=DarcKeyTypes.alphabet) + + # 26 Client (Substitution) Ephemeral Key + client_substitution_ephemeral_key = DarcKey(matrix=[ + ['21', '149', '75', '73', '228', '81', '79'], + ['41', '189', '80', '209', '45', '101', '53'], + ['139', '238', '141', '159', '30', '79', '214'], + ['239', '234', '72', '75', '80', '190', '124'], + ['203', '225', '246', '200', '205', '195', '92'], + ['201', '185', '113', '101', '176', '216', '106'], + ['14', '210', '125', '70', '53', '128', '57'], + ['115', '27', '97', '39', '199', '26', '104'], + ['29', '4', '55', '5', '13', '57', '19'], + ['158', '184', '137', '0', '221', '12', '217'] + ], key_type=DarcKeyTypes.alphabet) + + # 27 Server (Substitution) Ephemeral Random Component + server_substitution_ephemeral_random_component = DarcKey(matrix=[ + ['191', '50', '229', '60', '201', '64', '45'], + ['31', '88', '90', '8', '153', '6', '228'], + ['117', '63', '38', '90', '236', '207', '254'], + ['64', '219', '36', '3', '119', '205', '171'], + ['172', '138', '153', '52', '161', '137', '216'], + ['49', '150', '210', '129', '174', '190', '54'], + ['81', '230', '135', '200', '218', '31', '52'], + ['128', '253', '177', '220', '1', '83', '3'], + ['204', '199', '43', '50', '148', '215', '6'], + ['79', '124', '128', '30', '74', '242', '85'] + ], key_type=DarcKeyTypes.alphabet) + + # 28 Server (Substitution) Ephemeral Unique Component + server_substitution_ephemeral_unique_component = DarcKey(matrix=[ + ['7', '190', '58', '75', '135', '15', '214', '149', '244', '224'] + ], key_type=DarcKeyTypes.alphabet) + + # 30 Shared (Mutual) (Substitution) Key + shared_mutual_substitution_key = shared_mutual_substitution_component_1 ^ client_substitution_key + + # 31 Outer (Mutual) Function Function Ephemeral Key Applied = Outer (Mutual) (Substitution) Function Function Key << Outer (Mutual) (Substitution) Function Function Ephemeral Key + outer_mutual_function_function_ephemeral_key_applied = outer_mutual_substitution_function_function_key << outer_mutual_substitution_function_function_ephemeral_key + + # 32 Inner (Mutual) Function Applied Key = (Mutual) (Substitution) Function Key << (Mutual) (Substitution) Function Ephemeral Key + inner_mutual_function_applied_key = mutual_substitution_function_key << mutual_substitution_function_ephemeral_key + + # 33 Inner (Mutual) Function Key Scratch = Inner (Mutual) Function Applied Key << Outer (Mutual) Function Function Ephemeral Key Applied + inner_mutual_function_key_scratch = inner_mutual_function_applied_key < outer_mutual_function_function_ephemeral_key_applied + + # 34 Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied = Outer Server (Mutual) Shuffle (Permutation) Function Key << Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key + outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied = outer_mutual_shuffle_permutation_function_key << outer_server_mutual_shuffle_permutation_function_ephemeral_key + + # 35 Client Shuffle (Permutation) Key X Scratch = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + client_shuffle_permutation_key_x_scratch = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # 36 Inner Function Key Scratch 2 = Inner (Mutual) Function Key Scratch << Client Shuffle (Permutation) Key X Scratch + inner_function_key_scratch_2 = inner_mutual_function_key_scratch << client_shuffle_permutation_key_x_scratch + + # 37 Outer (Mutual) Function Ephemeral Key Applied = Outer (Mutual) (Substitution) Function Key < Outer (Mutual) (Substitution) Function Ephemeral Key + outer_mutual_function_ephemeral_key_applied = outer_mutual_substitution_function_key << outer_mutual_substitution_function_ephemeral_key + + # 38 Server (Substitution) Key Scratch = Server (Substitution) Key < Outer (Mutual) Function Ephemeral Key Applied + server_substitution_key_scratch = server_substitution_key < outer_mutual_function_ephemeral_key_applied + + # 39 Shared (Mutual) (Substitution) Key Scratch = Shared (Mutual) (Substitution) Key < Outer (Mutual) Function Ephemeral Key Applied + shared_mutual_substitution_key_scratch = shared_mutual_substitution_key < outer_mutual_function_ephemeral_key_applied + + # 40 Shared (Mutual) (Substitution) Ephemeral Key Server Scratch = Shared (Mutual) (Substitution) Ephemeral Key < Outer (Mutual) Function Ephemeral Key Applied + shared_mutual_substitution_ephemeral_key_server_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied + + # line 78 + # 41 Server Client Shuffle (Permutation) = Server Shuffle (Permutation) Key << Client Shuffle (Permutation) Key X + server_client_shuffle_permutation = server_shuffle_permutation_key << client_shuffle_permutation_key_x + + # 42 Server Client Shuffle (Permutation) Inverse + server_client_shuffle_permutation_inverse = ~server_client_shuffle_permutation + + # 43 Server Shuffle (Permutation) Ephemeral Key 1 Inverse (remove 1) = ~(Server Shuffle (Permutation) Ephemeral Key 1 (remove 1)) + server_shuffle_permutation_ephemeral_key_1_inverse = ~server_shuffle_permutation_ephemeral_key_1 + + # 44 Server Shuffle (Permutation) Ephemeral Key Applied = Server Client Shuffle (Permutation) Inverse < Server Shuffle (Permutation) Ephemeral Key 1 Inverse (remove 1) + server_shuffle_permutation_ephemeral_key_applied = server_client_shuffle_permutation_inverse << server_shuffle_permutation_ephemeral_key_1_inverse + + # line 82 + # 45 Server Shuffle (Permutation) Ephemeral Key Applied Scratch = Server Shuffle (Permutation) Ephemeral Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + server_shuffle_permutation_ephemeral_key_applied_scratch = server_shuffle_permutation_ephemeral_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # 46 Server Shuffle (Permutation) Ephemeral Key Applied Scratch Inverse = ~Server Shuffle (Permutation) Ephemeral Key Applied Scratch + server_shuffle_permutation_ephemeral_key_applied_scratch_inverse = ~server_shuffle_permutation_ephemeral_key_applied_scratch + + # 47 Outer Server Shuffle (Permutation) Ephemeral Key Applied = Outer Server Shuffle (Permutation) Key < Outer Server Shuffle (Permutation) Ephemeral Key + outer_server_shuffle_permutation_ephemeral_key_applied = outer_server_shuffle_permutation_key << outer_server_shuffle_permutation_ephemeral_key + + # 48 Alphabet Scratch 1 = Alphabet Values < Outer Server Shuffle (Permutation) Ephemeral Key Applied + alphabet_scratch_1 = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied + + # 49 Alphabet Scratch 2 = Alphabet Scratch 1 << Server Shuffle (Permutation) Ephemeral Key Applied Scratch Inverse + alphabet_scratch_2 = alphabet_scratch_1 << server_shuffle_permutation_ephemeral_key_applied_scratch_inverse + + # 50 Server (Substitution) Ephemeral Component Scratch 1 = Server (Substitution) Ephemeral Random Component.column_substitution( Server (Substitution) Ephemeral Unique Component Function ,Server (Substitution) Ephemeral Unique Component) + server_substitution_ephemeral_component_scratch_1 = server_substitution_ephemeral_random_component.column_substitution( + server_substitution_ephemeral_unique_component_function, + server_substitution_ephemeral_unique_component.matrix[0] + ) + + # 51 Server (Substitution) Ephemeral Component Scratch 2 = Server (Substitution) Ephemeral Component Scratch 1 < Outer (Mutual) Function Ephemeral Key Applied + server_substitution_ephemeral_component_scratch_2 = server_substitution_ephemeral_component_scratch_1 < outer_mutual_function_ephemeral_key_applied + + # 52 Server (Substitution) Ephemeral Component Scratch 3 = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Component Scratch 2 << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2) + server_substitution_ephemeral_component_scratch_3 = alphabet_scratch_2 ^ (server_substitution_key_scratch << inner_function_key_scratch_2) ^ (server_substitution_ephemeral_component_scratch_2 << inner_function_key_scratch_2) ^ (shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2) + + # 52 Inner Function Key Scratch 2 Inverse = ~Inner Function Key Scratch 2 + inner_function_key_scratch_2_inverse = ~inner_function_key_scratch_2 + + # 54 Server (Substitution) Ephemeral Key Scratch = Server (Substitution) Ephemeral Component Scratch 3 << Inner Function Key Scratch 2 Inverse + server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_component_scratch_3 << inner_function_key_scratch_2_inverse + + # 55 Outer (Mutual) Function Ephemeral Key Applied Inverse = ~Outer (Mutual) Function Ephemeral Key Applied + outer_mutual_function_ephemeral_key_applied_inverse = ~outer_mutual_function_ephemeral_key_applied + + # 56 Server (Substitution) Ephemeral Key = Server (Substitution) Ephemeral Key Scratch < Outer (Mutual) Function Ephemeral Key Applied Inverse + server_substitution_ephemeral_key = server_substitution_ephemeral_key_scratch < outer_mutual_function_ephemeral_key_applied_inverse + + # line 94 + """ Server Tx (Phase 1) """ + + # 57 Inner Server Shuffle (Permutation) Key Applied = Server Shuffle (Permutation) Ephemeral Key 1 (remove 1) << Server Shuffle (Permutation) Key + inner_server_shuffle_permutation_key_applied = server_shuffle_permutation_ephemeral_key_1 << server_shuffle_permutation_key + + # 58 Outer Server Shuffle (Permutation) Key Applied = Inner Server Shuffle (Permutation) Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + outer_server_shuffle_permutation_key_applied = inner_server_shuffle_permutation_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # 59 Server (Substitution) Ephemeral Key Scratch = Server (Substitution) Ephemeral Key < Outer (Mutual) Function Ephemeral Key Applied + server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied + + # 86 Outer Shuffle (Permutation) = Alphabet Values << Outer Server Shuffle (Permutation) Ephemeral Key Applied + #outer_shuffle_permutation = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied + + ## 87 Inner Shuffle (Permutation) = Outer Shuffle (Permutation) << Outer Server Shuffle (Permutation) Key Applied + #inner_shuffle_permutation = outer_shuffle_permutation << outer_server_shuffle_permutation_key_applied + + ## 88 Translation (Substitution) = Inner Shuffle (Permutation) ^ (Server (Substitution) Ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) + #translation_substitution = inner_shuffle_permutation ^ ( + # server_substitution_ephemeral_key_scratch << inner_mutual_function_key_scratch) ^ ( + # server_substitution_key_scratch << inner_mutual_function_key_scratch) + + # line 108 + """ Client Rx (Phase 2) """ + + # 62 Client (Substitution) Key A Scratch = Client (Substitution) Key < Outer (Mutual) Function Ephemeral Key Applied + client_substitution_key_a_scratch = client_substitution_key < outer_mutual_function_ephemeral_key_applied + + # 63 Client (Substitution) Ephemeral Key A Scratch = Client (Substitution) Ephemeral Key < Outer (Mutual) Function Ephemeral Key Applied + client_substitution_ephemeral_key_a_scratch = client_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied + + # 64 Client Shuffle (Permutation) Key A Applied (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) << Client Shuffle (Permutation) Ephemeral Key A (remove A) + client_shuffle_permutation_key_a_applied = client_shuffle_permutation_key_a << client_shuffle_permutation_ephemeral_key_a + + # 65 Client Shuffle (Permutation) Key A Scratch (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) < Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied + client_shuffle_permutation_key_a_scratch = client_shuffle_permutation_key_a_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied + + # 66 Outer Client Shuffle (Permutation) Ephemeral Key Applied = Outer Client Shuffle (Permutation) Key << Outer Client Shuffle (Permutation) Ephemeral Key + outer_client_shuffle_permutation_ephemeral_key_applied = outer_client_shuffle_permutation_key << outer_client_shuffle_permutation_ephemeral_key + + # 67 Outer Client Shuffle (Permutation) Function Ephemeral Key Applied = Outer Client Shuffle (Permutation) Function Key << Outer Client Shuffle (Permutation) Function Ephemeral Key + outer_client_shuffle_permutation_function_ephemeral_key_applied = outer_client_shuffle_permutation_function_key << outer_client_shuffle_permutation_function_ephemeral_key + + # 68 Outer Client Shuffle (Permutation) Function Key Applied = Outer Client Shuffle (Permutation) Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Ephemeral Key Applied + outer_client_shuffle_permutation_function_key_applied = outer_client_shuffle_permutation_ephemeral_key_applied << outer_client_shuffle_permutation_function_ephemeral_key_applied + + # 69 Outer Client Shuffle (Permutation) Function Key Applied Inverse = ~Outer Client Shuffle (Permutation) Function Key Applied + outer_client_shuffle_permutation_function_key_applied_inverse = ~outer_client_shuffle_permutation_function_key_applied + + # 70 Alphabet Input Sequence Scratch = Outer Client Shuffle (Permutation) Function Key Applied Inverse << Alphabet Input Sequence + alphabet_input_sequence_scratch = outer_client_shuffle_permutation_function_key_applied_inverse << alphabet_input_sequence + + # 89 Translation (Substitution) - Client Data = Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch) + #translation_substitution_client_data = translation_substitution ^ ( + # shared_mutual_substitution_key_scratch << inner_mutual_function_key_scratch) ^ ( + # client_substitution_key_a_scratch << inner_mutual_function_key_scratch) ^ ( + # client_substitution_ephemeral_key_a_scratch << inner_mutual_function_key_scratch) + + ## 90 Inner Shuffle (Permutation) - CSKA+CSEKA = Translation (Substitution) - Client Data << Client Shuffle (Permutation) Key A Scratch (remove A) + #inner_shuffle_permutation_cska_cseka = translation_substitution_client_data << client_shuffle_permutation_key_a_scratch + + ## 91 Outer Shuffle (Permutation) - Client Rest = Inner Shuffle (Permutation) - CSKA+CSEKA << Outer Client Shuffle (Permutation) Function Key Applied + #outer_shuffle_permutation_client_rest = inner_shuffle_permutation_cska_cseka < outer_client_shuffle_permutation_function_key_applied + + # line 130 + """ Client Tx (Phase 3) """ + + # 71 Client Shuffle (Permutation) Key A Inverse (remove A) = ~Client Shuffle (Permutation) Key A (remove A) + client_shuffle_permutation_key_a_inverse = ~client_shuffle_permutation_key_a + + # 72 Client Shuffle (Permutation) Key B (remove B) = Client Shuffle (Permutation) Key A Inverse (remove A) << Client Shuffle (Permutation) Key X + client_shuffle_permutation_key_b = client_shuffle_permutation_key_a_inverse << client_shuffle_permutation_key_x + + # 73 Client Shuffle (Permutation) Ephemeral Key A (remove A) Inverse = ~Client Shuffle (Permutation) Ephemeral Key A (remove A) + client_shuffle_permutation_ephemeral_key_a_inverse = ~client_shuffle_permutation_ephemeral_key_a + + # 74 Client Shuffle (Permutation) Key B Applied = Client Shuffle (Permutation) Ephemeral Key B << Client Shuffle (Permutation) Key B (remove B) + client_shuffle_permutation_key_b_applied = client_shuffle_permutation_ephemeral_key_a_inverse << client_shuffle_permutation_key_b + + # 75 Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch = Outer Server (Mutual) Shuffle (Permutation) Function Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied + outer_server_mutual_shuffle_permutation_function_key_scratch = outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied + + # 76 Client Shuffle (Permutation) Key B Scratch = Client Shuffle (Permutation) Key B Applied < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch + client_shuffle_permutation_key_b_scratch = client_shuffle_permutation_key_b_applied < outer_server_mutual_shuffle_permutation_function_key_scratch + + # 77 Client Shuffle (Permutation) Key X Scratch 2 = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch + client_shuffle_permutation_key_x_scratch_2 = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_key_scratch + + # line 144 + # 78 Outer Function Function Key Scratch = Outer (Mutual) Function Function Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied + outer_function_function_key_scratch = outer_mutual_function_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied + + # 79 Inner (Mutual) Function Key Client Scratch = Inner (Mutual) Function Applied Key < Outer Function Function Key Scratch + inner_mutual_function_key_client_scratch = inner_mutual_function_applied_key < outer_function_function_key_scratch + + # line 147 + # 80 (Mutual) Function Key Scratch 2 = Inner (Mutual) Function Key Client Scratch << client_shuffle_permutation_key_x_scratch_2 + mutual_function_key_scratch_2 = inner_mutual_function_key_client_scratch << client_shuffle_permutation_key_x_scratch_2 + + # 81 Outer (Mutual) Function Key Scratch = Outer (Mutual) Function Ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied + outer_mutual_function_key_scratch = outer_mutual_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied + + # 82 Client (Substitution) Key B Scratch = Client (Substitution) Key < Outer (Mutual) Function Key Scratch + client_substitution_key_b_scratch = client_substitution_key < outer_mutual_function_key_scratch + + # 83 Client (Substitution) Ephemeral Key B Scratch = Client (Substitution) Ephemeral Key < Outer (Mutual) Function Key Scratch + client_substitution_ephemeral_key_b_scratch = client_substitution_ephemeral_key < outer_mutual_function_key_scratch + + # 84 Shared (Mutual) (Substitution) Ephemeral Key Client Scratch = Shared (Mutual) (Substitution) Ephemeral Key < Outer (Mutual) Function Key Scratch + shared_mutual_substitution_ephemeral_key_client_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_key_scratch + + # 92 Inner Shuffle (Permutation) - CSEKB +CSKB = Outer Shuffle (Permutation) - Client Rest << Client Shuffle (Permutation) Key B Scratch + #inner_shuffle_permutation_csekb_cskb = outer_shuffle_permutation_client_rest << client_shuffle_permutation_key_b_scratch + + ## 93 Translation (Substitution) DARC Data = Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Client (Substitution) Ephemeral Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2) + #translation_substitution_darc_data = inner_shuffle_permutation_csekb_cskb ^ ( + # client_substitution_key_b_scratch << mutual_function_key_scratch_2) ^ ( + # client_substitution_ephemeral_key_b_scratch << mutual_function_key_scratch_2) ^ ( + # shared_mutual_substitution_ephemeral_key_client_scratch << mutual_function_key_scratch_2) + + # line 175 + """ Server Rx (Phase 4) """ + + # 85 Translation (Substitution) = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) Ephemeral Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Ephemeral Key Server Scratch << Inner Function Key Scratch 2) + translation_substitution = ( + alphabet_scratch_2 ^ + (server_substitution_key_scratch << inner_function_key_scratch_2) ^ + (server_substitution_ephemeral_key_scratch << inner_function_key_scratch_2) ^ + (shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^ + (shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2) + ) + + + a = 1 \ No newline at end of file diff --git a/src/models.py b/src/models.py new file mode 100644 index 0000000..f5799f8 --- /dev/null +++ b/src/models.py @@ -0,0 +1,361 @@ +import secrets +from enum import Enum + +from pydantic import BaseModel + + +class DarcKeyTypes(str, Enum): + outer_shuffle = "outer_shuffle" + inner_shuffle = "inner_shuffle" + alphabet = "alphabet" + other = "other" + + +class DarcKey(BaseModel): + matrix: list[list[int]] + key_type: DarcKeyTypes + + @classmethod + def _random_shuffle(cls, array: list[int]) -> list[int]: + for i in range(len(array) - 1, 0, -1): + j = cls._random_number(0, i) + array[i], array[j] = array[j], array[i] + return array + + @classmethod + def _random_mask(cls, array_len: int, max_val: int) -> list[int]: + return [cls._random_number(0, max_val) for _ in range(array_len)] + + @staticmethod + def _random_number(min_val: int, max_val: int) -> int: + """ originally secure_rand """ + return min_val + secrets.randbelow(max_val - min_val + 1) + + def __lshift__(self, other): + assert len(self.matrix) == len(other.matrix) + assert len(self.matrix[0]) == len(other.matrix[0]) + assert other.key_type == DarcKeyTypes.inner_shuffle or other.key_type == DarcKeyTypes.outer_shuffle + output = [] + for i, el in enumerate(self.matrix): + row = [] + for j, el2 in enumerate(el): + other_el = other.matrix[i][j] + row.append(self.matrix[i][other_el]) + output.append(row) + return DarcKey( + matrix=output, + key_type=self.key_type + ) + + def __lt__(self, other): + assert len(other.matrix) == 1 + assert len(self.matrix) == len(other.matrix[0]) + assert other.key_type == DarcKeyTypes.outer_shuffle + output = [] + for i, _ in enumerate(self.matrix): + output.append(self.matrix[other.matrix[0][i]]) + return DarcKey( + matrix=output, + key_type=self.key_type + ) + + def __xor__(self, other): + assert len(self.matrix) == len(other.matrix) + assert len(self.matrix[0]) == len(other.matrix[0]) + assert self.key_type == DarcKeyTypes.alphabet + assert other.key_type == DarcKeyTypes.alphabet + output = [] + for i, el in enumerate(self.matrix): + row = [] + for j, el2 in enumerate(el): + row.append(el2 ^ other.matrix[i][j]) + output.append(row) + return DarcKey( + matrix=output, + key_type=self.key_type + ) + + def __invert__(self): + assert self.key_type == DarcKeyTypes.inner_shuffle or self.key_type == DarcKeyTypes.outer_shuffle + + output = [] + for i, el in enumerate(self.matrix): + row = [(j, el2) for j, el2 in enumerate(el)] + row.sort(key=lambda x: x[1]) + output.append([el2[0] for el2 in row]) + + return DarcKey( + matrix=output, + key_type=self.key_type + ) + + def column_substitution(self, column: int, substitution: list[int]): + assert len(substitution) == len(self.matrix) + assert len(self.matrix[0]) > column >= 0 + output = [] + for i, el in enumerate(self.matrix): + row = [] + for j, el2 in enumerate(el): + if j == column: + row.append(substitution[i]) + else: + row.append(el2) + output.append(row) + return DarcKey( + matrix=output, + key_type=self.key_type + ) + + +class OuterShuffleKey(DarcKey): + key_type = DarcKeyTypes.outer_shuffle + + @classmethod + def init_matrix(cls, row_length: int): + """ originally buildRandom """ + matrix = [cls._random_shuffle(list(range(row_length)))] + return OuterShuffleKey( + matrix=matrix, + ) + + +class InnerShuffleKey(DarcKey): + key_type = DarcKeyTypes.inner_shuffle + + @classmethod + def init_matrix(cls, row_length: int, column_length: int): + """ originally buildRandom """ + matrix = [cls._random_shuffle(list(range(row_length))) for _ in range(column_length)] + return InnerShuffleKey( + matrix=matrix, + ) + + +class AlphabetKey(DarcKey): + key_type = DarcKeyTypes.alphabet + max_value: int = 255 + + @classmethod + def init_matrix(cls, row_length: int, column_length: int, max_value: int): + """ originally buildScramble """ + matrix = [cls._random_mask(row_length, max_value) for _ in range(column_length)] + return AlphabetKey( + matrix=matrix, + max_value=max_value + ) + + +class EphemeralKeys(BaseModel): + serverEphemeralKey: AlphabetKey + sharedEphemeralKey: AlphabetKey + functionEphemeralKey: InnerShuffleKey + outerFunctionEphemeralKey: OuterShuffleKey + outerFunctionFunctionEphemeralKey: OuterShuffleKey + outerServerShuffleFunctionEphemeralKey: OuterShuffleKey + serverShuffleEphemeralKey: InnerShuffleKey + outerServerShuffleEphemeralKey: OuterShuffleKey + serverMediumEphemeralKey: AlphabetKey + sharedMediumEphemeralKey: AlphabetKey + functionMediumEphemeralKey: InnerShuffleKey + positionFunctionMediumEphemeralKey: InnerShuffleKey + outerFunctionMediumEphemeralKey: OuterShuffleKey + outerFunctionFunctionMediumEphemeralKey: OuterShuffleKey + outerPositionFunctionMediumEphemeralKey: OuterShuffleKey + outerServerShuffleFunctionMediumEphemeralKey: OuterShuffleKey + outerServerShuffleMediumEphemeralKey: OuterShuffleKey + outerPositionShuffleMediumEphemeralKey: OuterShuffleKey + interfaceConfig: AlphabetKey + outerClientShuffleKey: OuterShuffleKey + outerClientShuffleMediumKey: OuterShuffleKey + outerClientShuffleFunctionKey: OuterShuffleKey + outerClientShuffleFunctionMediumKey: OuterShuffleKey + clientEphemeral: AlphabetKey + clientEphemeralMedium: AlphabetKey + clientShuffleEphemeralA: InnerShuffleKey + clientShuffleEphemeralMediumA: InnerShuffleKey + + +class PersistentKeys(BaseModel): + serverKey: AlphabetKey + functionKey: InnerShuffleKey + serverShuffleKey: InnerShuffleKey + outerFunctionKey: OuterShuffleKey + outerFunctionFunctionKey: OuterShuffleKey + outerServerShuffleKey: OuterShuffleKey + outerServerShuffleFunctionKey: OuterShuffleKey + clientKey: AlphabetKey + sharedKey: AlphabetKey + clientShuffleKeyX: InnerShuffleKey + clientShuffleKeyA: InnerShuffleKey + functionMediumKey: InnerShuffleKey + clientShuffleMediumKeyX: InnerShuffleKey + inputMediumData: AlphabetKey + serverMediumKey: OuterShuffleKey + outerFunctionMediumKey: OuterShuffleKey + outerFunctionFunctionMediumKey: OuterShuffleKey + outerServerShuffleMediumKey: OuterShuffleKey + outerServerShuffleFunctionMediumKey: OuterShuffleKey + sharedMediumKey: AlphabetKey + outerPositionFunctionMediumKey: OuterShuffleKey + outerPositionShuffleMediumKey: OuterShuffleKey + clientMediumKey: AlphabetKey + positionFunctionMediumKey: InnerShuffleKey + clientShuffleMediumKeyA: InnerShuffleKey + + +class Session(BaseModel): + guid: str + interfaceConfig: AlphabetKey + serverEphemeralKey: AlphabetKey + functionEphemeralKey: InnerShuffleKey + serverShuffleEphemeralKey: InnerShuffleKey + outerServerShuffleEphemeralKey: OuterShuffleKey + outerFunctionEphemeralKey: OuterShuffleKey + outerFunctionFunctionEphemeralKey: OuterShuffleKey + outerServerShuffleFunctionEphemeralKey: OuterShuffleKey + serverMediumEphemeralKey: AlphabetKey + functionMediumEphemeralKey: InnerShuffleKey + outerServerShuffleMediumEphemeralKey: OuterShuffleKey + outerFunctionMediumEphemeralKey: OuterShuffleKey + outerFunctionFunctionMediumEphemeralKey: OuterShuffleKey + outerServerShuffleFunctionMediumEphemeralKey: OuterShuffleKey + positionFunctionMediumEphemeralKey: InnerShuffleKey + outerPositionFunctionMediumEphemeralKey: OuterShuffleKey + sharedEphemeralKey: AlphabetKey + sharedMediumEphemeralKey: AlphabetKey + outerPositionShuffleMediumEphemeralKey: OuterShuffleKey + + +class TxData(BaseModel): + data: AlphabetKey + functionEphemeralKey: InnerShuffleKey + outerServerShuffleEphemeralKey: OuterShuffleKey + outerFunctionFunctionEphemeralKey: OuterShuffleKey + outerFunctionEphemeralKey: OuterShuffleKey + outerServerShuffleFunctionEphemeralKey: OuterShuffleKey + sharedEphemeralKey: AlphabetKey + outerClientShuffleKey: OuterShuffleKey + outerClientShuffleFunctionKey: OuterShuffleKey + clientEphemeral: AlphabetKey + clientShuffleEphemeralA: InnerShuffleKey + clientShuffleEphemeralB: InnerShuffleKey + + +class Medium(BaseModel): + data: AlphabetKey + functionEphemeralKey: InnerShuffleKey + outerServerShuffleEphemeralKey: OuterShuffleKey + outerFunctionFunctionEphemeralKey: OuterShuffleKey + outerFunctionEphemeralKey: OuterShuffleKey + outerServerShuffleFunctionEphemeralKey: OuterShuffleKey + sharedEphemeralKey: AlphabetKey + positionFunctionMediumEphemeralKey: InnerShuffleKey + outerPositionFunctionMediumEphemeralKey: OuterShuffleKey + outerPositionShuffleMediumEphemeralKey: OuterShuffleKey + outerClientShuffleMediumKey: OuterShuffleKey + outerClientShuffleFunctionMediumKey: OuterShuffleKey + clientEphemeralMedium: AlphabetKey + clientShuffleEphemeralMediumA: InnerShuffleKey + clientShuffleEphemeralMediumB: InnerShuffleKey + + +class Phase1Session(BaseModel): + session: Session + tx_data: TxData + medium: Medium + alphabet: list[list[int]] | None = None + + +class ServerPersistentKeys(BaseModel): + OuterFunctionKey: OuterShuffleKey + OuterFunctionFunctionKey: OuterShuffleKey + OuterServerShuffleFunctionKey: OuterShuffleKey + MutualKey: AlphabetKey + FunctionKey: InnerShuffleKey + ClientShuffleKeyX: InnerShuffleKey + + MutualMediumKey: AlphabetKey + OuterFunctionMediumKey: OuterShuffleKey + OuterFunctionFunctionMediumKey: OuterShuffleKey + OuterServerShuffleFunctionMediumKey: OuterShuffleKey + FunctionMediumKey: InnerShuffleKey + ClientShuffleMediumKeyX: InnerShuffleKey + OuterPositionShuffleMediumKey: OuterShuffleKey + OuterPositionShuffleFunctionMediumKey: OuterShuffleKey + OuterPositionFunctionMediumKey: OuterShuffleKey + PositionFunctionMediumKey: InnerShuffleKey + PositionShuffleMediumKey: InnerShuffleKey + + OuterServerShuffleKey: OuterShuffleKey + ServerKey: AlphabetKey + ServerShuffleKey: InnerShuffleKey + + ServerMediumKey: AlphabetKey + + +class ClientPersistentKeys(BaseModel): + OuterFunctionKey: OuterShuffleKey + OuterFunctionFunctionKey: OuterShuffleKey + OuterServerShuffleFunctionKey: OuterShuffleKey + MutualKey: AlphabetKey + FunctionKey: InnerShuffleKey + ClientShuffleKeyX: InnerShuffleKey + + MutualMediumKey: AlphabetKey + OuterFunctionMediumKey: OuterShuffleKey + OuterFunctionFunctionMediumKey: OuterShuffleKey + OuterServerShuffleFunctionMediumKey: OuterShuffleKey + FunctionMediumKey: InnerShuffleKey + ClientShuffleMediumKeyX: InnerShuffleKey + OuterPositionShuffleMediumKey: OuterShuffleKey + OuterPositionShuffleFunctionMediumKey: OuterShuffleKey + OuterPositionFunctionMediumKey: OuterShuffleKey + PositionFunctionMediumKey: InnerShuffleKey + PositionShuffleMediumKey: InnerShuffleKey + + ClientKey: AlphabetKey + ClientShuffleKeyA: InnerShuffleKey + OuterClientShuffleKey: OuterShuffleKey + OuterClientShuffleFunctionKey: OuterShuffleKey + + OuterClientShuffleMediumKey: OuterShuffleKey + OuterClientShuffleFunctionMediumKey: OuterShuffleKey + ClientShuffleMediumKeyA: InnerShuffleKey + ClientMediumKey: AlphabetKey + + +class ServerEphemeralKeys(BaseModel): + OuterServerShuffleEphemeralKey: OuterShuffleKey + ServerEphemeralKey: AlphabetKey + ServerShuffleEphemeralKey: InnerShuffleKey + ServerMediumEphemeralKey: AlphabetKey + Alphabet: AlphabetKey + + +class MutualEphemeralKeys(BaseModel): + MutualEphemeralKey: AlphabetKey + FunctionEphemeralKey: InnerShuffleKey + OuterFunctionEphemeralKey: OuterShuffleKey + OuterFunctionFunctionEphemeralKey: OuterShuffleKey + OuterServerShuffleFunctionEphemeralKey: OuterShuffleKey + MutualMediumEphemeralKey: AlphabetKey + FunctionMediumEphemeralKey: InnerShuffleKey + PositionFunctionMediumEphemeralKey: InnerShuffleKey + OuterFunctionMediumEphemeralKey: OuterShuffleKey + OuterFunctionFunctionMediumEphemeralKey: OuterShuffleKey + OuterPositionFunctionMediumEphemeralKey: OuterShuffleKey + OuterServerShuffleFunctionMediumEphemeralKey: OuterShuffleKey + OuterPositionShuffleFunctionMediumEphemeralKey: OuterShuffleKey + PositionShuffleMediumEphemeralKey: InnerShuffleKey + OuterPositionShuffleMediumEphemeralKey: OuterShuffleKey + + +class ClientEphemeralKeys(BaseModel): + OuterClientShuffleEphemeralKey: OuterShuffleKey + OuterClientShuffleFunctionEphemeralKey: OuterShuffleKey + ClientEphemeralKey: AlphabetKey + ClientShuffleEphemeralKeyA: InnerShuffleKey + OuterClientShuffleMediumEphemeralKey: OuterShuffleKey + OuterClientShuffleFunctionMediumEphemeralKey: OuterShuffleKey + ClientShuffleMediumEphemeralKeyA: InnerShuffleKey + ClientMediumEphemeralKey: AlphabetKey diff --git a/src/test.py b/src/test.py new file mode 100644 index 0000000..215b08f --- /dev/null +++ b/src/test.py @@ -0,0 +1,13 @@ +from models import OuterShuffleKey + + +outer_shuffle_key = OuterShuffleKey( + matrix=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], +) + +random_outer_shuffle_key = OuterShuffleKey.init_matrix(10) + +applied_outer_shuffle_key = outer_shuffle_key << random_outer_shuffle_key + +print(applied_outer_shuffle_key) +print(applied_outer_shuffle_key << outer_shuffle_key) diff --git a/src/utils.py b/src/utils.py new file mode 100644 index 0000000..237806c --- /dev/null +++ b/src/utils.py @@ -0,0 +1,90 @@ +import secrets + + +def random_number(min_val: int, max_val: int) -> int: + """ originally secure_rand """ + return min_val + secrets.randbelow(max_val - min_val + 1) + + +def random_shuffle(array: list[int]) -> list[int]: + for i in range(len(array) - 1, 0, -1): + j = random_number(0, i) + array[i], array[j] = array[j], array[i] + return array + + +def mask_array(array_len: int) -> list[int]: + new_array = [] + for i in range(array_len): + random_val = random_number(0, array_len) + new_array.append(random_val) + return new_array + + +def build_shuffle_matrix(row_length: int, column_length: int) -> list[list[int]]: + """ originally buildRandom """ + output = [] + for i in range(column_length): + output.append(random_shuffle(list(range(row_length)))) + + return output + + +def build_mask_matrix(row_length: int, column_length: int, max_value: int) -> list[list[int]]: + """ originally buildScramble """ + output = [] + for i in range(column_length): + row = [random_number(0, max_value - 1) for _ in range(row_length)] + output.append(row) + return output + + +def mapped_transform(operand: list[list[int]], function_map: list[list[int]]): + """ originally transpose """ + assert len(operand) == len(function_map) + assert len(operand[0]) == len(function_map[0]) + + output = [] + for i, el in enumerate(function_map): + row = [] + for j, el2 in enumerate(el): + row.append(operand[el2][j]) + output.append(row) + return output + + +def chain_map_transform(functions: list[list[list[int]]]) -> list[list[int]]: + """ originally chainMap """ + output = functions[0] + for i in range(1, len(functions)): + output = mapped_transform(output, functions[i]) + return output + + +if __name__ == "__main__": + alphabet = "abcd" + bytes_per_char = 4 + alphabet_len = len(alphabet) + + functionKey = build_shuffle_matrix(bytes_per_char, alphabet_len) + functionEphemeralKey = build_shuffle_matrix(bytes_per_char, alphabet_len) + + outerFunctionFunctionKey = build_shuffle_matrix(alphabet_len, 1) + outerFunctionFunctionEphemeralKey = build_shuffle_matrix(alphabet_len, 1) + + outerServerShuffleKey = build_shuffle_matrix(alphabet_len, 1) + outerServerShuffleEphemeralKey = build_shuffle_matrix(alphabet_len, 1) + + serverKey = build_mask_matrix(bytes_per_char, alphabet_len, 255) + serverEphemeralKey = build_mask_matrix(bytes_per_char, alphabet_len, 255) + + interfaceConfig = build_mask_matrix(bytes_per_char, alphabet_len, alphabet_len) + + outerFunctionFunctionEphemeralKeyApplied = mapped_transform(outerFunctionFunctionKey, + outerFunctionFunctionEphemeralKey) + + outerServerShuffleEphemeralKeyApplied = mapped_transform(outerServerShuffleKey, outerServerShuffleEphemeralKey) + + inputData = mapped_transform(interfaceConfig, outerServerShuffleEphemeralKeyApplied) + + diff --git a/testDarcKeys.json b/testDarcKeys.json new file mode 100644 index 0000000..cf6354c --- /dev/null +++ b/testDarcKeys.json @@ -0,0 +1,10020 @@ +{ + "persistentKeys": { + "serverKey": [ + [ + 157, + 174, + 175, + 204 + ], + [ + 69, + 122, + 123, + 46 + ], + [ + 115, + 159, + 8, + 144 + ], + [ + 179, + 10, + 61, + 135 + ], + [ + 87, + 104, + 66, + 163 + ], + [ + 203, + 203, + 247, + 8 + ], + [ + 8, + 242, + 183, + 15 + ], + [ + 100, + 104, + 199, + 250 + ], + [ + 20, + 198, + 235, + 242 + ], + [ + 100, + 247, + 158, + 152 + ], + [ + 11, + 89, + 31, + 15 + ], + [ + 50, + 231, + 18, + 146 + ], + [ + 9, + 23, + 176, + 112 + ], + [ + 24, + 127, + 173, + 197 + ], + [ + 245, + 123, + 43, + 86 + ], + [ + 180, + 205, + 240, + 226 + ], + [ + 202, + 124, + 110, + 16 + ], + [ + 205, + 209, + 245, + 6 + ], + [ + 162, + 199, + 86, + 49 + ], + [ + 62, + 108, + 25, + 147 + ], + [ + 32, + 231, + 55, + 29 + ], + [ + 33, + 212, + 121, + 154 + ], + [ + 96, + 86, + 118, + 203 + ], + [ + 71, + 55, + 193, + 81 + ], + [ + 214, + 23, + 55, + 102 + ], + [ + 100, + 176, + 148, + 214 + ], + [ + 159, + 220, + 40, + 178 + ], + [ + 214, + 71, + 228, + 181 + ], + [ + 222, + 184, + 112, + 178 + ], + [ + 242, + 80, + 152, + 243 + ], + [ + 196, + 158, + 228, + 243 + ], + [ + 11, + 196, + 129, + 13 + ], + [ + 193, + 234, + 16, + 247 + ], + [ + 36, + 224, + 200, + 165 + ], + [ + 137, + 128, + 111, + 236 + ], + [ + 78, + 162, + 154, + 207 + ], + [ + 199, + 116, + 31, + 125 + ], + [ + 28, + 168, + 243, + 94 + ], + [ + 104, + 182, + 132, + 235 + ], + [ + 131, + 235, + 124, + 57 + ], + [ + 214, + 37, + 90, + 63 + ], + [ + 144, + 167, + 4, + 115 + ], + [ + 157, + 51, + 71, + 22 + ], + [ + 55, + 106, + 24, + 138 + ], + [ + 28, + 199, + 1, + 200 + ], + [ + 69, + 21, + 195, + 21 + ], + [ + 3, + 248, + 147, + 245 + ], + [ + 202, + 42, + 210, + 92 + ], + [ + 146, + 165, + 52, + 175 + ], + [ + 81, + 7, + 44, + 65 + ], + [ + 148, + 189, + 239, + 38 + ], + [ + 110, + 148, + 128, + 210 + ], + [ + 37, + 105, + 120, + 221 + ], + [ + 89, + 230, + 160, + 76 + ], + [ + 142, + 155, + 22, + 198 + ], + [ + 181, + 213, + 148, + 184 + ], + [ + 120, + 34, + 234, + 101 + ], + [ + 202, + 222, + 190, + 209 + ], + [ + 217, + 172, + 102, + 109 + ], + [ + 232, + 20, + 208, + 21 + ], + [ + 149, + 25, + 33, + 251 + ], + [ + 227, + 222, + 251, + 82 + ], + [ + 81, + 44, + 22, + 213 + ], + [ + 170, + 61, + 129, + 23 + ], + [ + 202, + 163, + 29, + 179 + ], + [ + 217, + 149, + 179, + 23 + ], + [ + 2, + 103, + 72, + 185 + ], + [ + 206, + 45, + 172, + 45 + ], + [ + 182, + 146, + 129, + 233 + ], + [ + 104, + 33, + 76, + 58 + ], + [ + 62, + 10, + 217, + 32 + ], + [ + 216, + 81, + 137, + 136 + ], + [ + 93, + 150, + 79, + 190 + ], + [ + 127, + 42, + 137, + 42 + ], + [ + 235, + 99, + 248, + 239 + ], + [ + 138, + 105, + 10, + 180 + ], + [ + 248, + 241, + 132, + 158 + ], + [ + 214, + 196, + 15, + 15 + ], + [ + 178, + 140, + 201, + 65 + ], + [ + 168, + 227, + 78, + 21 + ], + [ + 171, + 19, + 211, + 132 + ], + [ + 216, + 169, + 217, + 96 + ], + [ + 103, + 232, + 102, + 160 + ], + [ + 114, + 45, + 130, + 102 + ], + [ + 239, + 138, + 46, + 231 + ], + [ + 85, + 222, + 124, + 157 + ], + [ + 242, + 247, + 111, + 38 + ], + [ + 220, + 43, + 168, + 195 + ], + [ + 25, + 32, + 211, + 190 + ], + [ + 165, + 221, + 180, + 108 + ], + [ + 66, + 28, + 198, + 162 + ], + [ + 36, + 181, + 23, + 93 + ], + [ + 187, + 153, + 141, + 100 + ], + [ + 132, + 38, + 40, + 77 + ], + [ + 12, + 153, + 196, + 234 + ] + ], + "functionKey": [ + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 2, + 1, + 0 + ] + ], + "serverShuffleKey": [ + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 2, + 0, + 3 + ] + ], + "outerFunctionKey": [ + 23, + 42, + 89, + 9, + 40, + 64, + 55, + 35, + 52, + 11, + 94, + 16, + 54, + 84, + 38, + 36, + 50, + 91, + 80, + 85, + 92, + 78, + 49, + 19, + 13, + 77, + 47, + 39, + 63, + 25, + 69, + 53, + 1, + 60, + 93, + 71, + 70, + 61, + 66, + 17, + 33, + 76, + 86, + 73, + 83, + 7, + 74, + 18, + 44, + 0, + 20, + 72, + 24, + 75, + 45, + 34, + 15, + 90, + 58, + 48, + 57, + 81, + 79, + 37, + 31, + 67, + 65, + 28, + 3, + 29, + 88, + 51, + 27, + 26, + 82, + 21, + 10, + 46, + 43, + 56, + 32, + 5, + 12, + 14, + 87, + 30, + 59, + 62, + 6, + 2, + 4, + 22, + 41, + 8, + 68 + ], + "outerFunctionFunctionKey": [ + 86, + 77, + 16, + 3, + 18, + 64, + 85, + 42, + 90, + 26, + 40, + 91, + 88, + 45, + 27, + 7, + 80, + 39, + 61, + 9, + 35, + 25, + 70, + 56, + 62, + 21, + 93, + 60, + 32, + 17, + 52, + 13, + 51, + 37, + 4, + 44, + 54, + 0, + 30, + 28, + 75, + 84, + 1, + 6, + 34, + 79, + 65, + 47, + 66, + 59, + 14, + 41, + 69, + 20, + 8, + 29, + 55, + 33, + 73, + 63, + 48, + 94, + 22, + 57, + 31, + 11, + 82, + 15, + 2, + 43, + 53, + 50, + 76, + 81, + 46, + 87, + 67, + 24, + 58, + 92, + 38, + 83, + 72, + 78, + 36, + 19, + 12, + 68, + 23, + 10, + 89, + 71, + 49, + 74, + 5 + ], + "outerServerShuffleKey": [ + 23, + 80, + 68, + 79, + 13, + 51, + 22, + 21, + 41, + 43, + 14, + 9, + 30, + 4, + 47, + 36, + 7, + 65, + 85, + 91, + 48, + 73, + 0, + 54, + 42, + 72, + 66, + 31, + 46, + 27, + 86, + 78, + 38, + 92, + 6, + 15, + 25, + 40, + 84, + 89, + 37, + 19, + 67, + 5, + 55, + 90, + 62, + 33, + 49, + 74, + 3, + 75, + 64, + 93, + 88, + 26, + 24, + 44, + 29, + 58, + 32, + 77, + 60, + 81, + 61, + 71, + 94, + 18, + 83, + 11, + 53, + 52, + 63, + 17, + 35, + 50, + 34, + 45, + 39, + 57, + 2, + 87, + 1, + 10, + 16, + 56, + 76, + 59, + 70, + 82, + 28, + 69, + 12, + 20, + 8 + ], + "outerServerShuffleFunctionKey": [ + 55, + 17, + 29, + 58, + 93, + 16, + 80, + 56, + 60, + 3, + 91, + 90, + 81, + 74, + 92, + 18, + 50, + 13, + 67, + 45, + 8, + 76, + 6, + 31, + 22, + 57, + 61, + 11, + 38, + 26, + 42, + 1, + 10, + 39, + 35, + 71, + 77, + 51, + 48, + 47, + 37, + 20, + 40, + 27, + 34, + 84, + 12, + 7, + 82, + 64, + 2, + 73, + 24, + 33, + 36, + 79, + 5, + 59, + 28, + 54, + 66, + 32, + 53, + 83, + 21, + 14, + 4, + 75, + 63, + 86, + 89, + 78, + 88, + 19, + 23, + 46, + 94, + 0, + 69, + 52, + 9, + 41, + 70, + 15, + 43, + 85, + 25, + 49, + 87, + 62, + 44, + 30, + 68, + 65, + 72 + ], + "clientKey": [ + [ + 85, + 160, + 90, + 208 + ], + [ + 81, + 23, + 153, + 75 + ], + [ + 28, + 176, + 110, + 206 + ], + [ + 95, + 246, + 236, + 238 + ], + [ + 226, + 145, + 148, + 24 + ], + [ + 227, + 95, + 17, + 36 + ], + [ + 16, + 2, + 158, + 147 + ], + [ + 134, + 3, + 211, + 53 + ], + [ + 78, + 162, + 22, + 134 + ], + [ + 217, + 231, + 58, + 145 + ], + [ + 170, + 19, + 202, + 74 + ], + [ + 215, + 75, + 52, + 4 + ], + [ + 136, + 77, + 42, + 93 + ], + [ + 232, + 90, + 160, + 92 + ], + [ + 225, + 143, + 169, + 245 + ], + [ + 114, + 184, + 199, + 80 + ], + [ + 223, + 225, + 132, + 253 + ], + [ + 126, + 58, + 110, + 194 + ], + [ + 243, + 152, + 16, + 100 + ], + [ + 67, + 227, + 127, + 216 + ], + [ + 33, + 203, + 25, + 144 + ], + [ + 51, + 249, + 241, + 212 + ], + [ + 101, + 27, + 111, + 188 + ], + [ + 118, + 198, + 38, + 27 + ], + [ + 105, + 61, + 218, + 21 + ], + [ + 233, + 62, + 210, + 226 + ], + [ + 85, + 69, + 192, + 95 + ], + [ + 50, + 46, + 114, + 107 + ], + [ + 94, + 247, + 27, + 28 + ], + [ + 37, + 105, + 16, + 159 + ], + [ + 201, + 70, + 163, + 90 + ], + [ + 38, + 40, + 119, + 216 + ], + [ + 178, + 125, + 252, + 247 + ], + [ + 26, + 109, + 76, + 198 + ], + [ + 187, + 86, + 101, + 112 + ], + [ + 53, + 3, + 189, + 253 + ], + [ + 19, + 127, + 171, + 114 + ], + [ + 65, + 52, + 209, + 118 + ], + [ + 222, + 41, + 248, + 112 + ], + [ + 7, + 218, + 228, + 55 + ], + [ + 239, + 59, + 48, + 229 + ], + [ + 151, + 120, + 114, + 99 + ], + [ + 208, + 180, + 240, + 55 + ], + [ + 246, + 232, + 164, + 187 + ], + [ + 84, + 43, + 46, + 188 + ], + [ + 170, + 175, + 247, + 67 + ], + [ + 134, + 10, + 144, + 4 + ], + [ + 228, + 239, + 5, + 204 + ], + [ + 109, + 89, + 149, + 116 + ], + [ + 16, + 167, + 47, + 78 + ], + [ + 210, + 235, + 249, + 203 + ], + [ + 138, + 230, + 97, + 29 + ], + [ + 167, + 223, + 192, + 46 + ], + [ + 110, + 7, + 114, + 170 + ], + [ + 88, + 155, + 182, + 87 + ], + [ + 203, + 53, + 7, + 104 + ], + [ + 251, + 239, + 38, + 248 + ], + [ + 155, + 87, + 141, + 154 + ], + [ + 65, + 112, + 35, + 62 + ], + [ + 177, + 124, + 28, + 75 + ], + [ + 254, + 197, + 114, + 177 + ], + [ + 42, + 7, + 199, + 123 + ], + [ + 19, + 248, + 23, + 153 + ], + [ + 14, + 156, + 3, + 178 + ], + [ + 68, + 20, + 31, + 228 + ], + [ + 176, + 76, + 220, + 120 + ], + [ + 91, + 159, + 79, + 139 + ], + [ + 105, + 170, + 19, + 167 + ], + [ + 238, + 185, + 186, + 55 + ], + [ + 224, + 158, + 154, + 144 + ], + [ + 228, + 212, + 183, + 136 + ], + [ + 44, + 217, + 221, + 224 + ], + [ + 20, + 49, + 160, + 130 + ], + [ + 104, + 225, + 130, + 142 + ], + [ + 181, + 67, + 108, + 185 + ], + [ + 17, + 115, + 141, + 155 + ], + [ + 208, + 18, + 30, + 14 + ], + [ + 198, + 21, + 133, + 176 + ], + [ + 140, + 224, + 107, + 176 + ], + [ + 34, + 35, + 155, + 80 + ], + [ + 116, + 140, + 125, + 82 + ], + [ + 156, + 60, + 246, + 75 + ], + [ + 225, + 84, + 176, + 36 + ], + [ + 122, + 174, + 160, + 46 + ], + [ + 78, + 219, + 84, + 150 + ], + [ + 28, + 231, + 98, + 188 + ], + [ + 209, + 55, + 213, + 14 + ], + [ + 84, + 3, + 160, + 248 + ], + [ + 32, + 244, + 169, + 159 + ], + [ + 146, + 123, + 131, + 221 + ], + [ + 66, + 88, + 63, + 200 + ], + [ + 47, + 148, + 114, + 72 + ], + [ + 26, + 228, + 43, + 142 + ], + [ + 217, + 140, + 137, + 106 + ], + [ + 241, + 118, + 5, + 46 + ] + ], + "sharedKey": [ + [ + 253, + 44, + 190, + 48 + ], + [ + 28, + 248, + 213, + 37 + ], + [ + 75, + 184, + 250, + 39 + ], + [ + 200, + 32, + 40, + 26 + ], + [ + 52, + 249, + 218, + 202 + ], + [ + 171, + 227, + 24, + 247 + ], + [ + 112, + 34, + 145, + 237 + ], + [ + 160, + 38, + 204, + 107 + ], + [ + 186, + 247, + 201, + 25 + ], + [ + 26, + 149, + 123, + 179 + ], + [ + 71, + 37, + 75, + 196 + ], + [ + 17, + 134, + 118, + 24 + ], + [ + 170, + 184, + 79, + 27 + ], + [ + 39, + 11, + 29, + 105 + ], + [ + 14, + 96, + 239, + 120 + ], + [ + 192, + 227, + 26, + 109 + ], + [ + 110, + 179, + 169, + 186 + ], + [ + 182, + 193, + 234, + 94 + ], + [ + 70, + 172, + 51, + 45 + ], + [ + 13, + 185, + 12, + 212 + ], + [ + 226, + 140, + 105, + 61 + ], + [ + 206, + 97, + 5, + 159 + ], + [ + 188, + 198, + 106, + 178 + ], + [ + 128, + 30, + 54, + 4 + ], + [ + 53, + 17, + 38, + 171 + ], + [ + 144, + 1, + 41, + 75 + ], + [ + 5, + 33, + 58, + 117 + ], + [ + 67, + 120, + 232, + 202 + ], + [ + 204, + 227, + 157, + 198 + ], + [ + 189, + 111, + 247, + 60 + ], + [ + 144, + 168, + 137, + 126 + ], + [ + 242, + 126, + 160, + 220 + ], + [ + 41, + 191, + 139, + 49 + ], + [ + 230, + 7, + 43, + 205 + ], + [ + 32, + 106, + 22, + 14 + ], + [ + 135, + 163, + 20, + 151 + ], + [ + 38, + 183, + 75, + 184 + ], + [ + 180, + 69, + 244, + 218 + ], + [ + 100, + 89, + 234, + 160 + ], + [ + 197, + 251, + 250, + 195 + ], + [ + 150, + 174, + 65, + 131 + ], + [ + 9, + 50, + 80, + 244 + ], + [ + 169, + 87, + 54, + 61 + ], + [ + 61, + 93, + 158, + 168 + ], + [ + 82, + 62, + 247, + 117 + ], + [ + 11, + 128, + 110, + 49 + ], + [ + 162, + 24, + 46, + 89 + ], + [ + 151, + 34, + 235, + 175 + ], + [ + 58, + 250, + 177, + 203 + ], + [ + 192, + 155, + 198, + 241 + ], + [ + 113, + 172, + 183, + 186 + ], + [ + 131, + 6, + 80, + 161 + ], + [ + 142, + 207, + 44, + 224 + ], + [ + 155, + 160, + 59, + 93 + ], + [ + 242, + 153, + 72, + 28 + ], + [ + 188, + 114, + 218, + 102 + ], + [ + 153, + 97, + 140, + 213 + ], + [ + 186, + 43, + 166, + 142 + ], + [ + 37, + 69, + 142, + 212 + ], + [ + 128, + 172, + 88, + 108 + ], + [ + 168, + 196, + 93, + 119 + ], + [ + 25, + 251, + 176, + 182 + ], + [ + 234, + 240, + 221, + 97 + ], + [ + 39, + 14, + 122, + 138 + ], + [ + 205, + 213, + 83, + 15 + ], + [ + 157, + 203, + 173, + 140 + ], + [ + 132, + 77, + 95, + 126 + ], + [ + 86, + 26, + 76, + 164 + ], + [ + 181, + 250, + 195, + 134 + ], + [ + 206, + 197, + 254, + 49 + ], + [ + 4, + 19, + 192, + 241 + ], + [ + 138, + 140, + 100, + 121 + ], + [ + 200, + 186, + 72, + 16 + ], + [ + 9, + 98, + 75, + 252 + ], + [ + 174, + 229, + 119, + 241 + ], + [ + 42, + 134, + 142, + 51 + ], + [ + 129, + 200, + 79, + 50 + ], + [ + 221, + 113, + 58, + 196 + ], + [ + 65, + 158, + 89, + 169 + ], + [ + 85, + 202, + 245, + 152 + ], + [ + 45, + 96, + 64, + 223 + ], + [ + 210, + 152, + 79, + 245 + ], + [ + 34, + 163, + 179, + 204 + ], + [ + 187, + 33, + 3, + 215 + ], + [ + 146, + 130, + 26, + 208 + ], + [ + 108, + 234, + 140, + 222 + ], + [ + 162, + 237, + 34, + 234 + ], + [ + 57, + 40, + 71, + 33 + ], + [ + 62, + 83, + 210, + 216 + ], + [ + 16, + 234, + 118, + 131 + ], + [ + 77, + 181, + 21, + 19 + ], + [ + 21, + 104, + 64, + 246 + ], + [ + 100, + 54, + 131, + 101 + ], + [ + 14, + 247, + 21, + 2 + ], + [ + 44, + 9, + 148, + 228 + ] + ], + "clientShuffleKeyX": [ + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 0, + 2, + 3 + ] + ], + "clientShuffleKeyA": [ + [ + 3, + 2, + 0, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 1, + 0, + 2 + ] + ], + "functionMediumKey": [ + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 0, + 2, + 3 + ] + ], + "clientShuffleMediumKeyX": [ + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 3, + 0, + 2 + ] + ], + "inputMediumData": [ + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ] + ], + "serverMediumKey": [ + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0 + ] + ], + "outerFunctionMediumKey": [ + 3, + 8, + 2, + 6, + 0, + 5, + 9, + 4, + 7, + 1 + ], + "outerFunctionFunctionMediumKey": [ + 6, + 2, + 9, + 0, + 3, + 1, + 8, + 4, + 7, + 5 + ], + "outerServerShuffleMediumKey": [ + 3, + 9, + 2, + 7, + 0, + 5, + 1, + 8, + 4, + 6 + ], + "outerServerShuffleFunctionMediumKey": [ + 7, + 1, + 6, + 0, + 5, + 4, + 9, + 2, + 3, + 8 + ], + "sharedMediumKey": [ + [ + 110, + 121, + 195, + 185 + ], + [ + 187, + 194, + 183, + 179 + ], + [ + 34, + 154, + 127, + 88 + ], + [ + 123, + 180, + 82, + 179 + ], + [ + 189, + 86, + 201, + 243 + ], + [ + 80, + 92, + 241, + 46 + ], + [ + 35, + 29, + 145, + 191 + ], + [ + 100, + 150, + 24, + 165 + ], + [ + 187, + 178, + 254, + 222 + ], + [ + 3, + 111, + 212, + 199 + ] + ], + "outerPositionFunctionMediumKey": [ + 4, + 1, + 7, + 0, + 5, + 8, + 2, + 6, + 9, + 3 + ], + "outerPositionShuffleMediumKey": [ + 4, + 8, + 5, + 2, + 0, + 3, + 1, + 6, + 7, + 9 + ], + "clientMediumKey": [ + [ + 210, + 9, + 218, + 237 + ], + [ + 152, + 196, + 214, + 245 + ], + [ + 99, + 220, + 20, + 56 + ], + [ + 238, + 217, + 34, + 251 + ], + [ + 127, + 113, + 154, + 53 + ], + [ + 202, + 159, + 249, + 77 + ], + [ + 89, + 222, + 82, + 246 + ], + [ + 108, + 0, + 59, + 125 + ], + [ + 208, + 230, + 28, + 59 + ], + [ + 45, + 244, + 129, + 157 + ] + ], + "positionFunctionMediumKey": [ + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 3, + 2, + 1 + ] + ], + "clientShuffleMediumKeyA": [ + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 1, + 2, + 0, + 3 + ] + ] + }, + "ephemeralKeys": { + "serverEphemeralKey": [ + [ + 3, + 65, + 45, + 191 + ], + [ + 147, + 248, + 195, + 171 + ], + [ + 28, + 225, + 186, + 86 + ], + [ + 113, + 49, + 244, + 61 + ], + [ + 78, + 177, + 226, + 39 + ], + [ + 234, + 8, + 54, + 26 + ], + [ + 205, + 52, + 90, + 251 + ], + [ + 9, + 9, + 138, + 165 + ], + [ + 63, + 18, + 198, + 226 + ], + [ + 33, + 120, + 48, + 185 + ], + [ + 139, + 239, + 145, + 61 + ], + [ + 68, + 1, + 108, + 197 + ], + [ + 190, + 191, + 19, + 59 + ], + [ + 139, + 17, + 112, + 239 + ], + [ + 13, + 14, + 65, + 248 + ], + [ + 95, + 178, + 39, + 234 + ], + [ + 163, + 6, + 214, + 225 + ], + [ + 87, + 230, + 244, + 200 + ], + [ + 114, + 15, + 80, + 136 + ], + [ + 253, + 204, + 253, + 175 + ], + [ + 249, + 167, + 63, + 119 + ], + [ + 134, + 216, + 26, + 231 + ], + [ + 68, + 201, + 228, + 155 + ], + [ + 228, + 119, + 167, + 165 + ], + [ + 86, + 62, + 26, + 15 + ], + [ + 8, + 2, + 69, + 72 + ], + [ + 124, + 241, + 181, + 109 + ], + [ + 243, + 75, + 185, + 164 + ], + [ + 79, + 11, + 186, + 249 + ], + [ + 226, + 114, + 189, + 155 + ], + [ + 170, + 144, + 240, + 14 + ], + [ + 126, + 102, + 157, + 155 + ], + [ + 211, + 70, + 189, + 66 + ], + [ + 206, + 181, + 125, + 195 + ], + [ + 58, + 232, + 62, + 246 + ], + [ + 216, + 170, + 235, + 162 + ], + [ + 108, + 20, + 205, + 200 + ], + [ + 63, + 8, + 82, + 162 + ], + [ + 79, + 151, + 233, + 71 + ], + [ + 84, + 88, + 93, + 2 + ], + [ + 53, + 143, + 70, + 100 + ], + [ + 77, + 87, + 195, + 48 + ], + [ + 169, + 235, + 112, + 9 + ], + [ + 83, + 109, + 28, + 219 + ], + [ + 79, + 225, + 164, + 230 + ], + [ + 165, + 156, + 22, + 9 + ], + [ + 53, + 111, + 221, + 10 + ], + [ + 18, + 24, + 146, + 146 + ], + [ + 63, + 92, + 55, + 119 + ], + [ + 50, + 162, + 134, + 24 + ], + [ + 41, + 180, + 158, + 214 + ], + [ + 28, + 192, + 2, + 37 + ], + [ + 77, + 195, + 202, + 142 + ], + [ + 8, + 18, + 19, + 208 + ], + [ + 35, + 102, + 27, + 29 + ], + [ + 83, + 44, + 76, + 41 + ], + [ + 54, + 206, + 101, + 149 + ], + [ + 71, + 102, + 129, + 140 + ], + [ + 86, + 0, + 1, + 240 + ], + [ + 108, + 230, + 220, + 218 + ], + [ + 27, + 185, + 95, + 27 + ], + [ + 100, + 24, + 76, + 125 + ], + [ + 170, + 126, + 158, + 3 + ], + [ + 124, + 76, + 159, + 167 + ], + [ + 112, + 111, + 217, + 7 + ], + [ + 64, + 195, + 38, + 43 + ], + [ + 17, + 213, + 165, + 18 + ], + [ + 102, + 196, + 102, + 18 + ], + [ + 34, + 161, + 213, + 14 + ], + [ + 204, + 138, + 231, + 241 + ], + [ + 222, + 178, + 205, + 170 + ], + [ + 227, + 165, + 177, + 100 + ], + [ + 149, + 94, + 168, + 132 + ], + [ + 217, + 71, + 8, + 171 + ], + [ + 73, + 51, + 140, + 210 + ], + [ + 84, + 46, + 61, + 221 + ], + [ + 250, + 121, + 239, + 179 + ], + [ + 202, + 103, + 105, + 96 + ], + [ + 171, + 147, + 105, + 239 + ], + [ + 83, + 216, + 178, + 17 + ], + [ + 75, + 225, + 41, + 54 + ], + [ + 141, + 99, + 23, + 180 + ], + [ + 189, + 116, + 24, + 215 + ], + [ + 91, + 251, + 245, + 32 + ], + [ + 109, + 139, + 39, + 86 + ], + [ + 139, + 207, + 64, + 69 + ], + [ + 60, + 192, + 227, + 158 + ], + [ + 176, + 69, + 64, + 207 + ], + [ + 41, + 234, + 212, + 221 + ], + [ + 6, + 76, + 222, + 48 + ], + [ + 90, + 77, + 167, + 240 + ], + [ + 2, + 68, + 117, + 247 + ], + [ + 191, + 210, + 189, + 39 + ], + [ + 142, + 75, + 243, + 5 + ], + [ + 226, + 141, + 149, + 62 + ] + ], + "sharedEphemeralKey": [ + [ + 242, + 205, + 220, + 234 + ], + [ + 247, + 201, + 219, + 57 + ], + [ + 250, + 155, + 131, + 175 + ], + [ + 101, + 118, + 229, + 88 + ], + [ + 54, + 37, + 144, + 42 + ], + [ + 147, + 222, + 134, + 111 + ], + [ + 104, + 39, + 227, + 173 + ], + [ + 165, + 254, + 160, + 24 + ], + [ + 86, + 154, + 116, + 21 + ], + [ + 76, + 132, + 233, + 100 + ], + [ + 238, + 249, + 213, + 100 + ], + [ + 212, + 38, + 189, + 216 + ], + [ + 154, + 66, + 87, + 235 + ], + [ + 211, + 173, + 148, + 174 + ], + [ + 35, + 246, + 181, + 100 + ], + [ + 111, + 223, + 218, + 148 + ], + [ + 182, + 206, + 168, + 135 + ], + [ + 0, + 22, + 183, + 195 + ], + [ + 218, + 88, + 158, + 232 + ], + [ + 5, + 219, + 157, + 170 + ], + [ + 81, + 29, + 222, + 178 + ], + [ + 3, + 107, + 2, + 89 + ], + [ + 248, + 107, + 85, + 89 + ], + [ + 234, + 144, + 114, + 221 + ], + [ + 93, + 242, + 61, + 216 + ], + [ + 208, + 47, + 244, + 227 + ], + [ + 97, + 102, + 41, + 158 + ], + [ + 102, + 111, + 215, + 16 + ], + [ + 203, + 104, + 110, + 236 + ], + [ + 72, + 171, + 187, + 168 + ], + [ + 229, + 58, + 126, + 111 + ], + [ + 236, + 11, + 56, + 180 + ], + [ + 29, + 32, + 229, + 67 + ], + [ + 203, + 202, + 39, + 161 + ], + [ + 229, + 229, + 11, + 67 + ], + [ + 216, + 20, + 221, + 7 + ], + [ + 120, + 217, + 97, + 21 + ], + [ + 31, + 127, + 44, + 115 + ], + [ + 21, + 37, + 119, + 196 + ], + [ + 143, + 118, + 149, + 72 + ], + [ + 91, + 181, + 164, + 30 + ], + [ + 39, + 169, + 77, + 168 + ], + [ + 110, + 118, + 12, + 99 + ], + [ + 97, + 93, + 128, + 0 + ], + [ + 106, + 111, + 194, + 30 + ], + [ + 193, + 112, + 237, + 207 + ], + [ + 186, + 99, + 231, + 197 + ], + [ + 66, + 45, + 37, + 133 + ], + [ + 183, + 241, + 66, + 15 + ], + [ + 72, + 5, + 207, + 74 + ], + [ + 151, + 227, + 98, + 153 + ], + [ + 169, + 173, + 28, + 139 + ], + [ + 136, + 48, + 203, + 126 + ], + [ + 69, + 85, + 226, + 78 + ], + [ + 148, + 172, + 35, + 36 + ], + [ + 160, + 74, + 228, + 31 + ], + [ + 110, + 174, + 175, + 177 + ], + [ + 87, + 183, + 156, + 48 + ], + [ + 80, + 173, + 148, + 33 + ], + [ + 218, + 128, + 169, + 74 + ], + [ + 135, + 244, + 82, + 192 + ], + [ + 91, + 122, + 229, + 210 + ], + [ + 190, + 209, + 147, + 29 + ], + [ + 251, + 25, + 158, + 155 + ], + [ + 161, + 8, + 5, + 216 + ], + [ + 113, + 182, + 117, + 10 + ], + [ + 205, + 83, + 69, + 4 + ], + [ + 30, + 230, + 87, + 253 + ], + [ + 146, + 98, + 63, + 108 + ], + [ + 42, + 29, + 99, + 167 + ], + [ + 163, + 225, + 239, + 64 + ], + [ + 224, + 74, + 4, + 52 + ], + [ + 184, + 248, + 247, + 70 + ], + [ + 137, + 134, + 229, + 123 + ], + [ + 132, + 166, + 218, + 23 + ], + [ + 237, + 104, + 182, + 128 + ], + [ + 63, + 118, + 154, + 162 + ], + [ + 137, + 202, + 33, + 203 + ], + [ + 14, + 61, + 149, + 168 + ], + [ + 222, + 84, + 76, + 35 + ], + [ + 219, + 121, + 187, + 70 + ], + [ + 223, + 177, + 28, + 203 + ], + [ + 95, + 140, + 14, + 91 + ], + [ + 70, + 47, + 184, + 121 + ], + [ + 65, + 146, + 249, + 25 + ], + [ + 130, + 204, + 107, + 244 + ], + [ + 200, + 39, + 56, + 131 + ], + [ + 160, + 200, + 209, + 136 + ], + [ + 223, + 213, + 211, + 250 + ], + [ + 70, + 123, + 183, + 55 + ], + [ + 178, + 72, + 86, + 218 + ], + [ + 77, + 219, + 36, + 219 + ], + [ + 98, + 211, + 105, + 192 + ], + [ + 82, + 231, + 122, + 245 + ], + [ + 8, + 151, + 10, + 149 + ] + ], + "functionEphemeralKey": [ + [ + 2, + 0, + 3, + 1 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ] + ], + "outerFunctionEphemeralKey": [ + 66, + 24, + 47, + 86, + 1, + 25, + 59, + 38, + 56, + 58, + 63, + 45, + 80, + 2, + 11, + 43, + 67, + 64, + 44, + 3, + 7, + 89, + 15, + 65, + 77, + 13, + 6, + 12, + 14, + 81, + 49, + 91, + 76, + 16, + 94, + 74, + 29, + 75, + 87, + 48, + 40, + 83, + 85, + 62, + 60, + 32, + 10, + 30, + 92, + 21, + 23, + 42, + 19, + 31, + 33, + 46, + 51, + 5, + 27, + 72, + 55, + 20, + 61, + 90, + 79, + 53, + 73, + 70, + 28, + 52, + 37, + 84, + 18, + 8, + 41, + 68, + 71, + 9, + 22, + 78, + 0, + 93, + 50, + 35, + 82, + 26, + 4, + 88, + 57, + 34, + 36, + 39, + 54, + 17, + 69 + ], + "outerFunctionFunctionEphemeralKey": [ + 85, + 94, + 53, + 88, + 63, + 20, + 24, + 57, + 89, + 48, + 13, + 16, + 44, + 49, + 61, + 45, + 77, + 70, + 91, + 3, + 47, + 65, + 12, + 74, + 33, + 14, + 50, + 86, + 83, + 25, + 36, + 68, + 18, + 4, + 41, + 7, + 67, + 71, + 87, + 93, + 69, + 62, + 51, + 80, + 73, + 19, + 81, + 54, + 30, + 21, + 22, + 58, + 10, + 82, + 75, + 1, + 37, + 26, + 60, + 23, + 56, + 52, + 0, + 42, + 28, + 46, + 55, + 32, + 39, + 84, + 72, + 35, + 79, + 9, + 29, + 66, + 40, + 6, + 27, + 59, + 76, + 8, + 43, + 38, + 11, + 15, + 78, + 34, + 92, + 17, + 2, + 64, + 90, + 5, + 31 + ], + "outerServerShuffleFunctionEphemeralKey": [ + 35, + 24, + 80, + 6, + 7, + 56, + 25, + 14, + 28, + 67, + 23, + 22, + 36, + 42, + 88, + 55, + 63, + 20, + 16, + 15, + 64, + 58, + 13, + 54, + 81, + 60, + 1, + 2, + 94, + 8, + 38, + 44, + 71, + 11, + 82, + 29, + 12, + 4, + 74, + 79, + 39, + 46, + 68, + 19, + 31, + 21, + 59, + 92, + 3, + 34, + 27, + 73, + 30, + 49, + 43, + 48, + 10, + 62, + 66, + 57, + 85, + 47, + 87, + 17, + 65, + 9, + 53, + 32, + 52, + 69, + 77, + 75, + 26, + 51, + 89, + 83, + 91, + 93, + 50, + 33, + 45, + 72, + 18, + 78, + 90, + 84, + 61, + 86, + 37, + 70, + 0, + 5, + 41, + 76, + 40 + ], + "serverShuffleEphemeralKey": [ + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 2, + 1, + 0 + ] + ], + "outerServerShuffleEphemeralKey": [ + 74, + 36, + 55, + 21, + 15, + 6, + 58, + 43, + 81, + 48, + 42, + 35, + 53, + 1, + 86, + 18, + 83, + 30, + 27, + 54, + 28, + 38, + 73, + 85, + 0, + 12, + 3, + 41, + 40, + 16, + 2, + 88, + 4, + 89, + 93, + 64, + 23, + 72, + 91, + 75, + 56, + 94, + 19, + 46, + 26, + 5, + 22, + 66, + 70, + 68, + 14, + 62, + 52, + 32, + 90, + 80, + 29, + 13, + 25, + 60, + 63, + 34, + 51, + 45, + 69, + 31, + 17, + 82, + 9, + 59, + 20, + 50, + 49, + 44, + 79, + 57, + 78, + 71, + 84, + 87, + 61, + 11, + 39, + 37, + 76, + 8, + 10, + 77, + 24, + 67, + 92, + 7, + 47, + 65, + 33 + ], + "serverMediumEphemeralKey": [ + [ + 234, + 243, + 8, + 213 + ], + [ + 238, + 75, + 140, + 252 + ], + [ + 97, + 246, + 197, + 111 + ], + [ + 94, + 172, + 18, + 183 + ], + [ + 118, + 126, + 98, + 108 + ], + [ + 176, + 187, + 165, + 204 + ], + [ + 227, + 207, + 113, + 61 + ], + [ + 104, + 244, + 179, + 112 + ], + [ + 228, + 236, + 223, + 236 + ], + [ + 127, + 46, + 193, + 39 + ] + ], + "sharedMediumEphemeralKey": [ + [ + 111, + 10, + 18, + 215 + ], + [ + 15, + 31, + 54, + 237 + ], + [ + 114, + 152, + 79, + 233 + ], + [ + 203, + 128, + 185, + 90 + ], + [ + 62, + 186, + 10, + 241 + ], + [ + 5, + 174, + 198, + 71 + ], + [ + 230, + 247, + 171, + 161 + ], + [ + 31, + 19, + 60, + 139 + ], + [ + 136, + 174, + 245, + 208 + ], + [ + 116, + 75, + 250, + 237 + ] + ], + "functionMediumEphemeralKey": [ + [ + 0, + 1, + 2, + 3 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 1, + 2, + 3 + ] + ], + "positionFunctionMediumEphemeralKey": [ + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 1, + 0, + 2, + 3 + ] + ], + "outerFunctionMediumEphemeralKey": [ + 6, + 8, + 9, + 2, + 3, + 5, + 1, + 0, + 7, + 4 + ], + "outerFunctionFunctionMediumEphemeralKey": [ + 6, + 5, + 8, + 4, + 3, + 7, + 0, + 2, + 9, + 1 + ], + "outerPositionFunctionMediumEphemeralKey": [ + 2, + 9, + 7, + 8, + 3, + 6, + 1, + 0, + 5, + 4 + ], + "outerServerShuffleFunctionMediumEphemeralKey": [ + 9, + 8, + 6, + 0, + 2, + 7, + 3, + 1, + 5, + 4 + ], + "outerServerShuffleMediumEphemeralKey": [ + 1, + 4, + 8, + 5, + 9, + 7, + 6, + 3, + 2, + 0 + ], + "outerPositionShuffleMediumEphemeralKey": [ + 2, + 0, + 1, + 3, + 8, + 9, + 4, + 6, + 5, + 7 + ], + "interfaceConfig": [ + [ + 113, + 231, + 226, + 35 + ], + [ + 14, + 141, + 113, + 83 + ], + [ + 219, + 172, + 150, + 208 + ], + [ + 192, + 111, + 104, + 202 + ], + [ + 192, + 94, + 226, + 80 + ], + [ + 64, + 85, + 59, + 177 + ], + [ + 249, + 127, + 3, + 84 + ], + [ + 63, + 75, + 12, + 212 + ], + [ + 117, + 123, + 110, + 193 + ], + [ + 195, + 170, + 200, + 85 + ], + [ + 51, + 200, + 188, + 30 + ], + [ + 4, + 35, + 186, + 63 + ], + [ + 181, + 73, + 243, + 150 + ], + [ + 28, + 215, + 26, + 163 + ], + [ + 227, + 11, + 39, + 181 + ], + [ + 220, + 84, + 81, + 243 + ], + [ + 47, + 19, + 106, + 9 + ], + [ + 114, + 251, + 165, + 201 + ], + [ + 149, + 110, + 105, + 24 + ], + [ + 28, + 158, + 66, + 99 + ], + [ + 230, + 184, + 217, + 0 + ], + [ + 136, + 127, + 31, + 27 + ], + [ + 100, + 127, + 44, + 216 + ], + [ + 70, + 127, + 41, + 101 + ], + [ + 85, + 50, + 59, + 57 + ], + [ + 184, + 243, + 158, + 186 + ], + [ + 41, + 23, + 53, + 188 + ], + [ + 103, + 179, + 167, + 175 + ], + [ + 143, + 41, + 232, + 32 + ], + [ + 67, + 160, + 210, + 43 + ], + [ + 124, + 249, + 193, + 169 + ], + [ + 169, + 39, + 192, + 57 + ], + [ + 206, + 220, + 102, + 24 + ], + [ + 214, + 1, + 180, + 181 + ], + [ + 79, + 79, + 29, + 63 + ], + [ + 161, + 136, + 78, + 88 + ], + [ + 219, + 70, + 94, + 189 + ], + [ + 193, + 52, + 160, + 109 + ], + [ + 235, + 133, + 169, + 184 + ], + [ + 173, + 12, + 196, + 164 + ], + [ + 207, + 66, + 242, + 141 + ], + [ + 216, + 173, + 117, + 108 + ], + [ + 114, + 229, + 139, + 228 + ], + [ + 37, + 27, + 47, + 97 + ], + [ + 190, + 11, + 182, + 55 + ], + [ + 198, + 121, + 3, + 84 + ], + [ + 249, + 47, + 137, + 130 + ], + [ + 33, + 223, + 248, + 215 + ], + [ + 122, + 118, + 95, + 98 + ], + [ + 224, + 191, + 70, + 244 + ], + [ + 76, + 240, + 243, + 96 + ], + [ + 11, + 178, + 112, + 4 + ], + [ + 172, + 109, + 234, + 72 + ], + [ + 7, + 131, + 178, + 71 + ], + [ + 96, + 242, + 241, + 132 + ], + [ + 98, + 49, + 212, + 48 + ], + [ + 124, + 31, + 214, + 132 + ], + [ + 6, + 189, + 71, + 30 + ], + [ + 8, + 41, + 136, + 53 + ], + [ + 88, + 196, + 174, + 81 + ], + [ + 85, + 60, + 239, + 32 + ], + [ + 78, + 81, + 45, + 191 + ], + [ + 28, + 57, + 99, + 249 + ], + [ + 226, + 195, + 42, + 1 + ], + [ + 72, + 46, + 25, + 16 + ], + [ + 33, + 96, + 147, + 58 + ], + [ + 43, + 3, + 176, + 40 + ], + [ + 14, + 174, + 231, + 154 + ], + [ + 161, + 186, + 100, + 20 + ], + [ + 99, + 85, + 43, + 86 + ], + [ + 211, + 129, + 199, + 241 + ], + [ + 143, + 156, + 172, + 249 + ], + [ + 251, + 108, + 182, + 65 + ], + [ + 60, + 96, + 67, + 219 + ], + [ + 236, + 42, + 89, + 92 + ], + [ + 171, + 139, + 173, + 42 + ], + [ + 226, + 232, + 69, + 131 + ], + [ + 246, + 211, + 70, + 233 + ], + [ + 81, + 58, + 124, + 161 + ], + [ + 97, + 71, + 232, + 130 + ], + [ + 43, + 201, + 253, + 102 + ], + [ + 134, + 168, + 159, + 151 + ], + [ + 243, + 213, + 5, + 122 + ], + [ + 69, + 32, + 68, + 168 + ], + [ + 107, + 4, + 25, + 235 + ], + [ + 168, + 128, + 233, + 238 + ], + [ + 150, + 143, + 228, + 32 + ], + [ + 86, + 194, + 134, + 74 + ], + [ + 253, + 154, + 16, + 116 + ], + [ + 54, + 158, + 143, + 189 + ], + [ + 221, + 173, + 109, + 158 + ], + [ + 120, + 206, + 33, + 234 + ], + [ + 22, + 84, + 209, + 245 + ], + [ + 135, + 58, + 4, + 168 + ], + [ + 238, + 106, + 182, + 34 + ] + ], + "outerClientShuffleKey": [ + 41, + 15, + 52, + 45, + 69, + 53, + 76, + 18, + 75, + 64, + 0, + 71, + 20, + 48, + 25, + 38, + 63, + 11, + 46, + 77, + 50, + 35, + 57, + 84, + 92, + 13, + 60, + 90, + 59, + 37, + 51, + 34, + 30, + 54, + 58, + 14, + 2, + 55, + 17, + 74, + 27, + 83, + 19, + 22, + 65, + 79, + 8, + 21, + 6, + 44, + 7, + 49, + 78, + 67, + 94, + 68, + 89, + 31, + 91, + 4, + 82, + 24, + 43, + 39, + 88, + 10, + 26, + 93, + 56, + 80, + 1, + 47, + 85, + 36, + 87, + 12, + 33, + 73, + 9, + 28, + 3, + 16, + 72, + 29, + 61, + 32, + 81, + 5, + 70, + 86, + 40, + 62, + 23, + 42, + 66 + ], + "outerClientShuffleMediumKey": [ + 2, + 7, + 5, + 9, + 4, + 3, + 1, + 8, + 6, + 0 + ], + "outerClientShuffleFunctionKey": [ + 89, + 93, + 91, + 6, + 37, + 3, + 39, + 45, + 2, + 44, + 86, + 82, + 24, + 15, + 75, + 94, + 84, + 19, + 42, + 83, + 61, + 80, + 90, + 78, + 57, + 8, + 38, + 74, + 27, + 77, + 71, + 29, + 52, + 31, + 16, + 54, + 21, + 53, + 14, + 50, + 46, + 10, + 68, + 49, + 76, + 58, + 88, + 5, + 18, + 79, + 67, + 22, + 62, + 7, + 85, + 60, + 25, + 63, + 70, + 56, + 33, + 4, + 30, + 47, + 1, + 32, + 13, + 51, + 17, + 34, + 0, + 11, + 43, + 69, + 66, + 20, + 55, + 92, + 36, + 9, + 59, + 72, + 26, + 65, + 73, + 81, + 48, + 64, + 87, + 23, + 12, + 35, + 40, + 28, + 41 + ], + "outerClientShuffleFunctionMediumKey": [ + 7, + 9, + 3, + 1, + 8, + 4, + 6, + 0, + 2, + 5 + ], + "clientEphemeral": [ + [ + 120, + 127, + 104, + 100 + ], + [ + 145, + 57, + 44, + 130 + ], + [ + 205, + 50, + 141, + 133 + ], + [ + 156, + 240, + 153, + 167 + ], + [ + 38, + 26, + 223, + 49 + ], + [ + 25, + 115, + 70, + 23 + ], + [ + 49, + 160, + 30, + 90 + ], + [ + 96, + 38, + 208, + 186 + ], + [ + 155, + 91, + 151, + 75 + ], + [ + 63, + 197, + 242, + 69 + ], + [ + 198, + 244, + 113, + 33 + ], + [ + 161, + 114, + 8, + 13 + ], + [ + 237, + 230, + 220, + 221 + ], + [ + 196, + 115, + 226, + 191 + ], + [ + 106, + 159, + 179, + 199 + ], + [ + 23, + 126, + 105, + 87 + ], + [ + 98, + 246, + 57, + 185 + ], + [ + 74, + 66, + 241, + 46 + ], + [ + 222, + 180, + 236, + 177 + ], + [ + 184, + 240, + 195, + 206 + ], + [ + 129, + 123, + 246, + 253 + ], + [ + 141, + 186, + 196, + 223 + ], + [ + 227, + 160, + 82, + 196 + ], + [ + 186, + 232, + 243, + 160 + ], + [ + 233, + 155, + 241, + 189 + ], + [ + 81, + 41, + 93, + 251 + ], + [ + 76, + 183, + 187, + 20 + ], + [ + 46, + 121, + 190, + 155 + ], + [ + 18, + 13, + 2, + 144 + ], + [ + 214, + 226, + 170, + 129 + ], + [ + 122, + 119, + 138, + 249 + ], + [ + 224, + 205, + 161, + 197 + ], + [ + 253, + 74, + 16, + 241 + ], + [ + 108, + 116, + 61, + 146 + ], + [ + 64, + 230, + 169, + 30 + ], + [ + 29, + 244, + 193, + 105 + ], + [ + 11, + 0, + 69, + 52 + ], + [ + 149, + 236, + 144, + 72 + ], + [ + 199, + 164, + 65, + 95 + ], + [ + 113, + 63, + 5, + 31 + ], + [ + 132, + 20, + 225, + 110 + ], + [ + 245, + 56, + 199, + 167 + ], + [ + 79, + 64, + 42, + 96 + ], + [ + 203, + 92, + 224, + 147 + ], + [ + 65, + 121, + 130, + 163 + ], + [ + 28, + 160, + 132, + 101 + ], + [ + 59, + 47, + 71, + 201 + ], + [ + 106, + 96, + 175, + 99 + ], + [ + 15, + 214, + 12, + 145 + ], + [ + 117, + 183, + 148, + 195 + ], + [ + 28, + 123, + 92, + 79 + ], + [ + 53, + 31, + 173, + 34 + ], + [ + 112, + 169, + 236, + 111 + ], + [ + 227, + 128, + 205, + 12 + ], + [ + 82, + 126, + 151, + 38 + ], + [ + 247, + 176, + 49, + 182 + ], + [ + 46, + 79, + 138, + 249 + ], + [ + 106, + 54, + 127, + 79 + ], + [ + 46, + 132, + 88, + 212 + ], + [ + 177, + 99, + 248, + 170 + ], + [ + 214, + 175, + 52, + 6 + ], + [ + 237, + 3, + 8, + 66 + ], + [ + 242, + 47, + 87, + 39 + ], + [ + 142, + 170, + 56, + 202 + ], + [ + 220, + 67, + 146, + 190 + ], + [ + 202, + 99, + 47, + 246 + ], + [ + 19, + 67, + 192, + 239 + ], + [ + 214, + 46, + 45, + 206 + ], + [ + 227, + 142, + 162, + 226 + ], + [ + 123, + 41, + 245, + 250 + ], + [ + 3, + 251, + 183, + 229 + ], + [ + 125, + 66, + 177, + 164 + ], + [ + 247, + 107, + 67, + 129 + ], + [ + 197, + 52, + 41, + 118 + ], + [ + 221, + 119, + 145, + 141 + ], + [ + 243, + 117, + 89, + 182 + ], + [ + 233, + 15, + 33, + 65 + ], + [ + 49, + 238, + 72, + 149 + ], + [ + 216, + 35, + 49, + 156 + ], + [ + 242, + 193, + 161, + 130 + ], + [ + 189, + 124, + 12, + 25 + ], + [ + 244, + 211, + 87, + 85 + ], + [ + 108, + 179, + 14, + 116 + ], + [ + 104, + 173, + 95, + 183 + ], + [ + 123, + 171, + 170, + 11 + ], + [ + 67, + 62, + 36, + 141 + ], + [ + 195, + 25, + 6, + 59 + ], + [ + 214, + 236, + 7, + 57 + ], + [ + 51, + 217, + 254, + 205 + ], + [ + 18, + 238, + 113, + 171 + ], + [ + 5, + 128, + 172, + 82 + ], + [ + 76, + 103, + 237, + 75 + ], + [ + 234, + 187, + 72, + 101 + ], + [ + 219, + 24, + 7, + 20 + ], + [ + 44, + 115, + 151, + 251 + ] + ], + "clientEphemeralMedium": [ + [ + 31, + 219, + 227, + 172 + ], + [ + 192, + 164, + 50, + 125 + ], + [ + 65, + 112, + 254, + 84 + ], + [ + 13, + 218, + 70, + 148 + ], + [ + 144, + 72, + 175, + 57 + ], + [ + 2, + 236, + 97, + 127 + ], + [ + 97, + 165, + 251, + 51 + ], + [ + 251, + 100, + 247, + 203 + ], + [ + 0, + 62, + 169, + 204 + ], + [ + 86, + 136, + 1, + 122 + ] + ], + "clientShuffleEphemeralA": [ + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 2, + 3, + 0 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 1, + 2, + 0, + 3 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 0, + 3, + 2, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 1, + 2, + 0 + ], + [ + 2, + 1, + 3, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 1, + 0, + 3, + 2 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 0, + 2, + 3, + 1 + ], + [ + 2, + 1, + 0, + 3 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 3, + 0, + 2, + 1 + ], + [ + 3, + 1, + 0, + 2 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 0, + 2, + 1, + 3 + ], + [ + 2, + 0, + 3, + 1 + ], + [ + 1, + 3, + 0, + 2 + ], + [ + 3, + 0, + 1, + 2 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 1, + 3, + 2, + 0 + ], + [ + 0, + 1, + 2, + 3 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 3, + 2, + 1, + 0 + ], + [ + 2, + 3, + 0, + 1 + ] + ], + "clientShuffleEphemeralMediumA": [ + [ + 3, + 0, + 2, + 1 + ], + [ + 0, + 3, + 1, + 2 + ], + [ + 2, + 0, + 1, + 3 + ], + [ + 2, + 3, + 1, + 0 + ], + [ + 3, + 2, + 0, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 2, + 3, + 0, + 1 + ], + [ + 1, + 0, + 2, + 3 + ], + [ + 0, + 1, + 3, + 2 + ], + [ + 2, + 1, + 0, + 3 + ] + ] + } +} \ No newline at end of file diff --git a/utils_test.ipynb b/utils_test.ipynb new file mode 100644 index 0000000..9b6216c --- /dev/null +++ b/utils_test.ipynb @@ -0,0 +1,120 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true, + "ExecuteTime": { + "end_time": "2023-12-27T16:48:00.857374Z", + "start_time": "2023-12-27T16:48:00.827545Z" + } + }, + "outputs": [], + "source": [ + "from src.darc_key import DarcKey" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "outputs": [], + "source": [ + "rows = 4\n", + "columns = 26\n", + "input_block_length = 10" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-12-27T16:48:01.105305Z", + "start_time": "2023-12-27T16:48:01.097428Z" + } + } + }, + { + "cell_type": "code", + "execution_count": 3, + "outputs": [], + "source": [ + "serverEphemeralKey = DarcKey.init_mask_matrix(rows, columns, 255)" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-12-27T16:48:02.630012Z", + "start_time": "2023-12-27T16:48:02.626613Z" + } + } + }, + { + "cell_type": "code", + "execution_count": 3, + "outputs": [], + "source": [ + "a = \"8\t\t\t\t\t\t\t\t\t1\t\t\t\t\t\t\t\t\t4\t\t\t\t\t\t\t\t\t5\t\t\t\t\t\t\t\t\t2\t\t\t\t\t\t\t\t\t3\t\t\t\t\t\t\t\t\t7\t\t\t\t\t\t\t\t\t6\t\t\t\t\t\t\t\t\t0\t\t\t\t\t\t\t\t\t9\t\t\t\t\t\t\t\t\"" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-01-16T01:13:13.747045Z", + "start_time": "2024-01-16T01:13:13.739449Z" + } + } + }, + { + "cell_type": "code", + "execution_count": 4, + "outputs": [ + { + "data": { + "text/plain": "['8', '1', '4', '5', '2', '3', '7', '6', '0', '9']" + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a.split()" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-01-16T01:13:14.470781Z", + "start_time": "2024-01-16T01:13:14.467313Z" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + } + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}