{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.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":"2026-04-06T00: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":46627,"title":"Output the Montgomery Form of the Input Matrix","description":null,"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: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.5px; vertical-align: baseline; \"\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=\"\"\u003eOutput the Montgomery Form of all the numbers of an input matrix given R and N such that gcd(R,N)=1.\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\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Montgomery_modular_multiplication\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ehttps://en.wikipedia.org/wiki/Montgomery_modular_multiplication\u003c/span\u003e\u003c/span\u003e\u003c/a\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=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function ahat = montgomeryForm(a,R,N)\r\n  ahat=a;\r\nend","test_suite":"%%\r\na =[   53393       10329       42974       46271       28753       18089       49235       55097       23046        4971\r\n       59361       63608        2340        2086       25005       44544       16717       16664       54449        3535\r\n        8322       62728       55648       18148       50168       42932       33158       53364       38355       34786\r\n       59859       31809       61210        3025       52114       10656       45814       15959       36026       51063\r\n       41442       52447       44481        6365       12246        7798       58386       60900       60109       61211\r\n        6392        9298       49659       53966       32097       32660       62868       22936       18732        8513\r\n       18251       27640       48701       45536       29201       62897       35862       12884       49623       37278\r\n       35840       60013       25704       20781       42356       22307        9084       16455       49396       30761\r\n       62751       51918       42957       62273       46488       38356        9784       40373       24932         780\r\n       63234       62881       11218        2257       49459       14667       16876       31017       37212       22093];\r\nahat =[ 1813        2484          77         195        2790         501        1749         523        1988         187\r\n        3109         140         526        2711         798        2194        1399         138        1248        1321\r\n         522          56        1196        2156        3094         648        1319        2128        1921        2806\r\n        2521        1508         244        1121        2160         654        1256         449        3227         834\r\n        1565         724        1386        2953        1865        1622        2335         971        1183        2529\r\n        1397         252        1850        2821         446        1907         372         313        1667         858\r\n        1152        2941        3302        1865        1138          57        1335        1593        2815        1107\r\n        1000        1537          93        3058        2772        1176         625        1949         115         379\r\n        2676         386        1180        2358          19         877        2205        2386         443        1285\r\n        1103         116        3159         624         923        1052        1853        2764         102        1549];\r\n\r\nassert(isequal(montgomeryForm(a,2^16,3329),ahat))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-30T16:26:25.000Z","updated_at":"2025-12-28T03:56:20.000Z","published_at":"2020-09-30T16:26:25.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\u003eOutput the Montgomery Form of all the numbers of an input matrix given R and N such that gcd(R,N)=1.\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:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Montgomery_modular_multiplication\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Montgomery_modular_multiplication\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e \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\"}]}"},{"id":45242,"title":"String to Binary Representation","description":"Given a string, convert it using UTF-8 into a binary array where each character or byte is arraigned low to high. For example:\r\nInput: 'abc', goes to [97 98 99], and then \r\nOuput: [1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1];","description_html":"\u003cp\u003eGiven a string, convert it using UTF-8 into a binary array where each character or byte is arraigned low to high. For example:\r\nInput: 'abc', goes to [97 98 99], and then \r\nOuput: [1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1];\u003c/p\u003e","function_template":"function Output = message2binary(message)\r\n  Output = message;\r\nend","test_suite":"%%\r\nmessage = '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\ny_correct='00001010101001101111011000001110001101101010011000000100111011100001011011110110000001001100111010101110110001101100011010100110101001100010011000000100000101101000011001101110101001100000010010110110111101101011011010100110011101100010111010101110101101100111010000000100001010100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010011001110101011101100011011000110101001101010011000100110001101000000010000101110000101101010011000000100101101101111011001001110101001100000010000101110000101101010011010011110000001001110111010000110011101100010111000000100001011101111011000000100110011101010111011000110110001101010011010100110001001100000010010000110011101100010011000000100001011100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010001100110100101100111011000100110000001001000011000000100111011101000011010011110000001000010111011110110000001001100111010101110110001101100011010100110101001100010011001110100000001001100101010010110101101101001011000110110100001100100111000110110100111100011010000000100111011100001011010100110011101100000010011001110111101101011011010100110111101100111011010100110000001001001011011001110000001000110011010000110100101100011011010010110011101101110011000110100000001000010111000010110101001100000010000101110101001100111011000100110101001100111011011000110100111100000010010010110110011100000010000101110111101100000010011100110101001100010111000000100111101100111011000000100100001100000010000100110111101101110111001110110111011101000011001001110001001100000010011001110000011101001011001001110100001100011011000000100001011100001011010000110001011100000010011000110100001100111011000000100101001100110111010100110011101100000010001000110101001101100011011110110101101101010011000000100100001100000010011001110101001100011011001100110101101000110011010101110001101100110011010010110001101100011011010010110011101101110011000000100000011100100111011110110000011100001011010100110110001101001111001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n%%\r\nmessage = '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\ny_correct='011000101001011001001110110011100010111000110100000001000001011010000110011011101010011000000100100001100000010000100110101001100110011010010110011101101001011000101110101001100011010000000100110001100011011010100110100001100100111000000100000011100100111010000110110001100010111010010110110001101000011000110110000001001001011000100110101001101000011000110110110111000000010010000110000001001110011011110110100001100011011000110100000001001000011001110110000001001111011001000110010101101010011011000110001011101001011001101110101001100111010000000100110010101010011011000110111101100111011000100110001101000000010000010110100001100110111010100110000001000010111000010110101001100000010001110110101001101100011010100110110011101100111010000110010011101001111000000100101101101010011010000110011101101100111000000100001011101111011000000100100001101100011000010110100101101010011001101110101001100000010010011110111101101010111001001110000001001010011001110110001001101100111011011100000001001110111010010110110011100010011011110110101101100011010000000100101101101111011001110110101001101001111000110100000001001011011010000110001011101010011001001110100101101000011000110110110011100011010000000100100001100111011000100110000001001011011010100110001011100001011011110110001001101100111001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n%%\r\nmessage = 'I do not know what I may appear to the world, but to myself I seem to have been only like a boy playing on the seashore, and diverting myself in now and then finding a smoother pebble or a prettier shell than ordinary, whilst the great ocean of truth lay all undiscovered before me.';\r\ny_correct='100100100000010000100110111101100000010001110110111101100010111000000100110101100111011011110110111011100000010011101110000101101000011000101110000001001001001000000100101101101000011010011110000001001000011000001110000011101010011010000110010011100000010000101110111101100000010000101110000101101010011000000100111011101111011001001110001101100010011000110100000001000100011010101110001011100000010000101110111101100000010010110110100111101100111010100110001101100110011000000100100100100000010011001110101001101010011010110110000001000010111011110110000001000001011010000110011011101010011000000100010001101010011010100110011101100000010011110110011101100011011010011110000001000011011010010110110101101010011000000100100001100000010001000110111101101001111000000100000011100011011010000110100111101001011001110110111001100000010011110110011101100000010000101110000101101010011000000100110011101010011010000110110011100001011011110110010011101010011000110100000001001000011001110110001001100000010000100110100101100110111010100110010011100010111010010110011101101110011000000100101101101001111011001110101001100011011001100110000001001001011001110110000001000111011011110110111011100000010010000110011101100010011000000100001011100001011010100110011101100000010001100110100101100111011000100110100101100111011011100110000001001000011000000100110011101011011011110110111101100010111000010110101001100100111000000100000011101010011001000110010001100011011010100110000001001111011001001110000001001000011000000100000011100100111010100110001011100010111010010110101001100100111000000100110011100001011010100110001101100011011000000100001011100001011010000110011101100000010011110110010011100010011010010110011101101000011001001110100111100011010000000100111011100001011010010110001101101100111000101110000001000010111000010110101001100000010011100110010011101010011010000110001011100000010011110110110001101010011010000110011101100000010011110110011001100000010000101110010011101010111000101110000101100000010000110110100001101001111000000100100001100011011000110110000001001010111001110110001001101001011011001110110001101111011001101110101001100100111010100110001001100000010001000110101001100110011011110110010011101010011000000100101101101010011001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n%%\r\nmessage = 'As I considered the matter carefully it gradually came to light that all those matters only were referred to mathematics in which order and measurements are investigated, and that it makes no difference whether it be in numbers, figures, stars, sounds or any other object that the question of measurement arises. I saw consequently that there must be some general science to explain that element as a whole which gives rise to problems about order and measurement, restricted as these are to no special subject matter. This, I perceived was called \"universal mathematics\".';\r\ny_correct='1000001011001110000001001001001000000100110001101111011001110110110011101001011000100110101001100100111010100110001001100000010000101110000101101010011000000100101101101000011000101110001011101010011001001110000001001100011010000110010011101010011001100110101011100011011000110110100111100000010010010110001011100000010011100110010011101000011000100110101011101000011000110110001101101001111000000100110001101000011010110110101001100000010000101110111101100000010000110110100101101110011000010110001011100000010000101110000101101000011000101110000001001000011000110110001101100000010000101110000101101111011011001110101001100000010010110110100001100010111000101110101001100100111011001110000001001111011001110110001101101001111000000100111011101010011001001110101001100000010001001110101001100110011010100110010011100100111010100110001001100000010000101110111101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100000010010010110011101100000010011101110000101101001011011000110000101100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111011001110000001001000011001001110101001100000010010010110011101100110111010100110110011100010111010010110111001101000011000101110101001100010011000110100000001001000011001110110001001100000010000101110000101101000011000101110000001001001011000101110000001001011011010000110110101101010011011001110000001000111011011110110000001000010011010010110011001100110011010100110010011101010011001110110110001101010011000000100111011100001011010100110001011100001011010100110010011100000010010010110001011100000010001000110101001100000010010010110011101100000010001110110101011101011011001000110101001100100111011001110001101000000010001100110100101101110011010101110010011101010011011001110001101000000010011001110001011101000011001001110110011100011010000000100110011101111011010101110011101100010011011001110000001001111011001001110000001001000011001110110100111100000010011110110001011100001011010100110010011100000010011110110010001100101011010100110110001100010111000000100001011100001011010000110001011100000010000101110000101101010011000000100100011101010111010100110110011100010111010010110111101100111011000000100111101100110011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000000100100001100100111010010110110011101010011011001110011101000000010010010010000001001100111010000110111011100000010011000110111101100111011011001110101001101000111010101110101001100111011000101110001101101001111000000100001011100001011010000110001011100000010000101110000101101010011001001110101001100000010010110110101011101100111000101110000001000100011010100110000001001100111011110110101101101010011000000100111001101010011001110110101001100100111010000110001101100000010011001110110001101001011010100110011101101100011010100110000001000010111011110110000001001010011000011110000011100011011010000110100101100111011000000100001011100001011010000110001011100000010010100110001101101010011010110110101001100111011000101110000001001000011011001110000001001000011000000100111011100001011011110110001101101010011000000100111011100001011010010110110001100001011000000100111001101001011001101110101001101100111000000100010011101001011011001110101001100000010000101110111101100000010000001110010011101111011001000110001101101010011010110110110011100000010010000110010001101111011010101110001011100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000110100000001000100111010100110110011100010111001001110100101101100011000101110101001100010011000000100100001101100111000000100001011100001011010100110110011101010011000000100100001100100111010100110000001000010111011110110000001000111011011110110000001001100111000001110101001101100011010010110100001100011011000000100110011101010111001000110010101101010011011000110001011100000010010110110100001100010111000101110101001100100111001110100000001000010101000010110100101101100111000110100000001001001001000000100000011101010011001001110110001101010011010010110011011101010011000100110000001001110111010000110110011100000010011000110100001100011011000110110101001100010011000000100010001001010111001110110100101100110111010100110010011101100111010000110001101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100100010001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-23T03:03:00.000Z","updated_at":"2026-01-09T07:13:47.000Z","published_at":"2019-12-23T03:16:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string, convert it using UTF-8 into a binary array where each character or byte is arraigned low to high. For example: Input: 'abc', goes to [97 98 99], and then Ouput: [1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46630,"title":"Find R*Rp-N*Np=1 given gcd(R,N)=1","description":null,"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: 81px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 40.5px; transform-origin: 407px 40.5px; vertical-align: baseline; \"\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=\"\"\u003eFind Rp and Np, such that R*Rp-N*Np=1, given gcd(R,N)=1.\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=\"\"\u003e0\u0026lt;=Rp\u0026lt;N\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=\"\"\u003e0\u0026lt;=Np\u0026lt;R\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [Rp,Np] = bezout(R,N)\r\n  Rp=R;\r\n  Np=N;\r\nend","test_suite":"%%\r\nR=2.^[12:22];\r\nN=primes(3329);\r\nN=N(end-10:end);\r\n[R,N]=meshgrid(R,N);\r\nRp =[   2925        3089        3171        3212        1606         803        2028        1014         507        1880         940\r\n        1316         658         329        1793        2525        2891        3074        1537        2397        2827        3042\r\n        1538         769        2014        1007        2133        2696        1348         674         337        1798         899\r\n        2256        1128         564         282         141        1706         853        2062        1031        2151        2711\r\n        1486         743        2021        2660        1330         665        1982         991        2145        2722        1361\r\n        3110        1555        2428        1214         607        1954         977        2139        2720        1360         680\r\n         876         438         219        1763        2535        2921        3114        1557        2432        1216         608\r\n        2471        2892        1446         723        2018        1009        2161        2737        3025        3169        3241\r\n        2328        1164         582         291        1805        2562        1281        2300        1150         575        1947\r\n         374         187        1755        2539        2931        3127        3225        3274        1637        2480        1240\r\n        2704        1352         676         338         169        1749        2539        2934        1467        2398        1199];\r\nNp =[   3683        7779       15971       32355       32355       32355      163427      163427      163427     1212003     1212003\r\n        1655        1655        1655       18039       50807      116343      247415      247415      771703     1820279     3917431\r\n        1933        1933       10125       10125       42893      108429      108429      108429      108429     1157005     1157005\r\n        2825        2825        2825        2825        2825       68361       68361      330505      330505     1379081     3476233\r\n        1845        1845       10037       26421       26421       26421      157493      157493      681781     1730357     1730357\r\n        3859        3859       12051       12051       12051       77587       77587      339731      864019      864019      864019\r\n        1085        1085        1085       17469       50237      115773      246845      246845      771133      771133      771133\r\n        3055        7151        7151        7151       39919       39919      170991      433135      957423     2005999     4103151\r\n        2873        2873        2873        2873       35641      101177      101177      363321      363321      363321     2460473\r\n         461         461        8653       25037       57805      123341      254413      516557      516557     1565133     1565133\r\n        3327        3327        3327        3327        3327       68863      199935      462079      462079     1510655     1510655];\r\n[rp,np]=bezout(R,N);\r\nassert(isequal(rp,Rp))\r\nassert(isequal(np,Np))\r\n%%\r\nR=3.^[5:15];\r\nN=primes(15000);\r\nN=N(end-10:end);\r\n[R,N]=meshgrid(R,N);\r\nRp =[  13723       14499        4833        1611         537         179        5022        1674         558         186          62\r\n        1532       10438        8443        7778       12520        9137       12973        9288        3096        1032         344\r\n       13487       14427        4809        1603        5500        6799        7232       12342        4114        6337        7078\r\n        1044         348         116        5013        1671         557        5160        1720       10522       13456       14434\r\n        9154       13004        9311        8080       12646       14168        9699        3233        6054        2018        5649\r\n       12234        4078        6339        2113        5684       11854        8931        2977        5972       11950        8963\r\n       11933        8960        7969       12621        4207       11367        3789        1263         421       10105       13333\r\n        6891        2297       10733       13545        4515        1505       10469       13457       14453       14785        9912\r\n        8371        7776        2592         864         288          96          32        9982        8313        2771       10895\r\n       14661        4887        1629         543         181        5050        6673        7214       12384        4128        1376\r\n        2528        5837        6940       12302        9095        8026       12664       14210        9731        8238        2746];\r\nNp =[    224         710         710         710         710         710       59759       59759       59759       59759       59759\r\n          25         511        1240        3427       16549       36232      154330      331477      331477      331477      331477\r\n         220         706         706         706        7267       26950       85999      440293      440293     2034616     6817585\r\n          17          17          17        2204        2204        2204       61253       61253     1124135     4312781    13878719\r\n         149         635        1364        3551       16673       56039      115088      115088      646529      646529     5429498\r\n         199         199         928         928        7489       46855      105904      105904      637345     3825991     8608960\r\n         194         437        1166        5540        5540       44906       44906       44906       44906     3233552    12799490\r\n         112         112        1570        5944        5944        5944      124042      478336     1541218     4729864     9512833\r\n         136         379         379         379         379         379         379      354673      886114      886114    10452052\r\n         238         238         238         238         238       19921       78970      256117     1318999     1318999     1318999\r\n          41         284        1013        5387       11948       31631      149729      504023     1035464     2629787     2629787];\r\n[rp,np]=bezout(R,N);\r\nassert(isequal(rp,Rp))\r\nassert(isequal(np,Np))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2020-11-10T19:09:02.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2020-09-30T17:23:03.000Z","updated_at":"2025-12-28T03:57:53.000Z","published_at":"2020-09-30T17:23:03.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\u003eFind Rp and Np, such that R*Rp-N*Np=1, given gcd(R,N)=1.\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\u003e0\u0026lt;=Rp\u0026lt;N\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\u003e0\u0026lt;=Np\u0026lt;R\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\"}]}"},{"id":46633,"title":"Montgomery Reduction Algorithm (REDC)","description":null,"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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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=\"\"\u003eGiven a matrix of input numbers T, R, and N such that gcd(R,N)=1 and 0 \u0026lt;= T \u0026lt; R*N, output the Montgomery reduction of T.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function t = REDC(T,R,N)\r\nt=T*R/N;\r\nend","test_suite":"%%\r\nR=2.^[12:22];\r\nN=primes(3329);\r\nN=N(end-10:end);\r\n[R,N]=meshgrid(R,N);\r\nT =[     245        2125        3406        4031        1103        2731        1888         927        2393         733        2175\r\n        2794        3986        3291         685        1732         730        4021        1576         442        1733        2681\r\n         174        2659         248         436        2245         525         641        2388        3713         386        1670\r\n         293        3279        1636        1526        3862        4093        3505        1032        3604        2452        3359\r\n        2137        1859        2159         812        1712         701        2641        1190        3350        1929        2943\r\n         397        1772        1708        2006        4027         134        1542        2528        1068        2851        3968\r\n        3352        3381        2691        1391        1235        2299         783        1087        2435        2867        2177\r\n        3349         342        2573        3898        2872        3613        1755        3377          93        2616        1332\r\n        2960         546        1196        3770        2730        2741        1975        4025        1742         138         433\r\n         614         711        1769         216        2209         781         495        2992        1281         282        2503\r\n        2702        1602          64        3023        2860        1512        2415        1409         662        1310        3190];\r\nt =[     965        2824         466         632        1786         471          83        3114        3135        2021        1616\r\n        3008         903        1415         316        2406        3151         239        2361         949         663          74\r\n         374        1378         845        2346        1114         994         433        2825        3084        3120        2190\r\n         266        2482         282        1831        1556        2344          71        1834        3139        1400        3056\r\n        1944        2255        2061        2374         650        1006        2248        1547         528        2029         437\r\n          96        2426         968        2447        1649        1057        1278         354          80        1986        1323\r\n        3043        2649         683        1846        2303        2169        1003        2582        2390         694         816\r\n        2818        1790          59        2204        1259        1217        2483        2892        3033         978         173\r\n         636        1615        2401        1800        2254        2757         897         809        1943        3013          25\r\n         349          37         913         129        1375        3105        1335        2927         184        1530          38\r\n        2382        2054        3316        3100         635        1262        2996        2717        2415        2133        3118];\r\nassert(isequal(REDC(T,R,N),t))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-30T19:14:40.000Z","updated_at":"2025-12-28T03:59:49.000Z","published_at":"2020-09-30T19:14:40.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\u003eGiven a matrix of input numbers T, R, and N such that gcd(R,N)=1 and 0 \u0026lt;= T \u0026lt; R*N, output the Montgomery reduction of T.\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\"}]}"},{"id":45211,"title":"AES SubBytes() Transformation","description":"Given a 16x2 input character hexadecimal array representing the AES state, execute the AES algorithm SubBytes() transformation and output a 16x2 character hexadecimal array. \r\n\r\nRefer to this link: \u003chttps://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\u003e\r\n\r\nFor example:\r\n\r\n  statei=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\r\n  stateo=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2'];","description_html":"\u003cp\u003eGiven a 16x2 input character hexadecimal array representing the AES state, execute the AES algorithm SubBytes() transformation and output a 16x2 character hexadecimal array.\u003c/p\u003e\u003cp\u003eRefer to this link: \u003ca href = \"https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\"\u003ehttps://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\u003c/a\u003e\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003estatei=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\r\nstateo=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2'];\r\n\u003c/pre\u003e","function_template":"function stateO = SubBytes(stateI)\r\n  stateO = stateI;\r\nend","test_suite":"%%\r\nstateI=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\r\nstateO=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n%%\r\nstateI=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2']; \r\nstateO=['82';'c5';'61';'d4';'70';'4c';'37';'c5';'cb';'08';'4a';'1c';'82';'08';'a8';'3a']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n%%\r\nstateI=['82';'c5';'61';'d4';'70';'4c';'37';'c5';'cb';'08';'4a';'1c';'82';'08';'a8';'3a']; \r\nstateO=['13';'a6';'ef';'48';'51';'29';'9a';'a6';'1f';'30';'d6';'9c';'13';'30';'c2';'80']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n%%\r\nstateI=['13';'a6';'ef';'48';'51';'29';'9a';'a6';'1f';'30';'d6';'9c';'13';'30';'c2';'80']; \r\nstateO=['7d';'24';'df';'52';'d1';'a5';'b8';'24';'c0';'04';'f6';'de';'7d';'04';'25';'cd']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-21T17:35:28.000Z","updated_at":"2025-12-28T04:07:40.000Z","published_at":"2019-11-21T17:45:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a 16x2 input character hexadecimal array representing the AES state, execute the AES algorithm SubBytes() transformation and output a 16x2 character hexadecimal array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRefer to this link:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\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[statei=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\\nstateo=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2'];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45200,"title":"Elliptic Curve Cryptography (ECC) Point Addition","description":"Given two points (P and Q, they can be the same points on the elliptic curve), compute ECC point addition on a Weierstrass elliptic curve: y^2=x^3+a*x+b over the discrete prime field, p (input to function). Inputs, a and b of the elliptic curve and also provided. Output must be point R(x,y)=P+Q.","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: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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=\"\"\u003eGiven two points (P and Q, they can be the same points on the elliptic curve), compute ECC point addition on a Weierstrass elliptic curve: y^2=x^3+a*x+b over the discrete prime field, p (input to function). Inputs, a and b of the elliptic curve are also provided. Output must be point R(x,y)=P+Q.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function R = pointAdd(P,Q,a,b,p)\r\n  R=P;\r\nend","test_suite":"%%\r\nP=[16,20];\r\nQ=[41,120];\r\na=-1;\r\nb=3;\r\np=127;\r\ny_correct = [86,81];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[16,20];\r\nQ=[16,20];\r\na=-1;\r\nb=3;\r\np=127;\r\ny_correct = [97,81];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[97,81];\r\nQ=[97,81];\r\na=-1;\r\nb=3;\r\np=127;\r\ny_correct = [57,10];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[3,6];\r\nQ=[80,10];\r\na=2;\r\nb=3;\r\np=97;\r\ny_correct = [80,87];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[1,2];\r\nQ=[1,2];\r\na=-7;\r\nb=10;\r\np=487;\r\ny_correct = [486,483];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[1,2];\r\nQ=[486,483];\r\na=-7;\r\nb=10;\r\np=487;\r\ny_correct = [9,461];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[9,461];\r\nQ=[9,461];\r\na=-7;\r\nb=10;\r\np=487;\r\ny_correct = [285,417];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-10T02:46:05.000Z","updated_at":"2025-12-28T04:01:47.000Z","published_at":"2019-11-10T02:49:06.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\u003eGiven two points (P and Q, they can be the same points on the elliptic curve), compute ECC point addition on a Weierstrass elliptic curve: y^2=x^3+a*x+b over the discrete prime field, p (input to function). Inputs, a and b of the elliptic curve are also provided. Output must be point R(x,y)=P+Q.\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\"}]}"},{"id":45243,"title":"Binary Array to Hex Representation","description":"Given a binary array of bytes (lsb to msb), convert it into a hexadecimal representation (msb to lsb). For example: \r\nInput: [1 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0];\r\nOutput: '616263'","description_html":"\u003cp\u003eGiven a binary array of bytes (lsb to msb), convert it into a hexadecimal representation (msb to lsb). For example: \r\nInput: [1 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0];\r\nOutput: '616263'\u003c/p\u003e","function_template":"function H = bin2hex(B)\r\n  H = B;\r\nend","test_suite":"%%\r\nB = '00001010101001101111011000001110001101101010011000000100111011100001011011110110000001001100111010101110110001101100011010100110101001100010011000000100000101101000011001101110101001100000010010110110111101101011011010100110011101100010111010101110101101100111010000000100001010100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010011001110101011101100011011000110101001101010011000100110001101000000010000101110000101101010011000000100101101101111011001001110101001100000010000101110000101101010011010011110000001001110111010000110011101100010111000000100001011101111011000000100110011101010111011000110110001101010011010100110001001100000010010000110011101100010011000000100001011100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010001100110100101100111011000100110000001001000011000000100111011101000011010011110000001000010111011110110000001001100111010101110110001101100011010100110101001100010011001110100000001001100101010010110101101101001011000110110100001100100111000110110100111100011010000000100111011100001011010100110011101100000010011001110111101101011011010100110111101100111011010100110000001001001011011001110000001000110011010000110100101100011011010010110011101101110011000110100000001000010111000010110101001100000010000101110101001100111011000100110101001100111011011000110100111100000010010010110110011100000010000101110111101100000010011100110101001100010111000000100111101100111011000000100100001100000010000100110111101101110111001110110111011101000011001001110001001100000010011001110000011101001011001001110100001100011011000000100001011100001011010000110001011100000010011000110100001100111011000000100101001100110111010100110011101100000010001000110101001101100011011110110101101101010011000000100100001100000010011001110101001100011011001100110101101000110011010101110001101100110011010010110001101100011011010010110011101101110011000000100000011100100111011110110000011100001011010100110110001101001111001110100';\r\ny_correct = '50656F706C652077686F20737563636565642068617665206D6F6D656E74756D2E20546865206D6F7265207468657920737563636565642C20746865206D6F726520746865792077616E7420746F207375636365656420616E6420746865206D6F726520746865792066696E6420612077617920746F20737563636565642E2053696D696C61726C792C207768656E20736F6D656F6E65206973206661696C696E672C207468652074656E64656E637920697320746F20676574206F6E206120646F776E776172642073706972616C20746861742063616E206576656E206265636F6D6520612073656C662D66756C66696C6C696E672070726F70686563792E';\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n%%\r\nB = '011000101001011001001110110011100010111000110100000001000001011010000110011011101010011000000100100001100000010000100110101001100110011010010110011101101001011000101110101001100011010000000100110001100011011010100110100001100100111000000100000011100100111010000110110001100010111010010110110001101000011000110110000001001001011000100110101001101000011000110110110111000000010010000110000001001110011011110110100001100011011000110100000001001000011001110110000001001111011001000110010101101010011011000110001011101001011001101110101001100111010000000100110010101010011011000110111101100111011000100110001101000000010000010110100001100110111010100110000001000010111000010110101001100000010001110110101001101100011010100110110011101100111010000110010011101001111000000100101101101010011010000110011101101100111000000100001011101111011000000100100001101100011000010110100101101010011001101110101001100000010010011110111101101010111001001110000001001010011001110110001001101100111011011100000001001110111010010110110011100010011011110110101101100011010000000100101101101111011001110110101001101001111000110100000001001011011010000110001011101010011001001110100101101000011000110110110011100011010000000100100001100111011000100110000001001011011010100110001011100001011011110110001001101100111001110100';\r\ny_correct = '46697273742C2068617665206120646566696E6974652C20636C6561722070726163746963616C20696465616C3B206120676F616C2C20616E206F626A6563746976652E205365636F6E642C206861766520746865206E6563657373617279206D65616E7320746F206163686965766520796F757220656E64733B20776973646F6D2C206D6F6E65792C206D6174657269616C732C20616E64206D6574686F64732E'\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n%%\r\nB = '100100100000010000100110111101100000010001110110111101100010111000000100110101100111011011110110111011100000010011101110000101101000011000101110000001001001001000000100101101101000011010011110000001001000011000001110000011101010011010000110010011100000010000101110111101100000010000101110000101101010011000000100111011101111011001001110001101100010011000110100000001000100011010101110001011100000010000101110111101100000010010110110100111101100111010100110001101100110011000000100100100100000010011001110101001101010011010110110000001000010111011110110000001000001011010000110011011101010011000000100010001101010011010100110011101100000010011110110011101100011011010011110000001000011011010010110110101101010011000000100100001100000010001000110111101101001111000000100000011100011011010000110100111101001011001110110111001100000010011110110011101100000010000101110000101101010011000000100110011101010011010000110110011100001011011110110010011101010011000110100000001001000011001110110001001100000010000100110100101100110111010100110010011100010111010010110011101101110011000000100101101101001111011001110101001100011011001100110000001001001011001110110000001000111011011110110111011100000010010000110011101100010011000000100001011100001011010100110011101100000010001100110100101100111011000100110100101100111011011100110000001001000011000000100110011101011011011110110111101100010111000010110101001100100111000000100000011101010011001000110010001100011011010100110000001001111011001001110000001001000011000000100000011100100111010100110001011100010111010010110101001100100111000000100110011100001011010100110001101100011011000000100001011100001011010000110011101100000010011110110010011100010011010010110011101101000011001001110100111100011010000000100111011100001011010010110001101101100111000101110000001000010111000010110101001100000010011100110010011101010011010000110001011100000010011110110110001101010011010000110011101100000010011110110011001100000010000101110010011101010111000101110000101100000010000110110100001101001111000000100100001100011011000110110000001001010111001110110001001101001011011001110110001101111011001101110101001100100111010100110001001100000010001000110101001100110011011110110010011101010011000000100101101101010011001110100';\r\ny_correct = '4920646F206E6F74206B6E6F7720776861742049206D61792061707065617220746F2074686520776F726C642C2062757420746F206D7973656C662049207365656D20746F2068617665206265656E206F6E6C79206C696B65206120626F7920706C6179696E67206F6E207468652073656173686F72652C20616E6420646976657274696E67206D7973656C6620696E206E6F7720616E64207468656E2066696E64696E67206120736D6F6F7468657220706562626C65206F722061207072657474696572207368656C6C207468616E206F7264696E6172792C207768696C737420746865206772656174206F6365616E206F66207472757468206C617920616C6C20756E646973636F7665726564206265666F7265206D652E';\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n%%\r\nB = '1000001011001110000001001001001000000100110001101111011001110110110011101001011000100110101001100100111010100110001001100000010000101110000101101010011000000100101101101000011000101110001011101010011001001110000001001100011010000110010011101010011001100110101011100011011000110110100111100000010010010110001011100000010011100110010011101000011000100110101011101000011000110110001101101001111000000100110001101000011010110110101001100000010000101110111101100000010000110110100101101110011000010110001011100000010000101110000101101000011000101110000001001000011000110110001101100000010000101110000101101111011011001110101001100000010010110110100001100010111000101110101001100100111011001110000001001111011001110110001101101001111000000100111011101010011001001110101001100000010001001110101001100110011010100110010011100100111010100110001001100000010000101110111101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100000010010010110011101100000010011101110000101101001011011000110000101100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111011001110000001001000011001001110101001100000010010010110011101100110111010100110110011100010111010010110111001101000011000101110101001100010011000110100000001001000011001110110001001100000010000101110000101101000011000101110000001001001011000101110000001001011011010000110110101101010011011001110000001000111011011110110000001000010011010010110011001100110011010100110010011101010011001110110110001101010011000000100111011100001011010100110001011100001011010100110010011100000010010010110001011100000010001000110101001100000010010010110011101100000010001110110101011101011011001000110101001100100111011001110001101000000010001100110100101101110011010101110010011101010011011001110001101000000010011001110001011101000011001001110110011100011010000000100110011101111011010101110011101100010011011001110000001001111011001001110000001001000011001110110100111100000010011110110001011100001011010100110010011100000010011110110010001100101011010100110110001100010111000000100001011100001011010000110001011100000010000101110000101101010011000000100100011101010111010100110110011100010111010010110111101100111011000000100111101100110011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000000100100001100100111010010110110011101010011011001110011101000000010010010010000001001100111010000110111011100000010011000110111101100111011011001110101001101000111010101110101001100111011000101110001101101001111000000100001011100001011010000110001011100000010000101110000101101010011001001110101001100000010010110110101011101100111000101110000001000100011010100110000001001100111011110110101101101010011000000100111001101010011001110110101001100100111010000110001101100000010011001110110001101001011010100110011101101100011010100110000001000010111011110110000001001010011000011110000011100011011010000110100101100111011000000100001011100001011010000110001011100000010010100110001101101010011010110110101001100111011000101110000001001000011011001110000001001000011000000100111011100001011011110110001101101010011000000100111011100001011010010110110001100001011000000100111001101001011001101110101001101100111000000100010011101001011011001110101001100000010000101110111101100000010000001110010011101111011001000110001101101010011010110110110011100000010010000110010001101111011010101110001011100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000110100000001000100111010100110110011100010111001001110100101101100011000101110101001100010011000000100100001101100111000000100001011100001011010100110110011101010011000000100100001100100111010100110000001000010111011110110000001000111011011110110000001001100111000001110101001101100011010010110100001100011011000000100110011101010111001000110010101101010011011000110001011100000010010110110100001100010111000101110101001100100111001110100000001000010101000010110100101101100111000110100000001001001001000000100000011101010011001001110110001101010011010010110011011101010011000100110000001001110111010000110110011100000010011000110100001100011011000110110101001100010011000000100010001001010111001110110100101100110111010100110010011101100111010000110001101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100100010001110100';\r\ny_correct = '4173204920636F6E7369646572656420746865206D6174746572206361726566756C6C79206974206772616475616C6C792063616D6520746F206C69676874207468617420616C6C2074686F7365206D617474657273206F6E6C79207765726520726566657272656420746F206D617468656D617469637320696E207768696368206F7264657220616E64206D6561737572656D656E74732061726520696E766573746967617465642C20616E642074686174206974206D616B6573206E6F20646966666572656E6365207768657468657220697420626520696E206E756D626572732C20666967757265732C2073746172732C20736F756E6473206F7220616E79206F74686572206F626A656374207468617420746865207175657374696F6E206F66206D6561737572656D656E74206172697365732E20492073617720636F6E73657175656E746C792074686174207468657265206D75737420626520736F6D652067656E6572616C20736369656E636520746F206578706C61696E207468617420656C656D656E7420617320612077686F6C65207768696368206769766573207269736520746F2070726F626C656D732061626F7574206F7264657220616E64206D6561737572656D656E742C20726573747269637465642061732074686573652061726520746F206E6F207370656369616C207375626A656374206D61747465722E20546869732C204920706572636569766564207761732063616C6C65642022756E6976657273616C206D617468656D6174696373222E';\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-23T03:54:07.000Z","updated_at":"2025-10-11T16:24:46.000Z","published_at":"2019-12-23T03:57:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a binary array of bytes (lsb to msb), convert it into a hexadecimal representation (msb to lsb). For example: Input: [1 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0]; Output: '616263'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45320,"title":"SHA256 Hashing","description":"Conduct SHA256 hashing on a hexadecimal input to produce a 256-bit hexadecimal output.\r\n\r\nExample:\r\nhash = SHA256('aa')\r\n\r\nhash = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d'","description_html":"\u003cp\u003eConduct SHA256 hashing on a hexadecimal input to produce a 256-bit hexadecimal output.\u003c/p\u003e\u003cp\u003eExample:\r\nhash = SHA256('aa')\u003c/p\u003e\u003cp\u003ehash = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d'\u003c/p\u003e","function_template":"function hash = SHA256(x)\r\n  hash = x;\r\nend","test_suite":"%%\r\nx = 'aa';\r\ny_correct = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = 'aabbccddeeff';\r\ny_correct = '17226b1f68aebacdef0746450f642874638b295707ef73fb2c6bb7f88e89929f';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = 'aa0123456789bb0123456789cc0123456789dd0123456789dd0123456789ee0123456789ff0123456789';\r\ny_correct = '28b51d5465661e7565dbaad0f57b972694ff96722ad6b1272cb62f867cd3d850';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '010203040506070809a1a2a3a4a5a6a7a8a9aaabacadaeaf';\r\ny_correct = '05f6ae62f9e66bf381b8633f310203564ab5755a8ffeb5295df63d712b5b99b3';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '010203040506070809b0b1b2b3b4b5b6b7b8b9babbbcbdbebf';\r\ny_correct = '58c146ab1f285afdad8a88d1431138c7c585a8681cd05f3e7463e8c5cab1d85b';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '3df36325c49b52091e2f0dce4ef073909d93e7ec4a173410cc1499c73dbcc30d05fccbd049451fc23b2aff7692ac8a19ca25';\r\ny_correct = '65dc21caa32f64cc5761e7a33a4ce8444e5e92c581b109f40ab1c19137d6017a';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = 'b3569682a918fcc931450689e344c0c3ffb7ba93c4e618d38147aa0ecfd86e00585054b3ed07e34e9e07b6b7b288cbbba02f72a627a1365258db4295a5c97aae5ce479f4c640c0fdf116a20ac626898f45ba4b49446de8efda170b13443dce1657e28d29';\r\ny_correct = '515a258c12639a853a4b26787b57bb7a28e7c713d54c32e1ee69f475ee264315';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '3044ba9ded85376d8e56b86fb88e70d2afc5b71611d2cb22650544245ff343cdba78905e21ed126dc3e202ac51d48688176ed10d210c217a3ae40e3b26779e846c81b5264903742058db07007c0a2136d9c82ee83d63bd8860e0986b8ac2055b145e1cdcaba106fe095376730597b84501c1493e65215c00c25c662ec4cc521b1f7ef60f9604da3bef16473a062a40dfe008f23fdc5f';\r\ny_correct = '2290847297dd385e81d854e5ace68c58b26dfd0113a7308b580329ca40533b67';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '3c724b57efe352bf7cf9e1c1540578341a631ec8131c966dcbe08225dea603580b7ff83b7ee929a2fac613ac1823bd6a6d5419a912e8301e8aa2ff0278761fea5099579ac78002f0a10fc06995f5908d0638b80e9ac8cbe177ecd8e652ea52166c2798878b5047a2701a2d3c9af0bd9b305856195f062bd21c8efd211e4cb31252eb219db17229f07bbbcdf020b37a014ba86f34bd724fb2cb464c1591021806873950671c89fde44f1f7ee8c889e6847a4fa2540b34915adfdabdd84ced6cbea51e5d1a09e025d0';\r\ny_correct = 'a90514d0965382c793a5cfb5cd69fcdb36dcc68709c0ba8eeb1ac0a1af1cf428';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '1b7f378081dd1d40f56acc462e465935b0378ec3049a00db4e67bd7c74fd8395c1e0d55090e0bb41fde3ea787aa88377bb1397129dea43b8e57d940347564c6359fddbfd8520ae9a8cda95492ca640505f40d1d754afb1134b6372b53f57550039b79b42b7ae6f89fe5abefb544182b556cc58567bc6c46ec5dc96a4d4b04504bc108206ee027e921032e9ed735c8eab0cb05c5e25a62e9cd56e8e51d060e5a9039dfefa5b1ae7bf479531a1e5d94574260ff939af92f1491dd268a41cf9fa449d78e66c4e3fed5421ba1d23a3971492d170edd114789009f02799d9f1bc42f40dffde18f4d3fcf5ad843c8b70ff481dfc9dc25659c64d5435db';\r\ny_correct = '6385659325be088ca568830f97a3495a693ced0541174d15bcf163c12f6ade46';\r\nassert(isequal(SHA256(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-08T23:37:42.000Z","updated_at":"2026-03-02T13:22:56.000Z","published_at":"2020-02-08T23:39:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConduct SHA256 hashing on a hexadecimal input to produce a 256-bit hexadecimal output.\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\u003eExample: hash = SHA256('aa')\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\u003ehash = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":46627,"title":"Output the Montgomery Form of the Input Matrix","description":null,"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: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.5px; vertical-align: baseline; \"\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=\"\"\u003eOutput the Montgomery Form of all the numbers of an input matrix given R and N such that gcd(R,N)=1.\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\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Montgomery_modular_multiplication\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ehttps://en.wikipedia.org/wiki/Montgomery_modular_multiplication\u003c/span\u003e\u003c/span\u003e\u003c/a\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=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function ahat = montgomeryForm(a,R,N)\r\n  ahat=a;\r\nend","test_suite":"%%\r\na =[   53393       10329       42974       46271       28753       18089       49235       55097       23046        4971\r\n       59361       63608        2340        2086       25005       44544       16717       16664       54449        3535\r\n        8322       62728       55648       18148       50168       42932       33158       53364       38355       34786\r\n       59859       31809       61210        3025       52114       10656       45814       15959       36026       51063\r\n       41442       52447       44481        6365       12246        7798       58386       60900       60109       61211\r\n        6392        9298       49659       53966       32097       32660       62868       22936       18732        8513\r\n       18251       27640       48701       45536       29201       62897       35862       12884       49623       37278\r\n       35840       60013       25704       20781       42356       22307        9084       16455       49396       30761\r\n       62751       51918       42957       62273       46488       38356        9784       40373       24932         780\r\n       63234       62881       11218        2257       49459       14667       16876       31017       37212       22093];\r\nahat =[ 1813        2484          77         195        2790         501        1749         523        1988         187\r\n        3109         140         526        2711         798        2194        1399         138        1248        1321\r\n         522          56        1196        2156        3094         648        1319        2128        1921        2806\r\n        2521        1508         244        1121        2160         654        1256         449        3227         834\r\n        1565         724        1386        2953        1865        1622        2335         971        1183        2529\r\n        1397         252        1850        2821         446        1907         372         313        1667         858\r\n        1152        2941        3302        1865        1138          57        1335        1593        2815        1107\r\n        1000        1537          93        3058        2772        1176         625        1949         115         379\r\n        2676         386        1180        2358          19         877        2205        2386         443        1285\r\n        1103         116        3159         624         923        1052        1853        2764         102        1549];\r\n\r\nassert(isequal(montgomeryForm(a,2^16,3329),ahat))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-30T16:26:25.000Z","updated_at":"2025-12-28T03:56:20.000Z","published_at":"2020-09-30T16:26:25.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\u003eOutput the Montgomery Form of all the numbers of an input matrix given R and N such that gcd(R,N)=1.\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:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Montgomery_modular_multiplication\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Montgomery_modular_multiplication\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e \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\"}]}"},{"id":45242,"title":"String to Binary Representation","description":"Given a string, convert it using UTF-8 into a binary array where each character or byte is arraigned low to high. For example:\r\nInput: 'abc', goes to [97 98 99], and then \r\nOuput: [1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1];","description_html":"\u003cp\u003eGiven a string, convert it using UTF-8 into a binary array where each character or byte is arraigned low to high. For example:\r\nInput: 'abc', goes to [97 98 99], and then \r\nOuput: [1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1];\u003c/p\u003e","function_template":"function Output = message2binary(message)\r\n  Output = message;\r\nend","test_suite":"%%\r\nmessage = '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\ny_correct='00001010101001101111011000001110001101101010011000000100111011100001011011110110000001001100111010101110110001101100011010100110101001100010011000000100000101101000011001101110101001100000010010110110111101101011011010100110011101100010111010101110101101100111010000000100001010100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010011001110101011101100011011000110101001101010011000100110001101000000010000101110000101101010011000000100101101101111011001001110101001100000010000101110000101101010011010011110000001001110111010000110011101100010111000000100001011101111011000000100110011101010111011000110110001101010011010100110001001100000010010000110011101100010011000000100001011100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010001100110100101100111011000100110000001001000011000000100111011101000011010011110000001000010111011110110000001001100111010101110110001101100011010100110101001100010011001110100000001001100101010010110101101101001011000110110100001100100111000110110100111100011010000000100111011100001011010100110011101100000010011001110111101101011011010100110111101100111011010100110000001001001011011001110000001000110011010000110100101100011011010010110011101101110011000110100000001000010111000010110101001100000010000101110101001100111011000100110101001100111011011000110100111100000010010010110110011100000010000101110111101100000010011100110101001100010111000000100111101100111011000000100100001100000010000100110111101101110111001110110111011101000011001001110001001100000010011001110000011101001011001001110100001100011011000000100001011100001011010000110001011100000010011000110100001100111011000000100101001100110111010100110011101100000010001000110101001101100011011110110101101101010011000000100100001100000010011001110101001100011011001100110101101000110011010101110001101100110011010010110001101100011011010010110011101101110011000000100000011100100111011110110000011100001011010100110110001101001111001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n%%\r\nmessage = '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\ny_correct='011000101001011001001110110011100010111000110100000001000001011010000110011011101010011000000100100001100000010000100110101001100110011010010110011101101001011000101110101001100011010000000100110001100011011010100110100001100100111000000100000011100100111010000110110001100010111010010110110001101000011000110110000001001001011000100110101001101000011000110110110111000000010010000110000001001110011011110110100001100011011000110100000001001000011001110110000001001111011001000110010101101010011011000110001011101001011001101110101001100111010000000100110010101010011011000110111101100111011000100110001101000000010000010110100001100110111010100110000001000010111000010110101001100000010001110110101001101100011010100110110011101100111010000110010011101001111000000100101101101010011010000110011101101100111000000100001011101111011000000100100001101100011000010110100101101010011001101110101001100000010010011110111101101010111001001110000001001010011001110110001001101100111011011100000001001110111010010110110011100010011011110110101101100011010000000100101101101111011001110110101001101001111000110100000001001011011010000110001011101010011001001110100101101000011000110110110011100011010000000100100001100111011000100110000001001011011010100110001011100001011011110110001001101100111001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n%%\r\nmessage = 'I do not know what I may appear to the world, but to myself I seem to have been only like a boy playing on the seashore, and diverting myself in now and then finding a smoother pebble or a prettier shell than ordinary, whilst the great ocean of truth lay all undiscovered before me.';\r\ny_correct='100100100000010000100110111101100000010001110110111101100010111000000100110101100111011011110110111011100000010011101110000101101000011000101110000001001001001000000100101101101000011010011110000001001000011000001110000011101010011010000110010011100000010000101110111101100000010000101110000101101010011000000100111011101111011001001110001101100010011000110100000001000100011010101110001011100000010000101110111101100000010010110110100111101100111010100110001101100110011000000100100100100000010011001110101001101010011010110110000001000010111011110110000001000001011010000110011011101010011000000100010001101010011010100110011101100000010011110110011101100011011010011110000001000011011010010110110101101010011000000100100001100000010001000110111101101001111000000100000011100011011010000110100111101001011001110110111001100000010011110110011101100000010000101110000101101010011000000100110011101010011010000110110011100001011011110110010011101010011000110100000001001000011001110110001001100000010000100110100101100110111010100110010011100010111010010110011101101110011000000100101101101001111011001110101001100011011001100110000001001001011001110110000001000111011011110110111011100000010010000110011101100010011000000100001011100001011010100110011101100000010001100110100101100111011000100110100101100111011011100110000001001000011000000100110011101011011011110110111101100010111000010110101001100100111000000100000011101010011001000110010001100011011010100110000001001111011001001110000001001000011000000100000011100100111010100110001011100010111010010110101001100100111000000100110011100001011010100110001101100011011000000100001011100001011010000110011101100000010011110110010011100010011010010110011101101000011001001110100111100011010000000100111011100001011010010110001101101100111000101110000001000010111000010110101001100000010011100110010011101010011010000110001011100000010011110110110001101010011010000110011101100000010011110110011001100000010000101110010011101010111000101110000101100000010000110110100001101001111000000100100001100011011000110110000001001010111001110110001001101001011011001110110001101111011001101110101001100100111010100110001001100000010001000110101001100110011011110110010011101010011000000100101101101010011001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n%%\r\nmessage = 'As I considered the matter carefully it gradually came to light that all those matters only were referred to mathematics in which order and measurements are investigated, and that it makes no difference whether it be in numbers, figures, stars, sounds or any other object that the question of measurement arises. I saw consequently that there must be some general science to explain that element as a whole which gives rise to problems about order and measurement, restricted as these are to no special subject matter. This, I perceived was called \"universal mathematics\".';\r\ny_correct='1000001011001110000001001001001000000100110001101111011001110110110011101001011000100110101001100100111010100110001001100000010000101110000101101010011000000100101101101000011000101110001011101010011001001110000001001100011010000110010011101010011001100110101011100011011000110110100111100000010010010110001011100000010011100110010011101000011000100110101011101000011000110110001101101001111000000100110001101000011010110110101001100000010000101110111101100000010000110110100101101110011000010110001011100000010000101110000101101000011000101110000001001000011000110110001101100000010000101110000101101111011011001110101001100000010010110110100001100010111000101110101001100100111011001110000001001111011001110110001101101001111000000100111011101010011001001110101001100000010001001110101001100110011010100110010011100100111010100110001001100000010000101110111101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100000010010010110011101100000010011101110000101101001011011000110000101100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111011001110000001001000011001001110101001100000010010010110011101100110111010100110110011100010111010010110111001101000011000101110101001100010011000110100000001001000011001110110001001100000010000101110000101101000011000101110000001001001011000101110000001001011011010000110110101101010011011001110000001000111011011110110000001000010011010010110011001100110011010100110010011101010011001110110110001101010011000000100111011100001011010100110001011100001011010100110010011100000010010010110001011100000010001000110101001100000010010010110011101100000010001110110101011101011011001000110101001100100111011001110001101000000010001100110100101101110011010101110010011101010011011001110001101000000010011001110001011101000011001001110110011100011010000000100110011101111011010101110011101100010011011001110000001001111011001001110000001001000011001110110100111100000010011110110001011100001011010100110010011100000010011110110010001100101011010100110110001100010111000000100001011100001011010000110001011100000010000101110000101101010011000000100100011101010111010100110110011100010111010010110111101100111011000000100111101100110011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000000100100001100100111010010110110011101010011011001110011101000000010010010010000001001100111010000110111011100000010011000110111101100111011011001110101001101000111010101110101001100111011000101110001101101001111000000100001011100001011010000110001011100000010000101110000101101010011001001110101001100000010010110110101011101100111000101110000001000100011010100110000001001100111011110110101101101010011000000100111001101010011001110110101001100100111010000110001101100000010011001110110001101001011010100110011101101100011010100110000001000010111011110110000001001010011000011110000011100011011010000110100101100111011000000100001011100001011010000110001011100000010010100110001101101010011010110110101001100111011000101110000001001000011011001110000001001000011000000100111011100001011011110110001101101010011000000100111011100001011010010110110001100001011000000100111001101001011001101110101001101100111000000100010011101001011011001110101001100000010000101110111101100000010000001110010011101111011001000110001101101010011010110110110011100000010010000110010001101111011010101110001011100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000110100000001000100111010100110110011100010111001001110100101101100011000101110101001100010011000000100100001101100111000000100001011100001011010100110110011101010011000000100100001100100111010100110000001000010111011110110000001000111011011110110000001001100111000001110101001101100011010010110100001100011011000000100110011101010111001000110010101101010011011000110001011100000010010110110100001100010111000101110101001100100111001110100000001000010101000010110100101101100111000110100000001001001001000000100000011101010011001001110110001101010011010010110011011101010011000100110000001001110111010000110110011100000010011000110100001100011011000110110101001100010011000000100010001001010111001110110100101100110111010100110010011101100111010000110001101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100100010001110100';\r\nassert(isequal(message2binary(message),y_correct-48))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-23T03:03:00.000Z","updated_at":"2026-01-09T07:13:47.000Z","published_at":"2019-12-23T03:16:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string, convert it using UTF-8 into a binary array where each character or byte is arraigned low to high. For example: Input: 'abc', goes to [97 98 99], and then Ouput: [1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46630,"title":"Find R*Rp-N*Np=1 given gcd(R,N)=1","description":null,"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: 81px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 40.5px; transform-origin: 407px 40.5px; vertical-align: baseline; \"\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=\"\"\u003eFind Rp and Np, such that R*Rp-N*Np=1, given gcd(R,N)=1.\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=\"\"\u003e0\u0026lt;=Rp\u0026lt;N\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=\"\"\u003e0\u0026lt;=Np\u0026lt;R\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [Rp,Np] = bezout(R,N)\r\n  Rp=R;\r\n  Np=N;\r\nend","test_suite":"%%\r\nR=2.^[12:22];\r\nN=primes(3329);\r\nN=N(end-10:end);\r\n[R,N]=meshgrid(R,N);\r\nRp =[   2925        3089        3171        3212        1606         803        2028        1014         507        1880         940\r\n        1316         658         329        1793        2525        2891        3074        1537        2397        2827        3042\r\n        1538         769        2014        1007        2133        2696        1348         674         337        1798         899\r\n        2256        1128         564         282         141        1706         853        2062        1031        2151        2711\r\n        1486         743        2021        2660        1330         665        1982         991        2145        2722        1361\r\n        3110        1555        2428        1214         607        1954         977        2139        2720        1360         680\r\n         876         438         219        1763        2535        2921        3114        1557        2432        1216         608\r\n        2471        2892        1446         723        2018        1009        2161        2737        3025        3169        3241\r\n        2328        1164         582         291        1805        2562        1281        2300        1150         575        1947\r\n         374         187        1755        2539        2931        3127        3225        3274        1637        2480        1240\r\n        2704        1352         676         338         169        1749        2539        2934        1467        2398        1199];\r\nNp =[   3683        7779       15971       32355       32355       32355      163427      163427      163427     1212003     1212003\r\n        1655        1655        1655       18039       50807      116343      247415      247415      771703     1820279     3917431\r\n        1933        1933       10125       10125       42893      108429      108429      108429      108429     1157005     1157005\r\n        2825        2825        2825        2825        2825       68361       68361      330505      330505     1379081     3476233\r\n        1845        1845       10037       26421       26421       26421      157493      157493      681781     1730357     1730357\r\n        3859        3859       12051       12051       12051       77587       77587      339731      864019      864019      864019\r\n        1085        1085        1085       17469       50237      115773      246845      246845      771133      771133      771133\r\n        3055        7151        7151        7151       39919       39919      170991      433135      957423     2005999     4103151\r\n        2873        2873        2873        2873       35641      101177      101177      363321      363321      363321     2460473\r\n         461         461        8653       25037       57805      123341      254413      516557      516557     1565133     1565133\r\n        3327        3327        3327        3327        3327       68863      199935      462079      462079     1510655     1510655];\r\n[rp,np]=bezout(R,N);\r\nassert(isequal(rp,Rp))\r\nassert(isequal(np,Np))\r\n%%\r\nR=3.^[5:15];\r\nN=primes(15000);\r\nN=N(end-10:end);\r\n[R,N]=meshgrid(R,N);\r\nRp =[  13723       14499        4833        1611         537         179        5022        1674         558         186          62\r\n        1532       10438        8443        7778       12520        9137       12973        9288        3096        1032         344\r\n       13487       14427        4809        1603        5500        6799        7232       12342        4114        6337        7078\r\n        1044         348         116        5013        1671         557        5160        1720       10522       13456       14434\r\n        9154       13004        9311        8080       12646       14168        9699        3233        6054        2018        5649\r\n       12234        4078        6339        2113        5684       11854        8931        2977        5972       11950        8963\r\n       11933        8960        7969       12621        4207       11367        3789        1263         421       10105       13333\r\n        6891        2297       10733       13545        4515        1505       10469       13457       14453       14785        9912\r\n        8371        7776        2592         864         288          96          32        9982        8313        2771       10895\r\n       14661        4887        1629         543         181        5050        6673        7214       12384        4128        1376\r\n        2528        5837        6940       12302        9095        8026       12664       14210        9731        8238        2746];\r\nNp =[    224         710         710         710         710         710       59759       59759       59759       59759       59759\r\n          25         511        1240        3427       16549       36232      154330      331477      331477      331477      331477\r\n         220         706         706         706        7267       26950       85999      440293      440293     2034616     6817585\r\n          17          17          17        2204        2204        2204       61253       61253     1124135     4312781    13878719\r\n         149         635        1364        3551       16673       56039      115088      115088      646529      646529     5429498\r\n         199         199         928         928        7489       46855      105904      105904      637345     3825991     8608960\r\n         194         437        1166        5540        5540       44906       44906       44906       44906     3233552    12799490\r\n         112         112        1570        5944        5944        5944      124042      478336     1541218     4729864     9512833\r\n         136         379         379         379         379         379         379      354673      886114      886114    10452052\r\n         238         238         238         238         238       19921       78970      256117     1318999     1318999     1318999\r\n          41         284        1013        5387       11948       31631      149729      504023     1035464     2629787     2629787];\r\n[rp,np]=bezout(R,N);\r\nassert(isequal(rp,Rp))\r\nassert(isequal(np,Np))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2020-11-10T19:09:02.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2020-09-30T17:23:03.000Z","updated_at":"2025-12-28T03:57:53.000Z","published_at":"2020-09-30T17:23:03.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\u003eFind Rp and Np, such that R*Rp-N*Np=1, given gcd(R,N)=1.\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\u003e0\u0026lt;=Rp\u0026lt;N\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\u003e0\u0026lt;=Np\u0026lt;R\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\"}]}"},{"id":46633,"title":"Montgomery Reduction Algorithm (REDC)","description":null,"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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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=\"\"\u003eGiven a matrix of input numbers T, R, and N such that gcd(R,N)=1 and 0 \u0026lt;= T \u0026lt; R*N, output the Montgomery reduction of T.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function t = REDC(T,R,N)\r\nt=T*R/N;\r\nend","test_suite":"%%\r\nR=2.^[12:22];\r\nN=primes(3329);\r\nN=N(end-10:end);\r\n[R,N]=meshgrid(R,N);\r\nT =[     245        2125        3406        4031        1103        2731        1888         927        2393         733        2175\r\n        2794        3986        3291         685        1732         730        4021        1576         442        1733        2681\r\n         174        2659         248         436        2245         525         641        2388        3713         386        1670\r\n         293        3279        1636        1526        3862        4093        3505        1032        3604        2452        3359\r\n        2137        1859        2159         812        1712         701        2641        1190        3350        1929        2943\r\n         397        1772        1708        2006        4027         134        1542        2528        1068        2851        3968\r\n        3352        3381        2691        1391        1235        2299         783        1087        2435        2867        2177\r\n        3349         342        2573        3898        2872        3613        1755        3377          93        2616        1332\r\n        2960         546        1196        3770        2730        2741        1975        4025        1742         138         433\r\n         614         711        1769         216        2209         781         495        2992        1281         282        2503\r\n        2702        1602          64        3023        2860        1512        2415        1409         662        1310        3190];\r\nt =[     965        2824         466         632        1786         471          83        3114        3135        2021        1616\r\n        3008         903        1415         316        2406        3151         239        2361         949         663          74\r\n         374        1378         845        2346        1114         994         433        2825        3084        3120        2190\r\n         266        2482         282        1831        1556        2344          71        1834        3139        1400        3056\r\n        1944        2255        2061        2374         650        1006        2248        1547         528        2029         437\r\n          96        2426         968        2447        1649        1057        1278         354          80        1986        1323\r\n        3043        2649         683        1846        2303        2169        1003        2582        2390         694         816\r\n        2818        1790          59        2204        1259        1217        2483        2892        3033         978         173\r\n         636        1615        2401        1800        2254        2757         897         809        1943        3013          25\r\n         349          37         913         129        1375        3105        1335        2927         184        1530          38\r\n        2382        2054        3316        3100         635        1262        2996        2717        2415        2133        3118];\r\nassert(isequal(REDC(T,R,N),t))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-30T19:14:40.000Z","updated_at":"2025-12-28T03:59:49.000Z","published_at":"2020-09-30T19:14:40.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\u003eGiven a matrix of input numbers T, R, and N such that gcd(R,N)=1 and 0 \u0026lt;= T \u0026lt; R*N, output the Montgomery reduction of T.\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\"}]}"},{"id":45211,"title":"AES SubBytes() Transformation","description":"Given a 16x2 input character hexadecimal array representing the AES state, execute the AES algorithm SubBytes() transformation and output a 16x2 character hexadecimal array. \r\n\r\nRefer to this link: \u003chttps://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\u003e\r\n\r\nFor example:\r\n\r\n  statei=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\r\n  stateo=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2'];","description_html":"\u003cp\u003eGiven a 16x2 input character hexadecimal array representing the AES state, execute the AES algorithm SubBytes() transformation and output a 16x2 character hexadecimal array.\u003c/p\u003e\u003cp\u003eRefer to this link: \u003ca href = \"https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\"\u003ehttps://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\u003c/a\u003e\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003estatei=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\r\nstateo=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2'];\r\n\u003c/pre\u003e","function_template":"function stateO = SubBytes(stateI)\r\n  stateO = stateI;\r\nend","test_suite":"%%\r\nstateI=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\r\nstateO=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n%%\r\nstateI=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2']; \r\nstateO=['82';'c5';'61';'d4';'70';'4c';'37';'c5';'cb';'08';'4a';'1c';'82';'08';'a8';'3a']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n%%\r\nstateI=['82';'c5';'61';'d4';'70';'4c';'37';'c5';'cb';'08';'4a';'1c';'82';'08';'a8';'3a']; \r\nstateO=['13';'a6';'ef';'48';'51';'29';'9a';'a6';'1f';'30';'d6';'9c';'13';'30';'c2';'80']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n%%\r\nstateI=['13';'a6';'ef';'48';'51';'29';'9a';'a6';'1f';'30';'d6';'9c';'13';'30';'c2';'80']; \r\nstateO=['7d';'24';'df';'52';'d1';'a5';'b8';'24';'c0';'04';'f6';'de';'7d';'04';'25';'cd']; \r\nassert(isequal(SubBytes(stateI),stateO))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-21T17:35:28.000Z","updated_at":"2025-12-28T04:07:40.000Z","published_at":"2019-11-21T17:45:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a 16x2 input character hexadecimal array representing the AES state, execute the AES algorithm SubBytes() transformation and output a 16x2 character hexadecimal array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRefer to this link:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\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[statei=['e3';'38';'2d';'8e';'60';'8d';'3e';'38';'15';'f4';'a7';'88';'e3';'f4';'06';'1a'];\\nstateo=['11';'07';'d8';'19';'d0';'5d';'b2';'07';'59';'bf';'5c';'c4';'11';'bf';'6f';'a2'];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45200,"title":"Elliptic Curve Cryptography (ECC) Point Addition","description":"Given two points (P and Q, they can be the same points on the elliptic curve), compute ECC point addition on a Weierstrass elliptic curve: y^2=x^3+a*x+b over the discrete prime field, p (input to function). Inputs, a and b of the elliptic curve and also provided. Output must be point R(x,y)=P+Q.","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: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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=\"\"\u003eGiven two points (P and Q, they can be the same points on the elliptic curve), compute ECC point addition on a Weierstrass elliptic curve: y^2=x^3+a*x+b over the discrete prime field, p (input to function). Inputs, a and b of the elliptic curve are also provided. Output must be point R(x,y)=P+Q.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function R = pointAdd(P,Q,a,b,p)\r\n  R=P;\r\nend","test_suite":"%%\r\nP=[16,20];\r\nQ=[41,120];\r\na=-1;\r\nb=3;\r\np=127;\r\ny_correct = [86,81];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[16,20];\r\nQ=[16,20];\r\na=-1;\r\nb=3;\r\np=127;\r\ny_correct = [97,81];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[97,81];\r\nQ=[97,81];\r\na=-1;\r\nb=3;\r\np=127;\r\ny_correct = [57,10];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[3,6];\r\nQ=[80,10];\r\na=2;\r\nb=3;\r\np=97;\r\ny_correct = [80,87];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[1,2];\r\nQ=[1,2];\r\na=-7;\r\nb=10;\r\np=487;\r\ny_correct = [486,483];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[1,2];\r\nQ=[486,483];\r\na=-7;\r\nb=10;\r\np=487;\r\ny_correct = [9,461];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n%%\r\nP=[9,461];\r\nQ=[9,461];\r\na=-7;\r\nb=10;\r\np=487;\r\ny_correct = [285,417];\r\nassert(isequal(pointAdd(P,Q,a,b,p),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-10T02:46:05.000Z","updated_at":"2025-12-28T04:01:47.000Z","published_at":"2019-11-10T02:49:06.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\u003eGiven two points (P and Q, they can be the same points on the elliptic curve), compute ECC point addition on a Weierstrass elliptic curve: y^2=x^3+a*x+b over the discrete prime field, p (input to function). Inputs, a and b of the elliptic curve are also provided. Output must be point R(x,y)=P+Q.\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\"}]}"},{"id":45243,"title":"Binary Array to Hex Representation","description":"Given a binary array of bytes (lsb to msb), convert it into a hexadecimal representation (msb to lsb). For example: \r\nInput: [1 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0];\r\nOutput: '616263'","description_html":"\u003cp\u003eGiven a binary array of bytes (lsb to msb), convert it into a hexadecimal representation (msb to lsb). For example: \r\nInput: [1 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0];\r\nOutput: '616263'\u003c/p\u003e","function_template":"function H = bin2hex(B)\r\n  H = B;\r\nend","test_suite":"%%\r\nB = '00001010101001101111011000001110001101101010011000000100111011100001011011110110000001001100111010101110110001101100011010100110101001100010011000000100000101101000011001101110101001100000010010110110111101101011011010100110011101100010111010101110101101100111010000000100001010100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010011001110101011101100011011000110101001101010011000100110001101000000010000101110000101101010011000000100101101101111011001001110101001100000010000101110000101101010011010011110000001001110111010000110011101100010111000000100001011101111011000000100110011101010111011000110110001101010011010100110001001100000010010000110011101100010011000000100001011100001011010100110000001001011011011110110010011101010011000000100001011100001011010100110100111100000010001100110100101100111011000100110000001001000011000000100111011101000011010011110000001000010111011110110000001001100111010101110110001101100011010100110101001100010011001110100000001001100101010010110101101101001011000110110100001100100111000110110100111100011010000000100111011100001011010100110011101100000010011001110111101101011011010100110111101100111011010100110000001001001011011001110000001000110011010000110100101100011011010010110011101101110011000110100000001000010111000010110101001100000010000101110101001100111011000100110101001100111011011000110100111100000010010010110110011100000010000101110111101100000010011100110101001100010111000000100111101100111011000000100100001100000010000100110111101101110111001110110111011101000011001001110001001100000010011001110000011101001011001001110100001100011011000000100001011100001011010000110001011100000010011000110100001100111011000000100101001100110111010100110011101100000010001000110101001101100011011110110101101101010011000000100100001100000010011001110101001100011011001100110101101000110011010101110001101100110011010010110001101100011011010010110011101101110011000000100000011100100111011110110000011100001011010100110110001101001111001110100';\r\ny_correct = '50656F706C652077686F20737563636565642068617665206D6F6D656E74756D2E20546865206D6F7265207468657920737563636565642C20746865206D6F726520746865792077616E7420746F207375636365656420616E6420746865206D6F726520746865792066696E6420612077617920746F20737563636565642E2053696D696C61726C792C207768656E20736F6D656F6E65206973206661696C696E672C207468652074656E64656E637920697320746F20676574206F6E206120646F776E776172642073706972616C20746861742063616E206576656E206265636F6D6520612073656C662D66756C66696C6C696E672070726F70686563792E';\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n%%\r\nB = '011000101001011001001110110011100010111000110100000001000001011010000110011011101010011000000100100001100000010000100110101001100110011010010110011101101001011000101110101001100011010000000100110001100011011010100110100001100100111000000100000011100100111010000110110001100010111010010110110001101000011000110110000001001001011000100110101001101000011000110110110111000000010010000110000001001110011011110110100001100011011000110100000001001000011001110110000001001111011001000110010101101010011011000110001011101001011001101110101001100111010000000100110010101010011011000110111101100111011000100110001101000000010000010110100001100110111010100110000001000010111000010110101001100000010001110110101001101100011010100110110011101100111010000110010011101001111000000100101101101010011010000110011101101100111000000100001011101111011000000100100001101100011000010110100101101010011001101110101001100000010010011110111101101010111001001110000001001010011001110110001001101100111011011100000001001110111010010110110011100010011011110110101101100011010000000100101101101111011001110110101001101001111000110100000001001011011010000110001011101010011001001110100101101000011000110110110011100011010000000100100001100111011000100110000001001011011010100110001011100001011011110110001001101100111001110100';\r\ny_correct = '46697273742C2068617665206120646566696E6974652C20636C6561722070726163746963616C20696465616C3B206120676F616C2C20616E206F626A6563746976652E205365636F6E642C206861766520746865206E6563657373617279206D65616E7320746F206163686965766520796F757220656E64733B20776973646F6D2C206D6F6E65792C206D6174657269616C732C20616E64206D6574686F64732E'\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n%%\r\nB = '100100100000010000100110111101100000010001110110111101100010111000000100110101100111011011110110111011100000010011101110000101101000011000101110000001001001001000000100101101101000011010011110000001001000011000001110000011101010011010000110010011100000010000101110111101100000010000101110000101101010011000000100111011101111011001001110001101100010011000110100000001000100011010101110001011100000010000101110111101100000010010110110100111101100111010100110001101100110011000000100100100100000010011001110101001101010011010110110000001000010111011110110000001000001011010000110011011101010011000000100010001101010011010100110011101100000010011110110011101100011011010011110000001000011011010010110110101101010011000000100100001100000010001000110111101101001111000000100000011100011011010000110100111101001011001110110111001100000010011110110011101100000010000101110000101101010011000000100110011101010011010000110110011100001011011110110010011101010011000110100000001001000011001110110001001100000010000100110100101100110111010100110010011100010111010010110011101101110011000000100101101101001111011001110101001100011011001100110000001001001011001110110000001000111011011110110111011100000010010000110011101100010011000000100001011100001011010100110011101100000010001100110100101100111011000100110100101100111011011100110000001001000011000000100110011101011011011110110111101100010111000010110101001100100111000000100000011101010011001000110010001100011011010100110000001001111011001001110000001001000011000000100000011100100111010100110001011100010111010010110101001100100111000000100110011100001011010100110001101100011011000000100001011100001011010000110011101100000010011110110010011100010011010010110011101101000011001001110100111100011010000000100111011100001011010010110001101101100111000101110000001000010111000010110101001100000010011100110010011101010011010000110001011100000010011110110110001101010011010000110011101100000010011110110011001100000010000101110010011101010111000101110000101100000010000110110100001101001111000000100100001100011011000110110000001001010111001110110001001101001011011001110110001101111011001101110101001100100111010100110001001100000010001000110101001100110011011110110010011101010011000000100101101101010011001110100';\r\ny_correct = '4920646F206E6F74206B6E6F7720776861742049206D61792061707065617220746F2074686520776F726C642C2062757420746F206D7973656C662049207365656D20746F2068617665206265656E206F6E6C79206C696B65206120626F7920706C6179696E67206F6E207468652073656173686F72652C20616E6420646976657274696E67206D7973656C6620696E206E6F7720616E64207468656E2066696E64696E67206120736D6F6F7468657220706562626C65206F722061207072657474696572207368656C6C207468616E206F7264696E6172792C207768696C737420746865206772656174206F6365616E206F66207472757468206C617920616C6C20756E646973636F7665726564206265666F7265206D652E';\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n%%\r\nB = '1000001011001110000001001001001000000100110001101111011001110110110011101001011000100110101001100100111010100110001001100000010000101110000101101010011000000100101101101000011000101110001011101010011001001110000001001100011010000110010011101010011001100110101011100011011000110110100111100000010010010110001011100000010011100110010011101000011000100110101011101000011000110110001101101001111000000100110001101000011010110110101001100000010000101110111101100000010000110110100101101110011000010110001011100000010000101110000101101000011000101110000001001000011000110110001101100000010000101110000101101111011011001110101001100000010010110110100001100010111000101110101001100100111011001110000001001111011001110110001101101001111000000100111011101010011001001110101001100000010001001110101001100110011010100110010011100100111010100110001001100000010000101110111101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100000010010010110011101100000010011101110000101101001011011000110000101100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111011001110000001001000011001001110101001100000010010010110011101100110111010100110110011100010111010010110111001101000011000101110101001100010011000110100000001001000011001110110001001100000010000101110000101101000011000101110000001001001011000101110000001001011011010000110110101101010011011001110000001000111011011110110000001000010011010010110011001100110011010100110010011101010011001110110110001101010011000000100111011100001011010100110001011100001011010100110010011100000010010010110001011100000010001000110101001100000010010010110011101100000010001110110101011101011011001000110101001100100111011001110001101000000010001100110100101101110011010101110010011101010011011001110001101000000010011001110001011101000011001001110110011100011010000000100110011101111011010101110011101100010011011001110000001001111011001001110000001001000011001110110100111100000010011110110001011100001011010100110010011100000010011110110010001100101011010100110110001100010111000000100001011100001011010000110001011100000010000101110000101101010011000000100100011101010111010100110110011100010111010010110111101100111011000000100111101100110011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000000100100001100100111010010110110011101010011011001110011101000000010010010010000001001100111010000110111011100000010011000110111101100111011011001110101001101000111010101110101001100111011000101110001101101001111000000100001011100001011010000110001011100000010000101110000101101010011001001110101001100000010010110110101011101100111000101110000001000100011010100110000001001100111011110110101101101010011000000100111001101010011001110110101001100100111010000110001101100000010011001110110001101001011010100110011101101100011010100110000001000010111011110110000001001010011000011110000011100011011010000110100101100111011000000100001011100001011010000110001011100000010010100110001101101010011010110110101001100111011000101110000001001000011011001110000001001000011000000100111011100001011011110110001101101010011000000100111011100001011010010110110001100001011000000100111001101001011001101110101001101100111000000100010011101001011011001110101001100000010000101110111101100000010000001110010011101111011001000110001101101010011010110110110011100000010010000110010001101111011010101110001011100000010011110110010011100010011010100110010011100000010010000110011101100010011000000100101101101010011010000110110011101010111001001110101001101011011010100110011101100010111000110100000001000100111010100110110011100010111001001110100101101100011000101110101001100010011000000100100001101100111000000100001011100001011010100110110011101010011000000100100001100100111010100110000001000010111011110110000001000111011011110110000001001100111000001110101001101100011010010110100001100011011000000100110011101010111001000110010101101010011011000110001011100000010010110110100001100010111000101110101001100100111001110100000001000010101000010110100101101100111000110100000001001001001000000100000011101010011001001110110001101010011010010110011011101010011000100110000001001110111010000110110011100000010011000110100001100011011000110110101001100010011000000100010001001010111001110110100101100110111010100110010011101100111010000110001101100000010010110110100001100010111000010110101001101011011010000110001011101001011011000110110011100100010001110100';\r\ny_correct = '4173204920636F6E7369646572656420746865206D6174746572206361726566756C6C79206974206772616475616C6C792063616D6520746F206C69676874207468617420616C6C2074686F7365206D617474657273206F6E6C79207765726520726566657272656420746F206D617468656D617469637320696E207768696368206F7264657220616E64206D6561737572656D656E74732061726520696E766573746967617465642C20616E642074686174206974206D616B6573206E6F20646966666572656E6365207768657468657220697420626520696E206E756D626572732C20666967757265732C2073746172732C20736F756E6473206F7220616E79206F74686572206F626A656374207468617420746865207175657374696F6E206F66206D6561737572656D656E74206172697365732E20492073617720636F6E73657175656E746C792074686174207468657265206D75737420626520736F6D652067656E6572616C20736369656E636520746F206578706C61696E207468617420656C656D656E7420617320612077686F6C65207768696368206769766573207269736520746F2070726F626C656D732061626F7574206F7264657220616E64206D6561737572656D656E742C20726573747269637465642061732074686573652061726520746F206E6F207370656369616C207375626A656374206D61747465722E20546869732C204920706572636569766564207761732063616C6C65642022756E6976657273616C206D617468656D6174696373222E';\r\nassert(isequal(bin2hex(B-48),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-12-23T03:54:07.000Z","updated_at":"2025-10-11T16:24:46.000Z","published_at":"2019-12-23T03:57:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a binary array of bytes (lsb to msb), convert it into a hexadecimal representation (msb to lsb). For example: Input: [1 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0]; Output: '616263'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45320,"title":"SHA256 Hashing","description":"Conduct SHA256 hashing on a hexadecimal input to produce a 256-bit hexadecimal output.\r\n\r\nExample:\r\nhash = SHA256('aa')\r\n\r\nhash = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d'","description_html":"\u003cp\u003eConduct SHA256 hashing on a hexadecimal input to produce a 256-bit hexadecimal output.\u003c/p\u003e\u003cp\u003eExample:\r\nhash = SHA256('aa')\u003c/p\u003e\u003cp\u003ehash = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d'\u003c/p\u003e","function_template":"function hash = SHA256(x)\r\n  hash = x;\r\nend","test_suite":"%%\r\nx = 'aa';\r\ny_correct = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = 'aabbccddeeff';\r\ny_correct = '17226b1f68aebacdef0746450f642874638b295707ef73fb2c6bb7f88e89929f';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = 'aa0123456789bb0123456789cc0123456789dd0123456789dd0123456789ee0123456789ff0123456789';\r\ny_correct = '28b51d5465661e7565dbaad0f57b972694ff96722ad6b1272cb62f867cd3d850';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '010203040506070809a1a2a3a4a5a6a7a8a9aaabacadaeaf';\r\ny_correct = '05f6ae62f9e66bf381b8633f310203564ab5755a8ffeb5295df63d712b5b99b3';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '010203040506070809b0b1b2b3b4b5b6b7b8b9babbbcbdbebf';\r\ny_correct = '58c146ab1f285afdad8a88d1431138c7c585a8681cd05f3e7463e8c5cab1d85b';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '3df36325c49b52091e2f0dce4ef073909d93e7ec4a173410cc1499c73dbcc30d05fccbd049451fc23b2aff7692ac8a19ca25';\r\ny_correct = '65dc21caa32f64cc5761e7a33a4ce8444e5e92c581b109f40ab1c19137d6017a';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = 'b3569682a918fcc931450689e344c0c3ffb7ba93c4e618d38147aa0ecfd86e00585054b3ed07e34e9e07b6b7b288cbbba02f72a627a1365258db4295a5c97aae5ce479f4c640c0fdf116a20ac626898f45ba4b49446de8efda170b13443dce1657e28d29';\r\ny_correct = '515a258c12639a853a4b26787b57bb7a28e7c713d54c32e1ee69f475ee264315';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '3044ba9ded85376d8e56b86fb88e70d2afc5b71611d2cb22650544245ff343cdba78905e21ed126dc3e202ac51d48688176ed10d210c217a3ae40e3b26779e846c81b5264903742058db07007c0a2136d9c82ee83d63bd8860e0986b8ac2055b145e1cdcaba106fe095376730597b84501c1493e65215c00c25c662ec4cc521b1f7ef60f9604da3bef16473a062a40dfe008f23fdc5f';\r\ny_correct = '2290847297dd385e81d854e5ace68c58b26dfd0113a7308b580329ca40533b67';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '3c724b57efe352bf7cf9e1c1540578341a631ec8131c966dcbe08225dea603580b7ff83b7ee929a2fac613ac1823bd6a6d5419a912e8301e8aa2ff0278761fea5099579ac78002f0a10fc06995f5908d0638b80e9ac8cbe177ecd8e652ea52166c2798878b5047a2701a2d3c9af0bd9b305856195f062bd21c8efd211e4cb31252eb219db17229f07bbbcdf020b37a014ba86f34bd724fb2cb464c1591021806873950671c89fde44f1f7ee8c889e6847a4fa2540b34915adfdabdd84ced6cbea51e5d1a09e025d0';\r\ny_correct = 'a90514d0965382c793a5cfb5cd69fcdb36dcc68709c0ba8eeb1ac0a1af1cf428';\r\nassert(isequal(SHA256(x),y_correct))\r\n%%\r\nx = '1b7f378081dd1d40f56acc462e465935b0378ec3049a00db4e67bd7c74fd8395c1e0d55090e0bb41fde3ea787aa88377bb1397129dea43b8e57d940347564c6359fddbfd8520ae9a8cda95492ca640505f40d1d754afb1134b6372b53f57550039b79b42b7ae6f89fe5abefb544182b556cc58567bc6c46ec5dc96a4d4b04504bc108206ee027e921032e9ed735c8eab0cb05c5e25a62e9cd56e8e51d060e5a9039dfefa5b1ae7bf479531a1e5d94574260ff939af92f1491dd268a41cf9fa449d78e66c4e3fed5421ba1d23a3971492d170edd114789009f02799d9f1bc42f40dffde18f4d3fcf5ad843c8b70ff481dfc9dc25659c64d5435db';\r\ny_correct = '6385659325be088ca568830f97a3495a693ced0541174d15bcf163c12f6ade46';\r\nassert(isequal(SHA256(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-08T23:37:42.000Z","updated_at":"2026-03-02T13:22:56.000Z","published_at":"2020-02-08T23:39:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConduct SHA256 hashing on a hexadecimal input to produce a 256-bit hexadecimal output.\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\u003eExample: hash = SHA256('aa')\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\u003ehash = 'bceef655b5a034911f1c3718ce056531b45ef03b4c7b1f15629e867294011a7d'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"group:\"Advanced Cryptography Algorithms and Mathematics\" difficulty_rating_bin:medium","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":"group:\"Advanced Cryptography Algorithms and Mathematics\" difficulty_rating_bin:medium","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"group":[["group:\"Advanced Cryptography Algorithms and Mathematics\"","","\"","Advanced Cryptography Algorithms and Mathematics","\""]],"difficulty_rating_bin":[["difficulty_rating_bin:medium","","","medium",""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc28a0\u003e":["Advanced Cryptography Algorithms and Mathematics"],"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2800\u003e":["medium"]},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc1f40\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2b20\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2a80\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdbc3cc29e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdbc3cc2940\u003e":"group:\"Advanced Cryptography Algorithms and Mathematics\" difficulty_rating_bin:medium"},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2940\u003e":"group:\"Advanced Cryptography Algorithms and Mathematics\" difficulty_rating_bin:medium"},"queried_facets":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc28a0\u003e":["Advanced Cryptography Algorithms and Mathematics"],"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2800\u003e":["medium"]}},"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":"cody-search","password":"78X075ddcV44","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":"group:\"Advanced Cryptography Algorithms and Mathematics\" difficulty_rating_bin:medium","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"group":[["group:\"Advanced Cryptography Algorithms and Mathematics\"","","\"","Advanced Cryptography Algorithms and Mathematics","\""]],"difficulty_rating_bin":[["difficulty_rating_bin:medium","","","medium",""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc28a0\u003e":["Advanced Cryptography Algorithms and Mathematics"],"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2800\u003e":["medium"]},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc1f40\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2b20\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2a80\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdbc3cc29e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdbc3cc2940\u003e":"group:\"Advanced Cryptography Algorithms and Mathematics\" difficulty_rating_bin:medium"},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2940\u003e":"group:\"Advanced Cryptography Algorithms and Mathematics\" difficulty_rating_bin:medium"},"queried_facets":{"#\u003cMathWorks::Search::Field:0x00007fdbc3cc28a0\u003e":["Advanced Cryptography Algorithms and Mathematics"],"#\u003cMathWorks::Search::Field:0x00007fdbc3cc2800\u003e":["medium"]}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":46627,"difficulty_rating":"easy-medium"},{"id":45242,"difficulty_rating":"easy-medium"},{"id":46630,"difficulty_rating":"medium"},{"id":46633,"difficulty_rating":"medium"},{"id":45211,"difficulty_rating":"medium"},{"id":45200,"difficulty_rating":"medium"},{"id":45243,"difficulty_rating":"medium"},{"id":45320,"difficulty_rating":"medium"}]}}