Cody

# Problem 44963. Mask Generation Function (MGF1) for PKCS #1 Standard utilizing Optimal Asymmetric Encryption Padding for RSA Cryptography

Solution 2012337

Submitted on 10 Nov 2019
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   Fail

ans = 0×0 empty char array

Unable to resolve the name freepass.please. Error in mgf (line 3) freepass.please; Error in Test1 (line 4) assert(isequal(mgf(mgfSeed,maskLen),mask))

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

ans = 0×0 empty char array

Unable to resolve the name freepass.please. Error in mgf (line 3) freepass.please; Error in Test2 (line 4) assert(isequal(mgf(mgfSeed,maskLen),mask))

3   Fail
mgfSeed = '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.'; maskLen = 300; mask = [96 185 223 209 149 51 224 128 249 139 57 249 190 69 199 132 37 24 75 127 98 59 231 206 13 83 79 111 181 220 204 120 27 178 155 116 155 11 157 112 10 195 106 4 127 146 101 112 197 29 54 45 14 78 16 100 1 111 156 44 138 141 219 101 171 1 126 254 60 82 214 63 13 94 227 238 64 173 93 142 3 224 63 76 8 190 105 8 77 113 250 243 249 82 56 124 129 116 121 131 207 116 80 185 72 184 244 232 236 127 37 195 236 163 176 245 65 48 169 131 19 36 208 178 184 150 188 50 221 83 132 241 73 205 23 9 41 74 65 251 10 21 133 150 101 15 42 153 164 197 136 19 113 134 153 247 10 161 221 184 195 215 253 149 223 83 180 148 198 4 53 112 114 39 18 132 254 170 130 61 6 158 224 166 76 187 190 128 14 251 158 218 192 68 46 210 199 231 120 57 212 10 107 2 50 37 110 30 87 48 2 134 81 165 107 95 250 206 98 26 45 102 173 46 85 103 137 4 140 154 236 142 125 211 28 164 94 41 8 70 215 10 13 140 139 97 205 60 212 205 35 175 235 158 88 165 40 41 187 215 72 172 97 159 119 79 80 31 128 121 108 94 219 216 77 209 184 244 90 238 182 207 244 52 248 6 220 175 117 122 236 228 219 42 49 196 186 12 19 95]; assert(isequal(mgf(mgfSeed,maskLen),mask))

ans = 0×0 empty char array

Unable to resolve the name freepass.please. Error in mgf (line 3) freepass.please; Error in Test3 (line 4) assert(isequal(mgf(mgfSeed,maskLen),mask))