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