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
218
223
162
31
87
190
y1
5
207
183
24
143
194
y2
252
49
10
66
154
205
y3
96
139
172
67
61
177
y4
149
187
157
77
196
145
y5
57
86
155
181
129
129
y6
243
145
63
164
56
219
z 1 x0 x1 x2 x3 x4 x5
y0
51
114
143
252
136
88
y1
228
31
140
242
88
73
y2
174
26
124
4
227
173
y3
242
187
175
83
179
12
y4
227
235
175
88
6
146
y5
255
157
217
98
21
119
y6
204
100
197
48
136
49
z 2 x0 x1 x2 x3 x4 x5
y0
100
153
184
87
13
194
y1
124
71
249
142
103
115
y2
15
112
100
150
200
121
y3
80
197
192
221
228
56
y4
118
200
200
17
110
119
y5
102
109
41
153
13
12
y6
210
212
207
26
243
170
z 3 x0 x1 x2 x3 x4 x5
y0
110
143
5
122
63
118
y1
147
30
144
16
21
74
y2
45
174
38
64
218
20
y3
11
56
194
39
118
217
y4
120
131
31
167
23
65
y5
29
45
182
14
229
21
y6
189
74
146
105
93
0
z 4 x0 x1 x2 x3 x4 x5
y0
160
162
233
150
49
147
y1
85
149
2
237
46
45
y2
65
164
140
37
58
175
y3
123
204
147
105
244
54
y4
191
4
12
42
220
27
y5
76
119
49
254
174
204
y6
110
82
32
204
9
38
z 5 x0 x1 x2 x3 x4 x5
y0
92
111
73
198
160
157
y1
217
19
209
223
241
15
y2
207
197
54
95
60
69
y3
103
231
225
247
205
243
y4
162
138
72
106
217
228
y5
240
57
234
124
6
26
y6
37
105
198
14
124
165
z 6 x0 x1 x2 x3 x4 x5
y0
179
100
150
120
72
226
y1
245
21
246
151
41
180
y2
170
236
71
109
105
152
y3
74
68
70
59
144
118
y4
230
79
22
189
155
25
y5
141
32
207
240
87
167
y6
108
207
223
226
156
242
z 7 x0 x1 x2 x3 x4 x5
y0
220
101
216
213
31
181
y1
197
5
77
200
248
77
y2
89
151
131
123
218
121
y3
147
133
121
121
161
98
y4
25
166
143
161
152
158
y5
138
53
121
138
55
167
y6
49
169
127
158
71
12
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: 95,59,217,111,183,29,28,43,72,24,234,213,3,81,142,166,214,31,149,86,65,32,211,61,33,27,50,86,122,87,117,153,236,31,182,183,78,46,187,37,244,198,161,196,130,99,149,223,62,243,246,235,223,121,84,115,188,7,76,27,27,181,126,240,179,201,55,251,229,106,48,224,184,227,32,242,251,39,107,1,102,138,8,106,29,34,230,213,202,130,139,238,19,98,188,179,161,56,174,91,36,130,239,211,170,145,174,165,63,130,223,68,31,130,116,107,21,224,2,249,250,4,13,71,186,255,63,176, instruction: D param: 124
Generating data: 214,115,20,39,96,95,36,215,174,171,13,188,192,223,1,216,182,34,239,164,78,198,250,74,53,102,59,45,236,107,40,65,235,250,27,65,23,28,84,104,247,85,141,161,10,184,82,228,175,155,115,238,175,143,32,250,97,94,233,195,189,176,228,165,169,196,12,97,207,96,68,20,201,66,248,178,137,157,191,233,193,226,169,153,133,79,223,39,186,138,242,246,232,146,244,179,174,53,126,185,172,49,7,96,87,241,177,17,7,35,226,246,1,201,49,109,195,244,135,255,51,11,183,109, instruction: B param: 125
Generating data: 28,40,161,82,39,156,52,31,37,114,74,62,75,52,34,76,160,82,95,116,162,187,229,30,247,219,5,144,119,53,201,48,111,182,42,19,15,22,198,158,58,13,244,29,86,185,120,99,94,127,181,17,207,143,111,111,112,15,211,59,245,239,226,252,131,143,194,159,188,6,77,214,204,198,125,103,32,163,98,21,108,194,165,163,178,136,125,142,56,255,80,54,253,234,226,221,208,240,191,203,242,48,121,202,24,161,107,25,172,245,145,76,173,133,105,126,75,223,199,179,143,131,133,13,8, instruction: L param: 134
Generating data: 174,236,242,35,39,148,111,248,143,229,22,251,245,248,242,150,249,48,113,254,62,33,161,246,146,29,100,131,91,234,209,202,120,126,115,14,87,163,120,120,135,128,71,29,14,15,1,6,250,29,75,197,248,60,127,219,9,205,74,151,53,211,67,123,81,67,58,224,189,94,95,107,140,173,241,223,249,148,129,93,229,33,161,146,138,142,34,122,82,198,51,168,175,80,81,16,243,192,40,31,71,83,143,200,172,212,22,60,54,231,63,224,83,156,186,229,180,211,167,128,79,227,53,219,189,178,182,205,158,184,9,119,208,140, instruction: C param: 127
instruction: I param: 047
instruction: U param: 123
Generating data: 179,208,116,11,118,187,142,109,43,8,55,201,188,6,22,25,59,146,190,19,250,14,135,250,246,166,37,99,195,170,94,136,244,216,127,10,96,66,40,194,49,234,18,164,173,195,111,204,29,153,67,4,211,137,43,188,181,142,164,99,72,93,15,150,229,175,178,184,173,196,220,73,140,236,194,135,81,132,127,65,195,2,237,225,203,222,198,149,225,55,118,191,17,185,178,35,154,38,25,150,79,216,166,186,180,216,208,172,98,223,35,141,67,188,29,252,143,103,72,91,13,158,217, instruction: F param: 126
Generating data: 59,210,192,222,90,42,212,109,70,2,208,9,225,27,213,176,179,167,101,202,31,146,47,13,232,211,183,91,170,166,164,196,23,88,182,130,70,168,12,214,81,237,197,209,167,109,78,6,226,3,66,185,22,250,253,237,33,140,66,59,179,207,96,229,82,52,7,61,24,187,107,20,219,249,4,121,128,119,65,67,158,55,129,84,34,59,39,114,66,90,43,32,95,101,172,112,126,148,142,208,227,155,93,60,44,38,6,196,115,70,64,123,189,220,224,52,235,25,13,162,151,41,215,49,92,213, instruction: A param: 2
instruction: K param: 2
instruction: R param: 124
Generating data: 64,227,119,96,177,10,213,222,223,252,143,195,116,169,60,229,91,174,30,251,33,56,181,147,42,186,247,209,234,133,201,76,167,15,246,43,34,221,17,229,54,59,137,110,137,53,175,199,218,226,140,203,119,208,45,26,79,251,127,120,181,4,215,216,223,245,138,209,77,61,250,53,43,74,7,227,31,36,89,239,122,179,4,210,214,218,204,132,188,5,169,92,24,170,96,188,62,245,87,80,205,60,59,77,22,135,171,107,56,137,50,107,15,8,69,167,0,204,60,0,129,90,135,66, instruction: D param: 135
Generating data: 237,154,152,197,81,248,6,169,122,54,24,142,58,210,209,53,188,100,61,89,65,42,157,171,83,101,250,95,247,159,83,182,44,62,127,178,7,200,167,27,171,184,112,118,130,219,248,237,222,78,195,99,34,230,201,168,102,65,38,250,49,172,106,228,91,136,166,73,52,18,234,211,153,37,100,183,201,131,6,149,40,164,193,168,189,50,123,22,102,144,3,188,55,118,254,141,37,179,11,208,72,120,57,136,173,247,27,119,242,79,4,215,159,119,174,50,158,26,205,198,175,172,211,5,97,60,27,46,108,209,254,189,39,250,246, instruction: F param: 136
Generating data: 162,60,107,88,188,147,118,31,177,95,231,119,133,57,159,187,32,133,181,24,168,61,42,246,134,63,94,168,34,170,177,91,225,2,210,183,25,85,246,191,177,237,102,25,116,119,23,223,70,177,51,33,245,218,63,212,140,72,122,195,38,20,158,6,206,116,255,218,200,149,195,123,219,81,158,202,36,218,237,109,67,184,114,41,81,165,20,75,60,7,109,6,234,115,249,210,22,89,136,32,188,85,84,80,57,66,124,160,151,164,7,179,90,14,135,64,174,96,127,252,73,130,233,219,131,101,114,182,219,227,122,114,192,77,81,22, instruction: K param: 3
instruction: B param: 127
Generating data: 0,108,194,107,94,181,101,136,4,164,174,172,173,109,168,64,28,126,236,181,165,151,57,176,62,150,2,114,230,152,180,86,249,75,210,60,21,65,196,40,54,116,28,226,19,62,45,253,47,93,68,115,41,10,111,215,121,62,157,11,122,23,186,209,179,102,139,10,170,216,212,198,156,137,235,142,246,124,196,116,85,129,81,106,45,41,228,84,78,122,121,99,74,95,59,232,39,74,71,127,84,37,235,86,118,99,102,103,107,96,125,79,90,59,231,35,66,90,116,32,6,127,173,80,23,113,246, instruction: R param: 129
Generating data: 80,57,9,59,125,161,176,4,41,227,233,96,96,193,89,211,139,20,223,204,61,168,102,53,26,118,129,13,136,39,91,143,40,57,126,56,195,211,2,9,50,54,68,189,146,150,165,82,219,106,226,174,168,249,127,33,61,228,128,121,207,147,243,221,92,161,236,70,51,22,88,253,101,246,19,139,153,98,159,134,28,178,34,39,41,129,238,41,252,244,15,157,151,236,181,52,49,130,31,204,80,193,63,151,103,158,135,1,180,36,43,45,137,22,89,18,238,41,173,45,150,118,135,143,22,187,44,39,46, instruction: E param: 2
instruction: D param: 38
Generating data: 41,118,214,56,232,158,136,83,190,252,48,87,136,32,202,44,125,157,66,2,104,196,34,241,252,64,212,114,45,84,193,20,88,71,189,92,37,162, instruction: B param: 45
Generating data: 145,129,11,187,172,165,186,127,139,31,160,162,166,176,124,6,228,5,47,94,31,156,175,99,58,131,12,99,1,18,15,75,41,116,15,21,36,123,79,108,77,75,38,3,126, instruction: L param: 46
Generating data: 161,21,67,29,233,40,215,46,156,105,177,38,184,92,100,74,56,163,2,94,163,51,56,111,226,232,233,125,100,193,83,211,136,17,217,201,14,182,123,27,194,59,72,37,167,171, instruction: I param: 03457
instruction: I param: 047
instruction: D param: 26
Generating data: 151,207,242,201,143,11,63,161,244,32,34,9,218,198,215,199,203,235,42,39,212,155,24,173,153,251, instruction: B param: 23
Generating data: 70,223,160,163,119,228,101,131,26,214,120,115,227,1,20,95,45,194,33,115,31,106,195, instruction: A param: 2
instruction: O param: 4
instruction: K param: 2
instruction: R param: 24
Generating data: 196,236,58,197,232,171,122,117,111,173,152,229,183,2,76,216,235,67,43,14,222,88,201,238, instruction: U param: 44
Generating data: 27,85,13,248,23,93,178,45,180,245,243,64,215,177,161,193,60,233,110,149,140,107,250,112,105,133,189,26,101,97,132,97,119,216,18,133,37,215,16,149,220,218,255,46, instruction: F param: 46
Generating data: 5,93,111,72,113,3,58,100,154,59,142,145,129,171,15,150,95,24,203,39,120,97,35,202,44,5,105,52,180,132,72,17,169,47,84,61,146,135,166,77,173,55,145,148,151,179, instruction: K param: 3
instruction: B param: 33
Generating data: 201,74,199,86,200,109,243,252,88,243,224,16,77,191,249,81,48,115,128,246,111,129,233,46,105,116,180,202,174,120,68,4,150, instruction: E param: 3
instruction: O param: 2
instruction: D param: 40
Generating data: 109,253,138,51,118,26,87,255,58,153,86,218,164,197,208,72,215,97,197,62,71,182,78,206,190,65,207,135,14,151,145,211,32,123,12,163,168,74,183,153, instruction: R param: 32
Generating data: 76,119,141,106,53,255,78,135,104,44,72,62,192,59,1,6,193,109,87,168,57,162,173,165,115,229,96,143,33,218,13,29, instruction: L param: 35
Generating data: 145,70,145,5,223,104,129,54,217,21,45,169,118,161,81,59,231,78,239,76,104,152,74,172,55,147,151,150,180,31,159,13,180,26,86, instruction: U param: 25
Generating data: 132,246,194,252,196,122,204,197,151,209,147,6,145,100,48,232,35,107,30,160,167,87,177,158,33, instruction: R param: 28
Generating data: 150,138,136,161,9,136,91,39,212,43,8,115,197,82,153,43,135,249,252,240,176,68,219,187,161,208,163,255,
The resulting data is produced...0 (3)
1 (8)
2 (9)
3 (5)
4 (9)
5 (7)
6 (13)
7 (8)
8 (5)
9 (7)
10 (5)
11 (6)
12 (4)
13 (11)
14 (7)
15 (10)
16 (3)
17 (6)
18 (5)
19 (5)
20 (8)
21 (6)
22 (12)
23 (6)
24 (8)
25 (6)
26 (7)
27 (10)
28 (6)
29 (10)
30 (3)
31 (13)
32 (11)
33 (10)
34 (11)
35 (7)
36 (6)
37 (9)
38 (6)
39 (14)
40 (8)
41 (10)
42 (6)
43 (10)
44 (6)
45 (10)
46 (6)
47 (4)
48 (7)
49 (6)
50 (5)
51 (6)
52 (7)
53 (10)
54 (7)
55 (7)
56 (8)
57 (7)
58 (7)
59 (16)
60 (11)
61 (8)
62 (10)
63 (7)
64 (6)
65 (9)
66 (9)
67 (8)
68 (6)
69 (1)
70 (7)
71 (6)
72 (10)
73 (3)
74 (10)
75 (7)
76 (7)
77 (7)
78 (8)
79 (7)
80 (7)
81 (12)
82 (7)
83 (6)
84 (8)
85 (5)
86 (8)
87 (8)
88 (6)
89 (5)
90 (6)
91 (9)
92 (5)
93 (6)
94 (8)
95 (10)
96 (12)
97 (7)
98 (4)
99 (9)
100 (7)
101 (8)
102 (8)
103 (4)
104 (5)
105 (5)
106 (7)
107 (13)
108 (4)
109 (11)
110 (2)
111 (11)
112 (4)
113 (3)
114 (7)
115 (12)
116 (11)
117 (2)
118 (11)
119 (12)
120 (9)
121 (6)
122 (10)
123 (7)
124 (3)
125 (6)
126 (8)
127 (11)
128 (5)
129 (10)
130 (9)
131 (7)
132 (5)
133 (8)
134 (2)
135 (13)
136 (12)
137 (7)
138 (6)
139 (5)
140 (7)
141 (4)
142 (9)
143 (12)
144 (2)
145 (9)
146 (7)
147 (5)
148 (4)
149 (7)
150 (10)
151 (11)
152 (4)
153 (9)
154 (3)
155 (3)
156 (5)
157 (5)
158 (10)
159 (6)
160 (5)
161 (15)
162 (6)
163 (8)
164 (8)
165 (8)
166 (7)
167 (8)
168 (11)
169 (7)
170 (6)
171 (7)
172 (10)
173 (12)
174 (11)
175 (7)
176 (7)
177 (9)
178 (8)
179 (12)
180 (9)
181 (9)
182 (9)
183 (8)
184 (7)
185 (4)
186 (7)
187 (8)
188 (13)
189 (9)
190 (3)
191 (5)
192 (5)
193 (8)
194 (8)
195 (11)
196 (10)
197 (8)
198 (9)
199 (4)
200 (4)
201 (12)
202 (8)
203 (5)
204 (7)
205 (4)
206 (2)
207 (6)
208 (10)
209 (8)
210 (6)
211 (13)
212 (7)
213 (5)
214 (7)
215 (10)
216 (8)
217 (4)
218 (9)
219 (10)
220 (3)
221 (3)
222 (5)
223 (14)
224 (6)
225 (4)
226 (9)
227 (8)
228 (7)
229 (11)
230 (3)
231 (4)
232 (7)
233 (8)
234 (7)
235 (7)
236 (8)
237 (7)
238 (5)
239 (5)
240 (3)
241 (3)
242 (7)
243 (6)
244 (7)
245 (7)
246 (14)
247 (5)
248 (7)
249 (9)
250 (13)
251 (6)
252 (10)
253 (5)
254 (3)
255 (8)
After processing these instructions, the current state of the map is:
z 0 x0 x1 x2 x3 x4 x5
y0
218
68
162
26
87
190
y1
5
207
183
19
143
194
y2
112
193
231
4
169
184
y3
96
139
172
240
61
177
y4
149
187
157
184
196
145
y5
57
86
155
204
129
129
y6
243
145
63
240
56
219
z 1 x0 x1 x2 x3 x4 x5
y0
51
168
143
252
136
88
y1
228
31
140
242
88
73
y2
174
26
124
4
227
254
y3
242
187
175
83
179
12
y4
227
235
175
77
6
146
y5
255
157
217
249
21
119
y6
204
100
197
48
136
49
z 2 x0 x1 x2 x3 x4 x5
y0
100
220
184
84
13
194
y1
124
117
249
254
103
115
y2
15
201
100
168
200
125
y3
80
79
192
93
228
56
y4
118
21
200
67
110
239
y5
102
5
41
198
13
12
y6
210
219
207
104
221
124
z 3 x0 x1 x2 x3 x4 x5
y0
110
236
5
122
63
118
y1
147
30
144
16
21
74
y2
45
174
38
64
218
123
y3
11
56
194
39
118
217
y4
120
131
31
195
23
65
y5
29
45
182
185
229
21
y6
189
74
146
105
93
0
z 4 x0 x1 x2 x3 x4 x5
y0
160
185
233
150
49
147
y1
85
149
2
237
46
45
y2
65
164
140
37
58
246
y3
123
204
147
105
244
54
y4
191
4
12
185
220
27
y5
76
119
49
95
174
204
y6
110
82
32
204
9
38
z 5 x0 x1 x2 x3 x4 x5
y0
92
229
73
198
160
37
y1
217
19
209
223
241
206
y2
207
197
54
95
60
95
y3
103
231
225
247
205
141
y4
116
62
195
66
70
254
y5
240
57
234
50
6
134
y6
37
105
198
14
124
74
z 6 x0 x1 x2 x3 x4 x5
y0
179
194
150
39
72
226
y1
245
201
246
33
41
180
y2
170
235
71
97
105
83
y3
74
123
70
16
144
118
y4
230
43
22
243
155
25
y5
35
2
207
121
87
167
y6
108
253
223
96
156
100
z 7 x0 x1 x2 x3 x4 x5
y0
220
28
216
213
31
181
y1
197
5
77
200
248
77
y2
89
151
131
123
218
166
y3
147
133
121
121
161
98
y4
25
166
143
1
152
158
y5
138
53
121
99
55
167
y6
49
169
127
158
71
12
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: ³£Bâ×Kµ
Hh´J?»´4¤.
Reversing the modification turns: ³£Bâ×Kµ
Hh´J?»´4¤ 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.