ratPad Encryption Algorithm 0.1
Quite a whopping monster of a hash! by Jacob Muñoz Seeking peer review!
ratPad is an attempt to generate large streams of pseudo-random data for general encryption, hashing, authentication, and other various security purposes. The most notable feature of ratPad is the 'grid' of data and the 'maze' of instructions used to traverse through the grid. As cells are traversed, their values are transmitted and then modified by various flags and instructions. The result is a constantly-changing 3-dimensional array of values and a stream of values that can be reproduced predictably by any party with the proper starting data.
ratPad is purely for experimental use only, it most likely has exploitable weaknesses that have not yet been discovered.
In this example, a 'password' or 'secret' is used with a hashing algorithm (not shown here) to generate unique data values:
- Maze dimensions (x,y,z): [6,7,8]
- Cursor location (x,y,z): [3,4,5]
- Face:1
- Orientation:2
- Instructions: E0 O0 A1 M3 I127 R128 D124 B125 L134 C127 I047 U123 F126 A2 K2 R124 D135 F136 K3 B127 R129 E2 D38 B45 L46 I03457 I047 D26 B23 A2 O4 K2 R24 U44 F46 K3 B33 E3 O2 D40 R32 L35 U25 R28
- Maze cell values can be kept from previous connections or filled with incoming values if the connection is new:
z 0 x0 x1 x2 x3 x4 x5
y0
33
196
245
192
185
206
y1
12
157
51
42
205
116
y2
178
179
186
254
214
211
y3
206
139
130
60
120
51
y4
34
249
158
214
127
0
y5
19
92
213
37
150
235
y6
130
109
51
101
42
86
z 1 x0 x1 x2 x3 x4 x5
y0
175
167
157
223
54
201
y1
140
246
47
185
240
166
y2
31
207
226
47
183
67
y3
132
177
76
253
9
254
y4
113
221
60
101
169
159
y5
190
82
57
248
154
38
y6
172
169
224
59
254
193
z 2 x0 x1 x2 x3 x4 x5
y0
181
113
110
197
157
185
y1
153
233
251
87
150
58
y2
141
79
20
46
209
11
y3
105
16
106
155
189
154
y4
161
0
199
232
74
160
y5
219
140
152
122
181
226
y6
49
98
146
248
45
41
z 3 x0 x1 x2 x3 x4 x5
y0
77
195
72
235
167
115
y1
165
230
45
111
251
26
y2
159
249
101
141
232
184
y3
152
38
12
132
122
11
y4
80
78
133
65
155
194
y5
141
236
183
242
31
82
y6
90
176
95
20
128
147
z 4 x0 x1 x2 x3 x4 x5
y0
98
131
92
13
115
46
y1
97
223
43
148
222
9
y2
210
120
93
2
106
79
y3
130
69
226
234
4
50
y4
206
39
40
218
160
245
y5
68
193
157
214
29
74
y6
121
110
89
187
76
110
z 5 x0 x1 x2 x3 x4 x5
y0
250
121
63
32
2
250
y1
15
246
242
36
170
45
y2
184
112
242
127
110
30
y3
182
50
235
190
3
229
y4
131
252
33
84
145
235
y5
22
14
196
214
144
238
y6
120
222
75
56
96
98
z 6 x0 x1 x2 x3 x4 x5
y0
154
114
150
101
15
77
y1
38
158
158
20
167
254
y2
171
132
253
209
80
18
y3
174
226
167
248
49
197
y4
120
126
198
253
236
182
y5
10
135
77
154
198
36
y6
172
46
147
116
46
229
z 7 x0 x1 x2 x3 x4 x5
y0
162
161
199
26
245
33
y1
81
210
226
8
111
51
y2
246
123
158
55
115
141
y3
103
240
179
81
55
204
y4
21
195
220
92
246
64
y5
174
147
107
18
15
188
y6
229
126
55
44
83
4
With those starting values, the instructions are processed accoring to the following rules:L#, R#, U#, D#, F#, B# = left, right, up, down, front, back #
K# = skip #
A# = accumulate 1=increment 2=decrement 3=clear
I# = invert bit #
C# = reset bit #
O# = change map orientation to #
E# = change map facing direction to #
Q# = quote # bytes from
N# = insert # bytes of random noise
M# = modify cell function 0=none, 1=accumulate from acc, 2=multiply by acc and reduce by inverted acc, 3=add inverted*3.14159
instruction: E param: 0
instruction: O param: 0
instruction: A param: 1
instruction: M param: 3
instruction: I param: 127
instruction: R param: 128
Generating data: 23,250,121,125,154,246,233,32,225,225,204,95,166,255,35,187,15,229,196,78,164,98,220,19,101,71,24,10,183,29,214,216,251,43,253,228,18,179,49,143,180,242,89,47,8,2,215,90,39,55,90,146,215,174,191,1,168,159,65,24,226,90,43,147,142,162,210,167,180,154,149,104,31,241,194,44,157,151,159,202,22,235,215,69,47,218,77,132,205,164,198,237,186,191,107,76,15,155,225,78,45,50,72,54,206,146,169,252,45,69,252,227,179,60,136,204,238,44,113,90,75,4,159,232,158,154,171,192, instruction: D param: 124
Generating data: 178,16,22,59,93,70,255,83,184,244,50,94,108,143,74,11,156,227,10,39,17,20,45,22,172,27,125,172,216,52,90,55,29,202,167,68,20,190,207,246,165,135,118,136,83,13,156,112,114,117,98,90,119,80,78,74,87,81,98,243,250,22,69,119,159,178,199,66,181,233,139,117,56,250,221,161,49,47,36,46,78,143,103,75,119,154,245,44,38,29,44,197,160,52,129,183,230,51,247,73,61,53,7,166,105,146,93,117,147,189,156,143,114,111,253,227,175,136,130,121,130,137,215,161, instruction: B param: 125
Generating data: 240,168,191,250,201,90,104,64,201,166,96,239,44,4,149,157,77,44,31,169,2,40,28,248,246,12,50,2,121,214,254,44,108,217,44,73,10,189,68,145,71,231,48,96,120,68,34,10,6,25,232,148,24,24,58,111,164,4,52,25,19,112,191,92,49,178,7,33,81,10,212,179,193,148,22,110,18,46,103,177,105,90,84,15,18,109,16,216,196,204,221,247,90,23,29,73,153,82,254,128,75,88,196,114,82,66,95,84,72,105,42,12,9,34,76,91,117,13,21,58,170,1,58,88,233, instruction: L param: 134
Generating data: 195,197,123,54,228,244,60,145,115,112,155,44,246,222,202,211,177,174,212,31,106,16,109,201,122,228,147,152,84,4,220,113,103,68,52,78,128,94,90,109,143,198,191,179,222,234,228,167,6,101,12,155,224,194,69,4,22,244,141,209,178,212,71,126,106,18,110,19,237,140,139,144,77,80,141,134,116,93,73,126,106,109,108,118,132,28,27,32,54,57,58,60,154,243,66,130,162,195,174,52,241,244,203,129,226,201,243,63,121,113,20,89,239,41,212,212,208,138,36,116,25,202,115,110,103,9,19,206,167,160,183,198,44,231, instruction: C param: 127
instruction: I param: 047
instruction: U param: 123
Generating data: 26,218,33,68,58,118,128,20,46,8,82,73,19,225,123,187,219,23,60,81,111,84,11,222,89,139,200,105,105,132,214,142,149,59,236,21,255,183,151,144,111,185,50,113,40,35,33,62,23,224,142,191,192,230,15,87,147,115,34,240,120,219,18,17,239,29,35,16,167,35,97,190,51,126,132,79,83,249,169,177,95,41,60,44,74,183,24,233,1,34,100,136,99,249,50,131,207,149,123,76,229,65,44,207,200,199,241,224,167,220,127,175,0,161,47,22,168,131,66,208,129,102,134, instruction: F param: 126
Generating data: 158,24,234,192,182,80,66,42,190,182,243,53,237,249,5,59,235,115,238,75,150,217,34,153,163,101,147,83,43,224,221,210,129,103,98,96,158,160,233,64,81,38,42,80,32,238,151,88,113,110,210,16,49,86,81,45,74,251,183,53,146,170,198,231,11,190,153,101,97,37,205,116,219,139,128,157,128,137,172,159,82,57,139,0,238,247,185,136,128,190,133,151,172,236,197,46,163,147,124,119,57,187,250,209,156,155,153,128,140,99,23,65,83,170,36,50,20,231,237,169,222,130,100,139,217,20, instruction: A param: 2
instruction: K param: 2
instruction: R param: 124
Generating data: 30,100,20,234,19,42,81,237,77,105,138,15,175,193,216,246,134,174,70,50,242,26,12,44,202,55,50,69,233,101,142,15,213,197,222,231,179,247,126,199,120,88,132,94,148,81,97,32,51,111,220,99,80,139,91,152,47,101,34,57,205,25,1,38,217,17,255,52,15,156,99,17,252,107,249,132,139,89,200,71,161,26,193,213,196,246,178,192,120,170,41,238,71,199,85,62,97,49,0,90,156,132,36,213,81,25,183,120,9,227,0,38,90,18,102,186,36,244,90,91,245,86,87,107, instruction: D param: 135
Generating data: 3,246,67,145,21,252,221,78,109,244,123,126,138,93,192,149,176,15,129,185,16,253,88,230,121,196,143,241,244,110,148,67,98,237,52,234,152,30,187,15,51,171,19,101,21,212,223,51,178,55,213,222,116,127,140,153,176,157,43,104,31,61,194,97,30,219,64,117,196,170,146,12,10,150,21,246,184,188,220,116,24,71,175,110,9,37,184,4,108,65,245,9,145,201,91,129,112,130,131,6,225,186,173,143,47,214,196,234,100,163,125,141,135,182,105,201,209,82,27,220,103,124,215,22,70,219,209,0,186,189,129,217,240,151,245, instruction: F param: 136
Generating data: 224,16,184,200,253,253,176,3,27,69,199,248,184,78,202,47,238,57,110,248,136,117,195,128,0,171,70,83,182,238,121,107,159,145,243,180,100,180,89,222,78,79,208,179,51,89,137,146,173,84,150,83,66,218,31,3,239,119,27,132,254,62,79,160,33,183,2,171,177,49,134,72,99,216,41,172,139,210,74,59,34,236,167,229,182,76,137,196,162,73,200,49,181,147,63,79,11,200,86,171,42,195,17,153,36,81,183,120,4,254,115,226,52,223,129,246,24,191,206,196,102,152,5,33,67,55,255,132,50,190,81,224,67,204,206,222, instruction: K param: 3
instruction: B param: 127
Generating data: 43,117,14,21,39,125,113,110,113,113,80,51,245,26,15,47,204,59,56,75,21,158,165,119,5,144,240,92,86,244,85,87,102,47,39,228,83,76,119,101,74,65,61,236,46,118,120,108,118,116,92,34,16,65,105,128,30,180,188,186,151,10,141,5,104,31,25,50,117,85,96,39,57,206,29,9,44,199,15,6,91,243,85,80,103,41,62,249,53,39,72,1,142,215,136,107,133,6,191,173,166,191,99,176,15,214,199,195,239,182,232,106,228,187,191,151,14,143,12,111,13,10,69,169,5,243,32, instruction: R param: 129
Generating data: 74,234,211,201,69,134,225,92,234,240,60,184,26,45,30,23,32,208,89,157,103,182,44,191,74,151,118,82,248,130,201,81,206,191,83,221,169,242,125,84,120,252,148,234,64,247,206,106,120,170,45,185,126,159,118,70,26,184,3,109,93,130,37,168,106,197,200,46,133,190,252,19,35,50,126,113,58,76,47,251,217,150,105,164,86,172,103,181,147,104,69,250,137,22,98,56,102,19,111,24,119,230,76,219,223,96,195,224,45,140,200,19,49,107,137,18,135,35,59,156,11,253,85,206,93,190,194,52,255, instruction: E param: 2
instruction: D param: 38
Generating data: 56,43,237,43,219,88,90,218,7,36,125,119,195,61,3,44,226,151,48,58,123,236,75,129,12,42,198,125,101,130,35,89,205,27,90,216,114,156, instruction: B param: 45
Generating data: 61,29,120,231,129,182,69,229,120,207,125,70,133,109,128,4,184,166,160,143,119,25,206,109,205,151,152,9,142,165,185,157,11,176,11,145,248,95,169,26,205,57,25,147,38, instruction: L param: 46
Generating data: 98,237,90,144,219,239,17,90,71,137,181,134,83,202,112,249,213,183,213,69,200,159,114,146,23,179,39,172,133,242,48,39,14,129,103,43,110,103,9,91,80,203,180,3,6,234, instruction: I param: 03457
instruction: I param: 047
instruction: D param: 26
Generating data: 146,19,131,197,75,73,244,94,157,176,83,100,236,44,186,13,146,43,67,221,114,148,55,219,76,201, instruction: B param: 23
Generating data: 86,55,199,45,114,24,106,204,87,163,55,136,138,142,152,84,46,204,45,7,118,55,180, instruction: A param: 2
instruction: O param: 4
instruction: K param: 2
instruction: R param: 24
Generating data: 149,212,183,202,105,183,70,158,119,9,202,198,110,196,138,91,26,89,69,122,180,50,217,16, instruction: U param: 44
Generating data: 90,156,9,39,214,93,216,62,20,231,63,30,191,209,73,159,151,250,82,24,21,164,117,82,150,121,85,113,129,28,232,135,222,41,224,247,225,75,109,79,153,241,46,73, instruction: F param: 46
Generating data: 54,222,116,140,60,237,134,239,216,155,255,92,149,34,239,11,55,172,114,162,94,60,230,64,224,68,186,59,190,177,177,35,167,140,145,180,37,155,38,187,202,109,241,21,51,104, instruction: K param: 3
instruction: B param: 33
Generating data: 13,26,149,10,238,61,122,123,34,122,63,155,95,72,105,159,156,185,158,89,246,79,48,231,242,38,131,95,63,222,9,98,107, instruction: E param: 3
instruction: O param: 2
instruction: D param: 40
Generating data: 233,239,15,36,245,42,136,183,59,228,106,93,108,58,87,232,210,115,165,49,100,45,54,104,223,79,202,61,152,163,68,166,113,129,99,170,77,118,51,136, instruction: R param: 32
Generating data: 227,5,198,117,245,31,53,116,227,5,8,83,37,62,15,73,93,186,101,65,108,119,29,202,29,127,11,106,63,190,141,99, instruction: L param: 35
Generating data: 53,76,59,141,134,151,67,144,15,218,117,113,220,124,126,64,120,2,196,111,79,172,43,148,143,141,152,83,43,200,63,22,121,201,115, instruction: U param: 25
Generating data: 225,229,206,69,178,166,116,206,225,47,147,248,146,1,67,17,242,211,45,53,235,192,191,102,244, instruction: R param: 28
Generating data: 157,184,198,178,232,104,12,218,31,22,97,49,171,128,75,26,169,55,82,195,160,151,85,54,189,231,118,124,
The resulting data is produced...0 (6)
1 (6)
2 (5)
3 (6)
4 (8)
5 (7)
6 (6)
7 (4)
8 (3)
9 (11)
10 (9)
11 (9)
12 (8)
13 (5)
14 (3)
15 (15)
16 (9)
17 (7)
18 (7)
19 (11)
20 (8)
21 (9)
22 (11)
23 (7)
24 (11)
25 (8)
26 (10)
27 (6)
28 (3)
29 (9)
30 (6)
31 (8)
32 (6)
33 (5)
34 (10)
35 (8)
36 (8)
37 (5)
38 (7)
39 (9)
40 (2)
41 (6)
42 (7)
43 (11)
44 (17)
45 (11)
46 (8)
47 (11)
48 (4)
49 (10)
50 (12)
51 (9)
52 (9)
53 (7)
54 (6)
55 (11)
56 (4)
57 (7)
58 (8)
59 (9)
60 (8)
61 (7)
62 (6)
63 (7)
64 (6)
65 (7)
66 (6)
67 (7)
68 (7)
69 (13)
70 (7)
71 (7)
72 (5)
73 (10)
74 (8)
75 (9)
76 (9)
77 (5)
78 (8)
79 (8)
80 (8)
81 (11)
82 (9)
83 (13)
84 (7)
85 (7)
86 (6)
87 (6)
88 (6)
89 (10)
90 (18)
91 (7)
92 (5)
93 (9)
94 (5)
95 (6)
96 (5)
97 (6)
98 (8)
99 (8)
100 (7)
101 (10)
102 (6)
103 (11)
104 (8)
105 (11)
106 (9)
107 (7)
108 (7)
109 (10)
110 (10)
111 (8)
112 (5)
113 (12)
114 (8)
115 (7)
116 (9)
117 (11)
118 (10)
119 (12)
120 (12)
121 (8)
122 (4)
123 (6)
124 (4)
125 (8)
126 (8)
127 (3)
128 (11)
129 (13)
130 (8)
131 (5)
132 (9)
133 (5)
134 (8)
135 (4)
136 (10)
137 (7)
138 (5)
139 (9)
140 (6)
141 (7)
142 (7)
143 (10)
144 (5)
145 (7)
146 (10)
147 (10)
148 (7)
149 (8)
150 (5)
151 (13)
152 (8)
153 (7)
154 (5)
155 (7)
156 (10)
157 (8)
158 (6)
159 (10)
160 (6)
161 (4)
162 (4)
163 (5)
164 (5)
165 (4)
166 (7)
167 (8)
168 (4)
169 (8)
170 (7)
171 (6)
172 (9)
173 (3)
174 (4)
175 (4)
176 (6)
177 (6)
178 (8)
179 (7)
180 (9)
181 (4)
182 (8)
183 (13)
184 (9)
185 (6)
186 (8)
187 (6)
188 (2)
189 (4)
190 (10)
191 (14)
192 (6)
193 (3)
194 (4)
195 (8)
196 (11)
197 (6)
198 (8)
199 (8)
200 (10)
201 (10)
202 (12)
203 (2)
204 (7)
205 (6)
206 (11)
207 (4)
208 (4)
209 (5)
210 (5)
211 (3)
212 (7)
213 (6)
214 (6)
215 (6)
216 (8)
217 (7)
218 (6)
219 (9)
220 (7)
221 (6)
222 (11)
223 (4)
224 (9)
225 (9)
226 (4)
227 (6)
228 (7)
229 (5)
230 (5)
231 (9)
232 (6)
233 (7)
234 (9)
235 (3)
236 (6)
237 (9)
238 (8)
239 (9)
240 (5)
241 (6)
242 (6)
243 (7)
244 (10)
245 (7)
246 (10)
247 (6)
248 (6)
249 (6)
250 (7)
251 (3)
252 (6)
253 (6)
254 (4)
255 (7)
After processing these instructions, the current state of the map is:
z 0 x0 x1 x2 x3 x4 x5
y0
33
240
245
239
185
206
y1
12
157
51
190
205
116
y2
206
217
222
246
223
191
y3
206
139
130
237
120
51
y4
34
249
158
22
127
0
y5
19
92
213
199
150
235
y6
130
109
51
247
42
86
z 1 x0 x1 x2 x3 x4 x5
y0
175
103
157
223
54
201
y1
140
246
47
185
240
166
y2
31
207
226
47
183
161
y3
132
177
76
253
9
254
y4
113
221
60
40
169
159
y5
190
82
57
176
154
38
y6
172
169
224
59
254
193
z 2 x0 x1 x2 x3 x4 x5
y0
181
233
110
102
157
185
y1
153
57
251
251
150
58
y2
141
29
20
247
209
67
y3
105
214
106
176
189
154
y4
161
24
199
253
74
214
y5
219
215
152
207
181
226
y6
49
210
146
33
209
252
z 3 x0 x1 x2 x3 x4 x5
y0
77
233
72
235
167
115
y1
165
230
45
111
251
26
y2
159
249
101
141
232
120
y3
152
38
12
132
122
11
y4
80
78
133
222
155
194
y5
141
236
183
246
31
82
y6
90
176
95
20
128
147
z 4 x0 x1 x2 x3 x4 x5
y0
98
53
92
13
115
46
y1
97
223
43
148
222
9
y2
210
120
93
2
106
211
y3
130
69
226
234
4
50
y4
206
39
40
216
160
245
y5
68
193
157
229
29
74
y6
121
110
89
187
76
110
z 5 x0 x1 x2 x3 x4 x5
y0
250
201
63
32
2
240
y1
15
246
242
36
170
174
y2
184
112
242
127
110
67
y3
182
50
235
190
3
241
y4
230
145
231
123
210
251
y5
22
14
196
183
144
253
y6
120
222
75
56
96
251
z 6 x0 x1 x2 x3 x4 x5
y0
154
146
150
236
15
77
y1
38
159
158
199
167
254
y2
171
229
253
127
80
108
y3
174
218
167
143
49
197
y4
120
3
198
195
236
182
y5
67
211
77
32
198
36
y6
172
1
147
105
46
46
z 7 x0 x1 x2 x3 x4 x5
y0
162
8
199
26
245
33
y1
81
210
226
8
111
51
y2
246
123
158
55
115
6
y3
103
240
179
81
55
204
y4
21
195
220
5
246
64
y5
174
147
107
131
15
188
y6
229
126
55
44
83
4
Continuous production of the instruction stream is not described in this document, but the high 'running instruction ratio' means there is a reasonable positive entropy gradient. Considering 1896 values have been generated by 44 instructions, it should be reasonably easy to produce a reliable number of new instructions in a manner only predictable to those that have the initial 'secret' or maze state.
The initial instruction string contains several three-digit traversal instructions, and instructions like 'I03457' (invert output bits 0,3,4,5,7) could be easily generated from one or two bytes of newly-generated noise.
Now, the encrypting..
We can now encrypt the text: This is my secret message into an unrecognizable stream: kbâðº_\@NZìÒb 1³Õ=zÊ.
Reversing the modification turns: kbâðº_\@NZìÒb 1³Õ=zÊ back into: This is my secret message. Both parties must know the 'state' and 'grid values' to communicate to the other party.
It is critical that both parties are communicating using synchronized transactions in order for the generated stream to remain identical on both sides. Current plans are to add 'calculated checkpoints' so that if synchronization is lost - both parties can attempt to resynchronize where the next scheduled 'checkpoint' is calculated to be.
It is planned for ratPad to provide a shared-secret key-exchange algorithm that allows two parties to establish fully-populated 'grids' without disclosing critical metadata.
- both parties generate parameters from 'secret'
- both parties populate grid with random data
- both parties begin traversing instruction path and transmitting their grid data to the other
- both parties record incoming grid data and store in local copy of 'remote' grid
- after a pre-determined checkpoint, both parties evaluate whether grids are fully populated
- if both parties are not fully-populated with grid data, they continue processing until the next scheduled checkpoint
- obscurity can be enhanced by discarding some scheduled data to generate entropy and transmitting nonsense until the agreed checkpoint.
- once both parties have filled in grid data, encrypted bi-directional communication can begin
While this method surely isn't full-proof, the burden of calculating on an unknown quantity of potentially meaningless data makes prediction difficult.