Cody

# Problem 44964. Optimal Asymmetric Encryption Padding of message for RSA Cryptography

Solution 1924711

Submitted on 7 Sep 2019 by David Hill
• Size: 255
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
M = 'I like to swim.'; L = 'abcdefghijklmnopqrstuvwxyz'; seed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172]; k = 100; EM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,148,12,50,108,248,32,94]; assert(isequal(EMEOAEPencoding(M,L,seed,k),EM))

2   Pass
M = 'People who succeed have momentum. The more they succeed, the more they want to succeed and the more they find a way to succeed. Similarly, when someone is failing, the tendency is to get on a downward spiral that can even become a self-fulfilling prophecy.'; L = ''; seed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172]; k = 300; EM = [0 145 194 62 62 111 86 188 50 37 165 231 16 42 25 79 223 177 117 187 135 200 203 136 184 133 38 175 66 35 142 212 144 116 66 37 151 8 190 218 29 238 213 11 189 225 88 83 218 175 183 98 58 237 89 80 123 64 40 154 137 44 13 186 97 133 92 11 228 32 100 188 61 37 150 198 178 73 252 17 133 233 68 13 39 99 3 239 108 106 202 227 127 142 79 34 126 244 41 92 240 8 127 153 251 25 82 79 247 92 187 51 84 38 104 240 52 209 144 160 144 119 131 67 128 116 98 132 51 79 8 114 69 202 80 243 194 61 17 33 225 232 173 5 153 230 32 155 34 62 72 2 211 212 227 5 115 217 33 189 21 170 51 190 217 119 148 73 209 109 114 90 104 237 168 60 144 120 191 7 186 8 205 111 192 249 192 197 34 225 209 153 234 5 27 165 82 42 132 167 158 64 218 239 71 49 166 27 37 9 154 2 255 193 72 75 7 121 121 240 74 116 185 58 79 106 68 14 17 49 68 96 160 2 75 15 122 144 36 47 230 112 39 221 21 141 251 178 10 215 180 230 184 189 112 108 187 83 94 157 69 140 201 40 158 119 28 159 116 196 206 112 91 141 68 122 113 183 92 111 44 149 187 223 179 157 29 79 180 231 38 122 231 82 98 42 69 14 162 53]; assert(isequal(EMEOAEPencoding(M,L,seed,k),EM))

3   Pass
M = 'First, have a definite, clear practical ideal; a goal, an objective. Second, have the necessary means to achieve your ends; wisdom, money, materials, and methods.'; L = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; seed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172]; k = 825; EM = [0 85 82 177 212 151 6 148 36 245 178 209 163 30 35 103 231 155 104 206 51 230 201 47 178 114 199 15 172 217 175 58 48 240 133 0 186 218 10 200 31 238 213 10 237 132 55 35 182 202 151 21 82 130 121 35 14 35 75 255 236 72 45 210 0 243 57 43 137 79 9 217 83 81 227 171 156 105 168 121 224 201 41 98 85 6 35 155 4 15 179 195 12 251 44 65 27 145 77 112 208 124 23 252 219 116 61 61 146 124 207 91 49 95 72 135 85 191 228 128 228 24 163 48 245 23 1 225 86 43 40 19 43 174 112 135 170 88 49 76 142 154 200 37 237 142 69 226 2 88 33 108 183 244 130 37 4 184 88 157 97 197 19 205 172 20 247 44 180 9 92 122 59 132 197 85 252 25 205 107 195 36 237 24 168 156 174 229 81 142 188 252 133 107 126 133 59 89 164 193 255 41 182 134 41 86 138 59 81 97 255 34 139 164 38 47 98 23 26 137 106 29 202 26 59 5 100 105 116 69 100 15 206 34 42 47 30 255 83 65 145 17 85 185 53 254 139 219 120 182 216 198 204 213 17 24 155 48 63 243 101 233 191 77 240 87 126 250 23 171 163 21 123 236 100 9 20 219 58 66 74 224 215 185 218 241 113 38 218 128 6 10 149 61 18 66 32 109 219 27 107 176 90 163 116 99 71 16 108 89 192 253 121 121 76 157 101 157 217 51 53 248 195 95 93 183 71 29 199 2 182 31 120 35 167 44 189 160 2 154 234 162 113 204 18 138 81 155 86 122 147 44 23 181 90 135 49 235 41 194 82 181 31 45 131 78 127 198 121 132 49 6 186 66 157 159 79 110 184 152 83 107 73 61 22 86 160 156 200 177 64 217 32 251 102 4 165 143 254 215 165 224 110 76 57 69 13 198 180 106 236 11 39 238 0 220 63 109 239 190 19 85 92 23 28 183 233 72 88 193 8 101 127 214 171 7 94 156 148 220 40 84 44 149 7 245 165 150 197 27 93 255 146 15 132 133 174 208 4 156 246 12 37 50 78 85 95 212 198 41 22 138 214 135 145 197 137 114 172 128 48 126 202 198 0 35 15 37 127 1 34 44 164 46 131 12 87 254 9 210 140 50 85 180 173 121 24 14 192 237 75 224 91 242 205 155 8 136 51 38 161 6 129 234 36 1 56 251 11 6 73 36 74 230 95 174 47 94 53 106 142 71 123 88 32 41 7 108 41 101 40 120 254 196 47 251 83 224 181 114 255 127 56 6 182 182 153 244 162 214 115 183 162 69 47 174 112 68 89 110 180 43 47 159 195 123 73 230 230 186 204 129 110 234 218 152 57 154 232 91 68 237 204 222 179 175 192 249 1 128 5 180 93 29 14 97 175 138 175 221 223 219 62 93 142 51 123 194 90 6 215 32 181 60 48 92 100 114 28 164 71 110 244 129 190 125 27 156 223 133 7 128 55 127 93 3 21 66 38 184 50 52 6 164 175 17 255 103 42 28 126 66 19 149 66 6 234 170 194 104 85 42 166 171 117 101 33 74 35 181 46 242 102 192 226 183 132 223 154 97 142 119 107 6 98 93 129 255 247 144 159 12 245 161 179 28 1 228 24 38 147 55 148 10 247 224 154 201 241 32 53 23 219 52 0 124 35 47 36 89 180 68 57 183 240 94 235 86 152 105 26 113 72 38 83 194 138 16 45 187 50 207 192 151 54 80 108 139 211 116 186 176 20 250 32 117 237 241 239 224 147 110 22 190 71 59 47 97 8 144 236 102 8 216 238 225 40 212 181 238 106 223 38 121 175 55 54 194 114 234 213 89 36 150 177 249 96 235 51 12 205 84 247 160 76]; assert(isequal(EMEOAEPencoding(M,L,seed,k),EM))