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