{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":44963,"title":"Mask Generation Function (MGF1) for PKCS #1 Standard utilizing Optimal Asymmetric Encryption Padding for RSA Cryptography","description":"Create Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1 page 50) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\r\n\r\nFor example:\r\n\r\n  mgfSeed = 'I like to swim.';%input\r\n  maskLen = 20;%input\r\n  mask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];%output\r\n\r\n\r\n\u003chttps://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf\u003e","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 194px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 97px; transform-origin: 407px 97px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCreate Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 60px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30px; transform-origin: 404px 30px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emgfSeed = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'I like to swim.'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emaskLen = 20;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function mask = mgf(mgfSeed,maskLen)\r\n    mask = []%octet array of length maskLen\r\nend","test_suite":"%%\r\nmgfSeed = 'I like to swim.';\r\nmaskLen = 20;\r\nmask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))\r\n%%\r\nmgfSeed = '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.';\r\nmaskLen = 825;\r\nmask = [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];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))\r\n%%\r\nmgfSeed = '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.';\r\nmaskLen = 300;\r\nmask = [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];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-09-06T22:10:21.000Z","updated_at":"2025-10-15T14:43:51.000Z","published_at":"2019-09-06T22:31:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[mgfSeed = 'I like to swim.';%input\\nmaskLen = 20;%input\\nmask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];%output]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":44963,"title":"Mask Generation Function (MGF1) for PKCS #1 Standard utilizing Optimal Asymmetric Encryption Padding for RSA Cryptography","description":"Create Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1 page 50) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\r\n\r\nFor example:\r\n\r\n  mgfSeed = 'I like to swim.';%input\r\n  maskLen = 20;%input\r\n  mask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];%output\r\n\r\n\r\n\u003chttps://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf\u003e","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 194px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 97px; transform-origin: 407px 97px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCreate Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 60px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30px; transform-origin: 404px 30px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emgfSeed = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'I like to swim.'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emaskLen = 20;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function mask = mgf(mgfSeed,maskLen)\r\n    mask = []%octet array of length maskLen\r\nend","test_suite":"%%\r\nmgfSeed = 'I like to swim.';\r\nmaskLen = 20;\r\nmask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))\r\n%%\r\nmgfSeed = '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.';\r\nmaskLen = 825;\r\nmask = [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];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))\r\n%%\r\nmgfSeed = '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.';\r\nmaskLen = 300;\r\nmask = [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];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-09-06T22:10:21.000Z","updated_at":"2025-10-15T14:43:51.000Z","published_at":"2019-09-06T22:31:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[mgfSeed = 'I like to swim.';%input\\nmaskLen = 20;%input\\nmask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];%output]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"mgf1\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"mgf1\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"mgf1\"","","\"","mgf1","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2b7184a78\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fa2b71849d8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2b7183f38\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2b7184cf8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2b7184c58\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2b7184bb8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2b7184b18\u003e":"tag:\"mgf1\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2b7184b18\u003e":"tag:\"mgf1\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"mgf1\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"mgf1\"","","\"","mgf1","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2b7184a78\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fa2b71849d8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2b7183f38\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2b7184cf8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2b7184c58\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2b7184bb8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2b7184b18\u003e":"tag:\"mgf1\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2b7184b18\u003e":"tag:\"mgf1\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44963,"difficulty_rating":"medium-hard"}]}}