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