{"group":{"group":{"id":14128,"name":"Advanced Cryptography Algorithms and Mathematics","lockable":false,"created_at":"2021-01-26T03:36:13.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":null,"is_default":false,"created_by":145982,"badge_id":62,"featured":false,"trending":false,"solution_count_in_trending_period":1,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":1803,"published":true,"community_created":true,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"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\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\"}]}","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: 289.5px 10.5px; transform-origin: 289.5px 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: 266.5px 10.5px; text-align: left; transform-origin: 266.5px 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=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2021-01-26T04:06:26.000Z"},"current_player":null},"problems":[{"id":44956,"title":"Determine RSA keys (public and private) given two prime number character strings (p and q)","description":"Given two prime number character strings (p and q), generate the RSA public and private keys (n and d) with e = 65537. The more difficult part is doing this without the use of symbolic numbers.\r\nExample: p = '3355335697481001330501721', q = '5955344080483688912855719'\r\nn='19982178584029090861856118769095354822153154192399'\r\nd='3270348772331599380262578849367006078599068947553'\r\n\r\n\u003chttps://simple.wikipedia.org/wiki/RSA_algorithm\u003e\r\n\r\n\r\n\r\n\r\n","description_html":"\u003cp\u003eGiven two prime number character strings (p and q), generate the RSA public and private keys (n and d) with e = 65537. The more difficult part is doing this without the use of symbolic numbers.\r\nExample: p = '3355335697481001330501721', q = '5955344080483688912855719'\r\nn='19982178584029090861856118769095354822153154192399'\r\nd='3270348772331599380262578849367006078599068947553'\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://simple.wikipedia.org/wiki/RSA_algorithm\"\u003ehttps://simple.wikipedia.org/wiki/RSA_algorithm\u003c/a\u003e\u003c/p\u003e","function_template":"function [n,d] = keyGeneration(p,q)\r\n  n = p;\r\n  d = q;\r\nend","test_suite":"%%\r\np = '3355335697481001330501721';\r\nq = '5955344080483688912855719';\r\nn='19982178584029090861856118769095354822153154192399';\r\nd='3270348772331599380262578849367006078599068947553';\r\n[a,b]=keyGeneration(p,q);\r\nassert(isequal(a,n))\r\nassert(isequal(b,d))\r\n%%\r\np = '813610636673';\r\nq = '1605983302589';\r\nn='1306645097305643499246397';\r\nd='355984378478555057894913';\r\n[a,b]=keyGeneration(p,q);\r\nassert(isequal(a,n))\r\nassert(isequal(b,d))\r\n%%\r\np = '67979691391330950855242581938207942707483223433259';\r\nq = '6153843674264879356192291854148321819411378704398479';\r\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';\r\nd='8444986024072025211908427894173383040354675378319105204646840203847580180874615752845913488969020869';\r\n[a,b]=keyGeneration(p,q);\r\nassert(isequal(a,n))\r\nassert(isequal(b,d))\r\n%%\r\np = '9889977922600049892469466917642800243744956526655686322206918503863571743809023708648966023469645149';\r\nq = '2476454822450020555811121392457617785385805217059253393679351596046272567110905233495088857069108236299';\r\nn = '24492083520347129695334786995557239882540750861618765872694983337614252441655470479409598244691513160097634784088025768219041142794039842531021683737585081956313858395523050254392582005967309810771063551';\r\nd = '7043758337908398316945695794623843894382227935971901356005844728128437829322707899292187736941661046350269216062193211515498221491327821445579367736374708711769362662280124297131956999441862850977388289';\r\n[a,b]=keyGeneration(p,q);\r\nassert(isequal(a,n))\r\nassert(isequal(b,d))\r\n%%\r\np = '26892754546730837119898059580995437039544399594421875855251066246511044160199048288603963625982639028058714345196159764252398791569637860905138287322706679328840515337572608690956308136959236074835599';\r\nq = '76019400184540822543696224086250845563040709795227937154720461468348727220343229834542918037619525984430713380822472295398107810565069813256377730791194881206750953165713183208458761595898204049235781';\r\nn='2044371069952561243871813747701535503388267616657953475148898181142012590397809234167373308955772082860082985954286137615597515257087506574051530104475374974920093127841789408014496870693507622812332673504654584870100580476794800708440785082437228308551107726064054828640053321250498545183042994878498928173976370185712833904492317580152665428272199317847097773542066059565512439224992672101163367819';\r\nd='131358569595346680469722564224349085322306406056832660693226883146757023027681686453130430199929142940992255578581548217026735077095312421736286269892515739496597527524021166625708322359741224036234988705082882699895245449017415856831226734459122764117157172961113990706104659539690141481103935528273973382371183154438463086325519326121228923730136467766036183357672350586091588640276470994058874793';\r\n[a,b]=keyGeneration(p,q);\r\nassert(isequal(a,n))\r\nassert(isequal(b,d))","published":true,"deleted":false,"likes_count":3,"comments_count":10,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2019-08-28T22:45:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-08-26T02:38:07.000Z","updated_at":"2026-03-04T16:55:19.000Z","published_at":"2019-08-26T02:45:23.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 two prime number character strings (p and q), generate the RSA public and private keys (n and d) with e = 65537. The more difficult part is doing this without the use of symbolic numbers. Example: p = '3355335697481001330501721', q = '5955344080483688912855719' n='19982178584029090861856118769095354822153154192399' d='3270348772331599380262578849367006078599068947553'\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:hyperlink w:docLocation=\\\"https://simple.wikipedia.org/wiki/RSA_algorithm\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://simple.wikipedia.org/wiki/RSA_algorithm\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\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":44924,"title":"Create State Array for initiating SHA-3-224 Hash","description":"Create binary represented state array (as the initial input to the sponge function (f)) from any length character array (N) with width (b=1600), digest length (d=224) and lane size (w=64) using SHA-3 Standard:\r\n\r\n\u003c\u003chttps://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf\u003e\u003e. \r\n\r\nConvert character array to binary representation using UTF-8 value of each character. Output state array will be a matrix with size (5,5,64). Padding in accordance with the standard is required. XOR of the rate bits (r) with the padded message stream is required.","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: 165px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.5px; transform-origin: 407px 82.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; 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 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCreate binary represented state array (as the initial input to the sponge function (f)) from any length character array (N) with width (b=1600), digest length (d=224) and lane size (w=64) using SHA-3 Standard:\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=\"\"\u003ehttps://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf    \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; 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=\"\"\u003eConvert character array to binary representation using UTF-8 value of each character. Output state array will be a matrix with size (5,5,64). Padding in accordance with the standard is required. XOR of the rate bits (r) with the padded message stream is required (see figure 7, page 18). Just the first 1600 bit input to the first function (f) represented as a state array (see section 3.1.2) is required for the output.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function A = SHA3(N)\r\n  A=zeros(5,5,64);\r\nend","test_suite":"%%\r\nN = '';\r\nA='0110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(SHA3(N),reshape(reshape(A-48,[64,25])',[5,5,64])))\r\n%%\r\nN = 'abcdefghijklmnopqrstuvwxyz';\r\nA='1110000000000000000000000100000000000000000000000001000000000000000000000000010000000000000000000000011000000000000000000000000100000000000000000000001110000000000000000000000111000000000000000000000010000000000000000000000000110000000000000000000000000000000000000000000000001000000000000000000000001110000000000000000000000011000000000000000000000011100000000000000000000001000000000000000000000000011000000000000000000000001000000000000000000000000010000000000000000000000101000000000000000000000011100000000000000000000001110000000000000000000000100000000000000000000000001100000000000000000000000110000000000000000000000100000000000000000000000001100000000000000000000000110000000000000000000000111000000000000000000000010000000000000000000000000110000000000000000000000011000000000000000000000011100000000000000000000000010000000000000000000000111000000000000000000000011100000000000000000000001010000000000000000000000010000000000000000000000001000000000000000000000001100000000000000000000000111000000000000000000000001100000000000000000000001110000000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000010100000000000000000000001110000000000000000000000111000000000000000000000011100000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000100000000000000000000000011000000000000000000000011100000000000000000000001100000000000000000000000000000000000000000000000010000000000000000000000000100000000000000000000000000000000000000000000000011000000000000000000000001100000000000000010000000';\r\nassert(isequal(SHA3(N),reshape(A-48,[5,5,64])))\r\n%%\r\nN = '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\nA='1100100110010011000000000000101010010010011000000011001110100011111100000000101010011011101000000000010111111111000011000000001110110011000101100000000010000111010110100000000110100001010011100000000010110101100011100000000000001001001000100100000000000011001001111001000000010011000011100001100000000011000001100100110000000111110000100001110000000011001001100101110100000001101001100100111100000000000011110101110010000000010001110001110111100000001111110101011011110000000111100100111000111000000011111000110111111000000001110110110001111010000000110111111000111011000000010101110010111011000000000111110110001010100000000000111100011000001000000001111000001000001100000000110010011000111100000000110100011010011101000000010011111001011100000000000010011010001100100000000100111001011101101000000011101001101110101100000000101001011101101010000000011000010100000110000000011011111101101110100000001001010100111110010000000000111110010010101000000000000101001110010000000001100100001110001010000000011100000110010011000000011100001111100101000000000100010010000111000000000101001111100011011000000000100110011111100100000000100110001011000010000000001110101011100010000000001101010111001101100000000111010011011001100000000110010111001001111000000010110111101100110100000001010011101001100000000000011011001011101010000000010111011000101111000000001111001110101101010000000111011111100110110000000011010011100110110000000001010011100001010000000000001001100000011100000000011001110000010110000000000011100010110001010000000001100001110000111000000000100111111000111100000001100100111000001000000000';\r\nassert(isequal(SHA3(N),reshape(A-48,[5,5,64])))\r\n%%\r\nN = '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. Third, adjust all your means to that end.';\r\nA='1100010111000111000000000011011110001111011000000000101010111111011000000000111110110101011010000000110110001011111001000000010110000011001101100000000111000111001110110000000110000111000101110000000010100011010001100100000000001111100001100000000000110011001011101010000000000101011001100101100000000111001101110100010000000101010100110101110000000011101001100100010100000001000010100001110100000000101000101110010110000000000000100100111110000000000001100101110010010000000101100000010000101000000001110001011101011000000001100000010110101010000000100000110001001001000000010100110000111000100000000000110100101100010000000001110110001110001000000011010011011010011100000001011111011000101100000000110001101000011100000000010100111010010110100000001011111011001100000000000000011000101101100000000010011000001100101100000000001010001101000110000000011001101100101111000000001001101101010110000000001000011000101110100000000000001110101110011000000011011100001111111100000001001101001111010000000000001100011110011111000000001100011110011111000000000100100110000111010000000100001111011111101000000000011110000111001100000000111110011111010000000000001110011111111100000000001110110011000100100000000111010111010001100000000110000111000111100000000010110011000001100000000000010101001000101000000000110011001011110000000000001011000011100100100000000011010111100001100000000011011110101011111000000011011011111001110000000001000001100100110110000000011000100011111010000000000010111010110100000000000011100101110000110000000011110110110010111000000011101001111010111000000001100000111010001010000000';\r\nassert(isequal(SHA3(N),reshape(A-48,[5,5,64])))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-06-18T00:59:47.000Z","updated_at":"2025-10-16T14:21:12.000Z","published_at":"2019-08-28T19:00:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate binary represented state array (as the initial input to the sponge function (f)) from any length character array (N) with width (b=1600), digest length (d=224) and lane size (w=64) using SHA-3 Standard:\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\u003ehttps://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf    \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\u003eConvert character array to binary representation using UTF-8 value of each character. Output state array will be a matrix with size (5,5,64). Padding in accordance with the standard is required. XOR of the rate bits (r) with the padded message stream is required (see figure 7, page 18). Just the first 1600 bit input to the first function (f) represented as a state array (see section 3.1.2) is required for the output.\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":44959,"title":"RSA encryption using public key ","description":"Encrypt the message text by converting to uint8 matrix using UTF-8 representation. Convert uint8 matrix to a large integer string. Use RSA encryption on the integer string given the public keys (n and e) and output the encrypted integer string. The public key (e) will always be fixed at 65537. No hashing or padding of the message is done.\r\n\r\nFor example:\r\n\r\n  message = 'I like to swim!';%given as input\r\n  integer_String = '379695297047669462525290688599911713';%calculated\r\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';%given as input\r\ne= 65537;%fixed\r\noutput_String = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';%output\r\n\r\nSee:\r\n\u003chttps://simple.wikipedia.org/wiki/RSA_algorithm\u003e\r\n","description_html":"\u003cp\u003eEncrypt the message text by converting to uint8 matrix using UTF-8 representation. Convert uint8 matrix to a large integer string. Use RSA encryption on the integer string given the public keys (n and e) and output the encrypted integer string. The public key (e) will always be fixed at 65537. No hashing or padding of the message is done.\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003emessage = 'I like to swim!';%given as input\r\ninteger_String = '379695297047669462525290688599911713';%calculated\r\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';%given as input\r\ne= 65537;%fixed\r\noutput_String = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';%output\r\n\u003c/pre\u003e\u003cp\u003eSee: \u003ca href = \"https://simple.wikipedia.org/wiki/RSA_algorithm\"\u003ehttps://simple.wikipedia.org/wiki/RSA_algorithm\u003c/a\u003e\u003c/p\u003e","function_template":"function encrypted_message = RSA_Encrypt(message,n)\r\n  encrypted_message='14133';\r\nend","test_suite":"%%\r\nmessage = 'I like to swim!';\r\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';\r\nout = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';\r\nassert(isequal(RSA_Encrypt(message,n),out))\r\n%%\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\nn='44842008376687803367401704855862174057751658874412319214254366772513580664834338103711248053800336314605433363839051280089244765499067546768593375603554906634041005882836398715141891796137918851678901692978242458027064144613729242304549721699241688731628849316717564354846304644497408201649639245333007226999680183209765262168096747256549932760714835163829498814356014506466022681051474161134416048209239076204778228261950266231966892099194904195589855692846886804440024833800891898474520523721428667143505915995217245366095168045283186412220277535584022415882288464175935131208288146822299727657938865855853054174274144036081729604573534323903573564345990066095029031133576597298513883268061041004553754062342541175017746399640362184228727837219293246060058323563065371426108553463224921179093569734439828568435658070810483844709529476015493154462587917722806971578721201741643550136095893915598053953011321347017522943202801820158823344592288227452688958887872572522782675644714289349442555731461112275849176682816627205790162163242534462778708459909915826953853537650009043468930450287584181263070727575137424307931682948818963610116434419852585517456098152109913486868606969385133300794635427715727859479612757775192862801547635779921771426233897718528292667112148507798722127322607462037572360649156150337532940752245966765201596748120586383127825681873289878451591957019880886587602576426267683951317718936847177641679183717321862429721190212389237395890951104472937261743929446841800523276218816808066432194473964294708564511969507018959711475230849760902049071415838600456901108854663197095849833602808088094456341330276320302662577163562657750920481798540333412112880539002713127873625438212479154166226846436038698572615482646490520911334607730484144343834476612603467400722323562384577281087071440008144012534847478593412147312743274523095010025887231371129897419306984829625295595332434377173711414555784685658774002600022998291909172576630780759729269867715816511099791566815282862210319017784751883446582453959';\r\nout = '23055330962704323769878549529115024711681463755869375992447358448257597289666397997393945478297323372847937346015110864832142828615195632399869833059964395947034849804307978652470092440225822549097020437344501330227622390881049097656181781980124142659454562923055085607225529541369345564097544873012395850084756321027482195140106724706102857159831541577386517426252851135917933602432485339455137853480425755360413522537180403768732770990453717801905433194599201771294559164174484366213507079896512750859909040228686293902666244968559905065091421969981123917913807285202549025830873320919273470513619143052127674709353494599047667391749001044180280253098309127910967801244777547067797257847396027373615105278074126621948502699483945442597921239032762535839481741386676784123570880434889025648597593711911259097408384527597630246903648267481820555872340696607290773027177673329986283293168575528258578575033034179306629426942699054620008867304832513427178319015491321861291086200676826846740503213061372327825278234127270730394825241275398344604061667061892125034848354745243512927194104643800196788262228848172689053393410972717679060779374106225778531311917434399927265718394014531619654762559111657295163989321031700962115070401533540746801357628868609255941469541707984326602981168016264720519340003693219403163278843126513912057794102645161814569893320900148891952732032827189210372803453777673309727629845360314416264926243414888253428149538146304399700653423118791724424837155323935319171814705469113037576054893140065594406360362408167462563925199225169055130480445976569760198217276692195730775524801021060293503580957364539210146595506177369243830063105693396808209631409860229448190041996912370291877581261016834769083953407597967437841733812344230896457097759403613339974363380556576775192238298546579676296359906794868505900966056565863994904406875527092603782089107591766239203672780399852597928423220774857864301715176837587724591257928112610743311445186658958007825888475800717425136849205837547536117562642680';\r\nassert(isequal(RSA_Encrypt(message,n),out))\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\nn='2044371069952561243871813747701535503388267616657953475148898181142012590397809234167373308955772082860082985954286137615597515257087506574051530104475374974920093127841789408014496870693507622812332673504654584870100580476794800708440785082437228308551107726064054828640053321250498545183042994878498928173976370185712833904492317580152665428272199317847097773542066059565512439224992672101163367819';\r\nout = '99761240327251194937668282784881225946299704960682605372368300120848092908591455333889649815054891832920433772438140697229743047905660648016064750862552787515723449901585029566883857331537912668878918706229773460108043130645834201085405226084010413433457258525704626839479467337463012332940952234541291286602023412313079939518264986360860440514106228995186076871512459300140814669747884371890194124';\r\nassert(isequal(RSA_Encrypt(message,n),out))","published":true,"deleted":false,"likes_count":1,"comments_count":5,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":"2019-08-29T18:00:37.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-08-29T02:42:05.000Z","updated_at":"2025-10-15T14:57:07.000Z","published_at":"2019-08-29T02:52:31.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\u003eEncrypt the message text by converting to uint8 matrix using UTF-8 representation. Convert uint8 matrix to a large integer string. Use RSA encryption on the integer string given the public keys (n and e) and output the encrypted integer string. The public key (e) will always be fixed at 65537. No hashing or padding of the message is done.\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[message = 'I like to swim!';%given as input\\ninteger_String = '379695297047669462525290688599911713';%calculated\\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';%given as input\\ne= 65537;%fixed\\noutput_String = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';%output]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee:\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://simple.wikipedia.org/wiki/RSA_algorithm\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://simple.wikipedia.org/wiki/RSA_algorithm\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\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":44961,"title":"RSA decryption","description":"Decrypt a large integer string using RSA decryption given the public key (n) and private key (d). Convert the large integer decryption into an output message string with UTF-8 representation.\r\n\r\nExample:\r\n\r\n encrypted_message = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';%input\r\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';%input\r\nd='8444986024072025211908427894173383040354675378319105204646840203847580180874615752845913488969020869';%input\r\ndecrypted_message = 'I like to swim!';%output\r\n\r\n\r\n","description_html":"\u003cp\u003eDecrypt a large integer string using RSA decryption given the public key (n) and private key (d). Convert the large integer decryption into an output message string with UTF-8 representation.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e encrypted_message = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';%input\r\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';%input\r\nd='8444986024072025211908427894173383040354675378319105204646840203847580180874615752845913488969020869';%input\r\ndecrypted_message = 'I like to swim!';%output\u003c/pre\u003e","function_template":"function decrypted_message = RSA_Decrypt(encrypted_message,d,n)\r\n  decrypted_message = 'I like to swim!';\r\nend","test_suite":"%%\r\nm='158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';\r\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';\r\nd='8444986024072025211908427894173383040354675378319105204646840203847580180874615752845913488969020869';\r\nmessage = 'I like to swim!';\r\nassert(isequal(RSA_Decrypt(m,d,n),message))\r\n%%\r\nm='99761240327251194937668282784881225946299704960682605372368300120848092908591455333889649815054891832920433772438140697229743047905660648016064750862552787515723449901585029566883857331537912668878918706229773460108043130645834201085405226084010413433457258525704626839479467337463012332940952234541291286602023412313079939518264986360860440514106228995186076871512459300140814669747884371890194124';\r\nn='2044371069952561243871813747701535503388267616657953475148898181142012590397809234167373308955772082860082985954286137615597515257087506574051530104475374974920093127841789408014496870693507622812332673504654584870100580476794800708440785082437228308551107726064054828640053321250498545183042994878498928173976370185712833904492317580152665428272199317847097773542066059565512439224992672101163367819';\r\nd='131358569595346680469722564224349085322306406056832660693226883146757023027681686453130430199929142940992255578581548217026735077095312421736286269892515739496597527524021166625708322359741224036234988705082882699895245449017415856831226734459122764117157172961113990706104659539690141481103935528273973382371183154438463086325519326121228923730136467766036183357672350586091588640276470994058874793';\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\nout=RSA_Decrypt(m,n,d);\r\nassert(isequal(RSA_Decrypt(m,d,n),message))\r\n%%\r\nm='23055330962704323769878549529115024711681463755869375992447358448257597289666397997393945478297323372847937346015110864832142828615195632399869833059964395947034849804307978652470092440225822549097020437344501330227622390881049097656181781980124142659454562923055085607225529541369345564097544873012395850084756321027482195140106724706102857159831541577386517426252851135917933602432485339455137853480425755360413522537180403768732770990453717801905433194599201771294559164174484366213507079896512750859909040228686293902666244968559905065091421969981123917913807285202549025830873320919273470513619143052127674709353494599047667391749001044180280253098309127910967801244777547067797257847396027373615105278074126621948502699483945442597921239032762535839481741386676784123570880434889025648597593711911259097408384527597630246903648267481820555872340696607290773027177673329986283293168575528258578575033034179306629426942699054620008867304832513427178319015491321861291086200676826846740503213061372327825278234127270730394825241275398344604061667061892125034848354745243512927194104643800196788262228848172689053393410972717679060779374106225778531311917434399927265718394014531619654762559111657295163989321031700962115070401533540746801357628868609255941469541707984326602981168016264720519340003693219403163278843126513912057794102645161814569893320900148891952732032827189210372803453777673309727629845360314416264926243414888253428149538146304399700653423118791724424837155323935319171814705469113037576054893140065594406360362408167462563925199225169055130480445976569760198217276692195730775524801021060293503580957364539210146595506177369243830063105693396808209631409860229448190041996912370291877581261016834769083953407597967437841733812344230896457097759403613339974363380556576775192238298546579676296359906794868505900966056565863994904406875527092603782089107591766239203672780399852597928423220774857864301715176837587724591257928112610743311445186658958007825888475800717425136849205837547536117562642680';\r\nn='44842008376687803367401704855862174057751658874412319214254366772513580664834338103711248053800336314605433363839051280089244765499067546768593375603554906634041005882836398715141891796137918851678901692978242458027064144613729242304549721699241688731628849316717564354846304644497408201649639245333007226999680183209765262168096747256549932760714835163829498814356014506466022681051474161134416048209239076204778228261950266231966892099194904195589855692846886804440024833800891898474520523721428667143505915995217245366095168045283186412220277535584022415882288464175935131208288146822299727657938865855853054174274144036081729604573534323903573564345990066095029031133576597298513883268061041004553754062342541175017746399640362184228727837219293246060058323563065371426108553463224921179093569734439828568435658070810483844709529476015493154462587917722806971578721201741643550136095893915598053953011321347017522943202801820158823344592288227452688958887872572522782675644714289349442555731461112275849176682816627205790162163242534462778708459909915826953853537650009043468930450287584181263070727575137424307931682948818963610116434419852585517456098152109913486868606969385133300794635427715727859479612757775192862801547635779921771426233897718528292667112148507798722127322607462037572360649156150337532940752245966765201596748120586383127825681873289878451591957019880886587602576426267683951317718936847177641679183717321862429721190212389237395890951104472937261743929446841800523276218816808066432194473964294708564511969507018959711475230849760902049071415838600456901108854663197095849833602808088094456341330276320302662577163562657750920481798540333412112880539002713127873625438212479154166226846436038698572615482646490520911334607730484144343834476612603467400722323562384577281087071440008144012534847478593412147312743274523095010025887231371129897419306984829625295595332434377173711414555784685658774002600022998291909172576630780759729269867715816511099791566815282862210319017784751883446582453959';\r\nd='6565816445407878925089441991498747612160839198603241148969054176252198301108538816900577327681584864655900309129187116952811278662878254707896639032786256375181309679291058212467790617143590175026484896254317631677185521639888090836542092702228103896557828982761215001435908561096741216458335569193212038242350596427680660630865867932219252556141104387324837429582683296520255026128293117631961432452139374326884841820676484348718346835892309697741432400454075190738155214690226263908349465883864526754491093121291860880617807231984031261908018115438062149668224668541927056762969514272957080528641551440449912383177971011340773567381595669197227397095749281691989236351340479846140946699426488082757798251098448588056674770754671643802109836061405587518383808732642252532232749119323532411226969424472963287039513173436339822906642733903667734412972727748722945805719038892729473535651253460092450459024621811281873600606895132005494130257832946742084673535377347237875132451694131873556170785954511701761479583203082125987308962572083138475191433479413530168163642321800669575367485309537509082240852273955663933547032858727060003363699057579114677450927657082252183166216411898446363400905797006665507108575986344278988745322935954278566001664060256959781130851422164231215979527541890717097899466088129536122753240075629363188908753526503257284825826946057815889269456925910606842810401392503996936381736547569711529540423604489529836981870198914784848089842823822656591932437295439032050213520000125621624734133380868707883468507784350355251698659006842220673722867592264770652693364873913361956132623339827358272992906883218249723187904101702943978747751691915678242891407493339828656260188711974558580485287404900248093520605466868886511014909072710668999090169680693653605673085931199903788603401848851956524927526592113342563256817891019122155938256416456381627581783190684277329685396205824988569434587069719626936811661218907123975873968219302538615272967013401476757929690613750478379916399826582503908605565505';\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\nout=RSA_Decrypt(m,n,d);\r\nassert(isequal(RSA_Decrypt(m,d,n),message))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":"2019-09-08T23:48:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-08-29T18:26:28.000Z","updated_at":"2025-10-15T14:51:55.000Z","published_at":"2019-09-05T14:41:54.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\u003eDecrypt a large integer string using RSA decryption given the public key (n) and private key (d). Convert the large integer decryption into an output message string with UTF-8 representation.\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\u003eExample:\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[ encrypted_message = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';%input\\nn='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';%input\\nd='8444986024072025211908427894173383040354675378319105204646840203847580180874615752845913488969020869';%input\\ndecrypted_message = 'I like to swim!';%output]]\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":44963,"title":"Mask Generation Function (MGF1) for PKCS #1 Standard utilizing Optimal Asymmetric Encryption Padding for RSA Cryptography","description":"Create Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1 page 50) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\r\n\r\nFor example:\r\n\r\n  mgfSeed = 'I like to swim.';%input\r\n  maskLen = 20;%input\r\n  mask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];%output\r\n\r\n\r\n\u003chttps://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf\u003e","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 194px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 97px; transform-origin: 407px 97px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCreate Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 60px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30px; transform-origin: 404px 30px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emgfSeed = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'I like to swim.'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emaskLen = 20;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003emask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function mask = mgf(mgfSeed,maskLen)\r\n    mask = []%octet array of length maskLen\r\nend","test_suite":"%%\r\nmgfSeed = 'I like to swim.';\r\nmaskLen = 20;\r\nmask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))\r\n%%\r\nmgfSeed = 'People who succeed have momentum. The more they succeed, the more they want to succeed and the more they find a way to succeed. Similarly, when someone is failing, the tendency is to get on a downward spiral that can even become a self-fulfilling prophecy.';\r\nmaskLen = 825;\r\nmask = [40    55   251    83   143   211    49    16    87    56   109   116    17   188    72    54   231    67   125   182   223    53   149    36   246   233    71   113   113    29   176    61    74    77   205   167   179    99   172   172   212   249    53   148    13    89   253     3    85     0   155   181    94    15     8   122   120    92    29   229   229    46   192   162   252   119   243    94    52    12   133    98   161   249   152    68    69    22 156   155   229   132    30   163   102    90   217   160    36    53   185   128    74   224   105   214   134    90   188   101    98   220    43   162   251   183    72    54   219     4    44   185   199   193    31    42   129   112    74    25    81   133    70   156    38   225   243    24    50   132    79   130    42    72   145   158   105   253   190    62    73   107    95   133    78   238   214    39    88   245    40    46   166   201   173   209   234   194     3   117   226    32   176    12   139    83   211    67   101    99   174   126   103   130    83    56   157    52    76    21   189    99   217    43   150    92   219   148   173   138   184   183   203    62   231   125    42    79    29   248    30    26   127    50     9    31   219   212   160   157   243    15    52   217     7   144    43   241    70    98   247   231   174   111    96    91   108    59   164   146    77   180   212   155   165    18   150   198   100   233   255   129    44   170   150   243   244   126   203   255   231    28    94    77    58   198   147    84   212   248    36    34   107   210    77    79    80   224    24   126    88   125   255    11   124   227    44   253   242   234    59   176   108   146   170   132    20   128   230   141   187    81   139    26   119    47   159     8   182    40    94   213   107   223    21   187    35     1    40   145   154    92   218   252    46   201   203    65    48    94   118   110     5   158   212    19   129     9    59   124    19   190   201    55   141   124   210    85   240    34   150    81   154    11     3   116   204    37    73    39   169   234    50   241   131    94     9   133     0   209   190   171   206    93   165   145   142   117   230    34   245   223   205   153   227   202     3   218    56   163   203   137    46   114    78   248   196   136    19   177   126    95   231   213   251   130    39    57    59   228   251    73    48     9   109    11   172   152   223   120   153   108   233    76   117   219     8     6   124    44     7   249   116    43   198    98    55   235    52    47   146   239    76   142    88    19    64   169   209   206   255   101    91   197    36   180   253    52    54    63   198    63   113    58    43   229   141    59     4   147    34   200     7   184   108   176   153    95    94    18   235   178   160    51    63   154   227    39   231    71   246   109    13   199   185   220   180    50   146    85   194   176   175   159   103   177    47   149   252   182    33   224   226     1   232   167    94    93   202    55    60   201   228   107   135   142    22   165   168   124   219   216    34   230   174   179    66    67    91    92   186    30    48     9   177   192   254   190   236    52    84   114   255     3    81   150   112   131    49   157    48   243   218    11   132    40    13    68   214   159    36   109   152   219    32   219   193   182    69    37   104   217   115    54   158    79    90     3   223   116   127     8    28   233   223   194    30   241   180    45   209    77   180   184    52   132   164    49   206    50    57   149   118   105    44    25   212   141   253   150    45   244    73   203    10   137   161   118    49   165   248   105   215    58    90    67   180    78    22   135   102   173   139    62    31    63    82   187    78    47     2   176   144    83    22   143    31   155     8   160    12   252   164    52   159   102   113    95   132    49   168   194   137    32   131   189   139    77   143   248    36    30   154   239   163   149    86     9   178   122     6   248    25   208   211   142    59    23    72    43   158   195   244   232   229   245   148    49   163    28    81    93   106    33   239   249    26   220    73    65   112   249   254   251    91   106   204   113    10    59    34   114   189   185   188   181   100   185    22   188   221   187   109   170    35    57   181   234   157   230   206   169    97   140    51   170   128   215   188    14    50   190   167    41   173    19    10    98   165    12    77    49    21    33   147    93    84   163   106   151   234    76   252    91   165   248   223   136    85   124   174    90   188   130   174    83    92   181   134    65    91   105    15   103    91    15    27   201   162    58    84   164    33   137    63     0    84     0    78   180    31   218    47    84    43    13    35   122   117   205    59    81   146    97    14];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))\r\n%%\r\nmgfSeed = 'First, have a definite, clear practical ideal; a goal, an objective. Second, have the necessary means to achieve your ends; wisdom, money, materials, and methods.';\r\nmaskLen = 300;\r\nmask = [96   185   223   209   149    51   224   128   249   139    57   249   190    69   199   132    37    24    75   127    98    59   231   206    13    83    79   111   181   220   204   120    27   178   155   116   155    11   157   112    10   195   106     4   127   146   101   112   197    29    54    45    14    78    16   100     1   111   156    44   138   141   219   101   171     1   126   254    60    82   214    63    13    94   227   238    64   173    93   142     3   224    63    76     8   190   105     8    77   113   250   243   249    82    56   124   129   116   121   131   207   116    80   185    72   184   244   232   236   127    37   195   236   163   176   245    65    48   169   131    19    36   208   178   184   150   188    50   221    83   132   241    73   205    23     9    41    74    65   251    10    21   133   150   101    15    42   153   164   197   136    19   113   134   153   247    10   161   221   184   195   215   253   149   223    83   180   148   198     4    53   112   114    39    18   132   254   170   130    61     6   158   224   166    76   187   190   128    14   251   158   218   192    68    46   210   199   231   120    57   212    10   107     2    50    37   110    30    87    48     2   134    81   165   107    95   250   206    98    26    45   102   173    46    85   103   137     4   140   154   236   142   125   211    28   164    94    41     8    70   215    10    13   140   139    97   205    60   212   205    35   175   235   158    88   165    40    41   187   215    72   172    97   159   119    79    80    31   128   121   108    94   219   216    77   209   184   244    90   238   182   207   244    52   248     6   220   175   117   122   236   228   219    42    49   196   186    12    19    95];\r\nassert(isequal(mgf(mgfSeed,maskLen),mask))","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-09-06T22:10:21.000Z","updated_at":"2025-10-15T14:43:51.000Z","published_at":"2019-09-06T22:31:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate Mask Generation Function (MGF1) from PKCS #1 v2.2 standard (B.2.1) at below link. Input will be character array (mgfSeed) which will need to be converted to octet array using UTF-8 representation. Output must be octet array (uint8) of length, maskLen (input). Hashing must use SHA-1 (160 - 20 byte).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[mgfSeed = 'I like to swim.';%input\\nmaskLen = 20;%input\\nmask = [170,251,101,210,23,101,10,242,193,163,174,148,104,138,228,245,52,234,0,195];%output]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44964,"title":"Optimal Asymmetric Encryption Padding of message for RSA Cryptography ","description":"EME-OAEP encoding of input message using a Feistel network with SHA-1 hashing within the mask generation function (MGF1) (see problem 44963/below link 7.1.1 page 18). Inputs will include message (M), label (L), a random seed (seed) array of octets of length 20 (needed such that outputs can be compared), and output length (k). Output (EM) array will be an array of octets of length, k. Hash length will always be 20 for SHA-1 (160-20 bytes). The character length of input message will never exceed k-42.\r\n\r\nFor example:\r\n\r\n  M = 'I like to swim.';%input\r\n  L = 'abcdefghijklmnopqrstuvwxyz';%input\r\n  seed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172];%input\r\n  k = 100;%input\r\n  EM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,...\r\n87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,...\r\n35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,...\r\n217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,...\r\n148,12,50,108,248,32,94];%output\r\n\r\n\u003chttps://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf\u003e","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 356px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 178px; transform-origin: 407px 178px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 105px; 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 52.5px; text-align: left; transform-origin: 384px 52.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=\"\"\u003eEME-OAEP encoding of input message using a Feistel network with SHA-1 hashing and mask generation function (MGF1) (see problem 44963/below link, section 9.1.1.1 (figure 1 shows the encoding process)). Inputs will include message (M), label (L), a random seed (seed) array of octets of length 20 (needed such that outputs can be compared), and output length (k). Output (EM) array will be an array of octets of length, k. Hash length will always be 20 from SHA-1 (160-20 bytes). The character length of input message will never exceed k-42.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 180px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 90px; transform-origin: 404px 90px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eM = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'I like to swim.'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eL = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'abcdefghijklmnopqrstuvwxyz'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eseed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172];\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ek = 100;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eEM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e148,12,50,108,248,32,94];\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function EM = EMEOAEPencoding(M,L,seed,k)\r\n  EM = []%octet array of length k\r\nend","test_suite":"%%\r\nM = 'I like to swim.';\r\nL = 'abcdefghijklmnopqrstuvwxyz';\r\nseed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172];\r\nk = 100;\r\nEM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,148,12,50,108,248,32,94];\r\nassert(isequal(EMEOAEPencoding(M,L,seed,k),EM))\r\n%%\r\nM = '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\nL = '';\r\nseed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172];\r\nk = 300;\r\nEM = [0   145   194    62    62   111    86   188    50    37   165   231    16    42    25    79   223   177   117   187   135   200   203   136   184   133    38   175    66    35   142   212   144   116    66    37   151     8   190   218    29   238   213    11   189   225    88    83   218   175   183    98    58   237    89    80   123    64    40   154   137    44    13   186    97   133    92    11   228    32   100   188    61    37   150   198   178    73   252    17   133   233    68    13    39    99     3   239   108   106   202   227   127   142    79    34   126   244    41    92   240     8   127   153   251    25    82    79   247    92   187    51    84    38   104   240    52   209   144   160   144   119   131    67   128   116    98   132    51    79     8   114    69   202    80   243   194    61    17    33   225   232   173     5   153   230    32   155    34    62    72     2   211   212   227     5   115   217    33   189    21   170    51   190   217   119   148    73   209   109   114    90   104   237   168    60   144   120   191     7   186     8   205   111   192   249   192   197    34   225   209   153   234     5    27   165    82    42   132   167   158    64   218   239    71    49   166    27    37     9   154     2   255   193    72    75     7   121   121   240    74   116   185    58    79   106    68    14    17    49    68    96   160     2    75    15   122   144    36    47   230   112    39   221    21   141   251   178    10   215   180   230   184   189   112   108   187    83    94   157    69   140   201    40   158   119    28   159   116   196   206   112    91   141    68   122   113   183    92   111    44   149   187   223   179   157    29    79   180   231    38   122   231    82    98    42    69    14   162    53];\r\nassert(isequal(EMEOAEPencoding(M,L,seed,k),EM))\r\n%%\r\nM = '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\nL = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';\r\nseed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172];\r\nk = 825;\r\nEM = [0    85    82   177   212   151     6   148    36   245   178   209   163    30    35   103   231   155   104   206    51   230   201    47   178   114   199    15   172   217   175    58    48   240   133     0   186   218    10   200    31   238   213    10   237   132    55    35   182   202   151    21    82   130   121    35    14    35    75   255   236    72    45   210     0   243    57    43   137    79     9   217    83    81   227   171   156   105   168   121   224   201    41    98    85     6    35   155     4    15   179   195    12   251    44    65    27   145    77   112   208   124    23   252   219   116    61    61   146   124   207    91    49    95    72   135    85   191   228   128   228    24   163    48   245    23     1   225    86    43    40    19    43   174   112   135   170    88    49    76   142   154   200    37   237   142    69   226     2    88    33   108   183   244   130    37     4   184    88   157    97   197    19   205   172    20   247    44   180     9    92   122    59   132   197    85   252    25   205   107   195    36   237    24   168   156   174   229    81   142   188   252   133   107   126   133    59    89   164   193   255    41   182   134    41    86   138    59    81    97   255    34   139   164    38    47    98    23    26   137   106    29   202    26    59     5   100   105   116    69   100    15   206    34    42    47    30   255    83    65   145    17    85   185    53   254   139   219   120   182   216   198   204   213    17    24   155    48    63   243   101   233   191    77   240    87   126   250    23   171   163    21   123   236   100     9    20   219    58    66    74   224   215   185   218   241   113    38   218   128     6    10   149    61    18    66    32   109   219    27   107   176    90   163   116    99    71    16   108    89   192   253   121   121    76   157   101   157   217    51    53   248   195    95    93   183    71    29   199     2   182    31   120    35   167    44   189   160     2   154   234   162   113   204    18   138    81   155    86   122   147    44    23   181    90   135    49   235    41   194    82   181    31    45   131    78   127   198   121   132    49     6   186    66   157   159    79   110   184   152    83   107    73    61    22    86   160   156   200   177    64   217    32   251   102     4   165   143   254   215   165   224   110    76    57    69    13   198   180   106   236    11    39   238     0   220    63   109   239   190    19    85    92    23    28   183   233    72    88   193     8   101   127   214   171     7    94   156   148   220    40    84    44   149     7   245   165   150   197    27    93   255   146    15   132   133   174   208     4   156   246    12    37    50    78    85    95   212   198    41    22   138   214   135   145   197   137   114   172   128    48   126   202   198     0    35    15    37   127     1    34    44   164    46   131    12    87   254     9   210   140    50    85   180   173   121    24    14   192   237    75   224    91   242   205   155     8   136    51    38   161     6   129   234    36     1    56   251    11     6    73    36    74   230    95   174    47    94    53   106   142    71   123    88    32    41     7   108    41   101    40   120   254   196    47   251    83   224   181   114   255   127    56     6   182   182   153   244   162   214   115   183   162    69    47   174   112    68    89   110   180    43    47   159   195   123    73   230   230   186   204   129   110   234   218   152    57   154   232    91    68   237   204   222   179   175   192   249     1   128     5   180    93    29    14    97   175   138   175   221   223   219    62    93   142    51   123   194    90     6   215    32   181    60    48    92   100   114    28   164    71   110   244   129   190   125    27   156   223   133     7   128    55   127    93     3    21    66    38   184    50    52     6   164   175    17   255   103    42    28   126    66    19   149    66     6   234   170   194   104    85    42   166   171   117   101    33    74    35   181    46   242   102   192   226   183   132   223   154    97   142   119   107     6    98    93   129   255   247   144   159    12   245   161   179    28     1   228    24    38   147    55   148    10   247   224   154   201   241    32    53    23   219    52     0   124    35    47    36    89   180    68    57   183   240    94   235    86   152   105    26   113    72    38    83   194   138    16    45   187    50   207   192   151    54    80   108   139   211   116   186   176    20   250    32   117   237   241   239   224   147   110    22   190    71    59    47    97     8   144   236   102     8   216   238   225    40   212   181   238   106   223    38   121   175    55    54   194   114   234   213    89    36   150   177   249    96   235    51    12   205    84   247   160    76];\r\nassert(isequal(EMEOAEPencoding(M,L,seed,k),EM))","published":true,"deleted":false,"likes_count":1,"comments_count":12,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-09-06T23:39:52.000Z","updated_at":"2025-10-15T14:05:18.000Z","published_at":"2019-09-07T00:59:36.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\u003eEME-OAEP encoding of input message using a Feistel network with SHA-1 hashing and mask generation function (MGF1) (see problem 44963/below link, section 9.1.1.1 (figure 1 shows the encoding process)). Inputs will include message (M), label (L), a random seed (seed) array of octets of length 20 (needed such that outputs can be compared), and output length (k). Output (EM) array will be an array of octets of length, k. Hash length will always be 20 from SHA-1 (160-20 bytes). The character length of input message will never exceed k-42.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[M = 'I like to swim.';%input\\nL = 'abcdefghijklmnopqrstuvwxyz';%input\\nseed = [147,11,108,119,5,16,236,136,93,93,38,38,89,86,200,124,118,33,226,172];%input\\nk = 100;%input\\nEM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,...\\n87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,...\\n35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,...\\n217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,...\\n148,12,50,108,248,32,94];%output]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44965,"title":"Optimal Asymmetric Encryption Padding decoding of message for RSA Cryptography","description":"EME-OAEP decoding by reversing the Feistel network using previously determined mask generation function (MGF1) and SHA-1 hashing. A matrix of octets is provided as the input (EM) which is the output of EME-OAEP encoding (see problem 44964/below link 7.1.2 page 21). The label (L) is not provided or checked against the encoded label. No error checks should be conducted. Output should be the character string represented by the octets.\r\n\r\nFor example:\r\n\r\n  EM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,...\r\n87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,...\r\n35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,...\r\n217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,...\r\n148,12,50,108,248,32,94];%input\r\n  M = 'I like to swim.';%output\r\n\r\n\u003chttps://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf\u003e","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 275px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 137.5px; transform-origin: 407px 137.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; 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=\"\"\u003eEME-OAEP decoding by reversing the Feistel network using previously determined mask generation function (MGF1) and SHA-1 hashing. A matrix of octets is provided as the input (EM) which is the output of EME-OAEP encoding (see problem 44964/below link, section 9.1.1.2). The label (L) is not provided or checked against the encoded label. No error checks should be conducted. Output should be the character string represented by the octets.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 120px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 60px; transform-origin: 404px 60px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eEM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); text-decoration: none; text-decoration-color: rgb(14, 0, 255); \"\u003e...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e148,12,50,108,248,32,94];\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eM = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); \"\u003e'I like to swim.'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); \"\u003e%output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function  M  = EMEOAEPdecoding(EM)\r\n  M = 'I like to swim.';\r\nend","test_suite":"%%\r\nEM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,148,12,50,108,248,32,94];\r\nM = 'I like to swim.';\r\nassert(isequal(EMEOAEPdecoding(EM),M))\r\n%%\r\nEM = [0   145   194    62    62   111    86   188    50    37   165   231    16    42    25    79   223   177   117   187   135   200   203   136   184   133    38   175    66    35   142   212   144   116    66    37   151     8   190   218    29   238   213    11   189   225    88    83   218   175   183    98    58   237    89    80   123    64    40   154   137    44    13   186    97   133    92    11   228    32   100   188    61    37   150   198   178    73   252    17   133   233    68    13    39    99     3   239   108   106   202   227   127   142    79    34   126   244    41    92   240     8   127   153   251    25    82    79   247    92   187    51    84    38   104   240    52   209   144   160   144   119   131    67   128   116    98   132    51    79     8   114    69   202    80   243   194    61    17    33   225   232   173     5   153   230    32   155    34    62    72     2   211   212   227     5   115   217    33   189    21   170    51   190   217   119   148    73   209   109   114    90   104   237   168    60   144   120   191     7   186     8   205   111   192   249   192   197    34   225   209   153   234     5    27   165    82    42   132   167   158    64   218   239    71    49   166    27    37     9   154     2   255   193    72    75     7   121   121   240    74   116   185    58    79   106    68    14    17    49    68    96   160     2    75    15   122   144    36    47   230   112    39   221    21   141   251   178    10   215   180   230   184   189   112   108   187    83    94   157    69   140   201    40   158   119    28   159   116   196   206   112    91   141    68   122   113   183    92   111    44   149   187   223   179   157    29    79   180   231    38   122   231    82    98    42    69    14   162    53];\r\nM = '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\nassert(isequal(EMEOAEPdecoding(EM),M))\r\n%%\r\nEM = [0    85    82   177   212   151     6   148    36   245   178   209   163    30    35   103   231   155   104   206    51   230   201    47   178   114   199    15   172   217   175    58    48   240   133     0   186   218    10   200    31   238   213    10   237   132    55    35   182   202   151    21    82   130   121    35    14    35    75   255   236    72    45   210     0   243    57    43   137    79     9   217    83    81   227   171   156   105   168   121   224   201    41    98    85     6    35   155     4    15   179   195    12   251    44    65    27   145    77   112   208   124    23   252   219   116    61    61   146   124   207    91    49    95    72   135    85   191   228   128   228    24   163    48   245    23     1   225    86    43    40    19    43   174   112   135   170    88    49    76   142   154   200    37   237   142    69   226     2    88    33   108   183   244   130    37     4   184    88   157    97   197    19   205   172    20   247    44   180     9    92   122    59   132   197    85   252    25   205   107   195    36   237    24   168   156   174   229    81   142   188   252   133   107   126   133    59    89   164   193   255    41   182   134    41    86   138    59    81    97   255    34   139   164    38    47    98    23    26   137   106    29   202    26    59     5   100   105   116    69   100    15   206    34    42    47    30   255    83    65   145    17    85   185    53   254   139   219   120   182   216   198   204   213    17    24   155    48    63   243   101   233   191    77   240    87   126   250    23   171   163    21   123   236   100     9    20   219    58    66    74   224   215   185   218   241   113    38   218   128     6    10   149    61    18    66    32   109   219    27   107   176    90   163   116    99    71    16   108    89   192   253   121   121    76   157   101   157   217    51    53   248   195    95    93   183    71    29   199     2   182    31   120    35   167    44   189   160     2   154   234   162   113   204    18   138    81   155    86   122   147    44    23   181    90   135    49   235    41   194    82   181    31    45   131    78   127   198   121   132    49     6   186    66   157   159    79   110   184   152    83   107    73    61    22    86   160   156   200   177    64   217    32   251   102     4   165   143   254   215   165   224   110    76    57    69    13   198   180   106   236    11    39   238     0   220    63   109   239   190    19    85    92    23    28   183   233    72    88   193     8   101   127   214   171     7    94   156   148   220    40    84    44   149     7   245   165   150   197    27    93   255   146    15   132   133   174   208     4   156   246    12    37    50    78    85    95   212   198    41    22   138   214   135   145   197   137   114   172   128    48   126   202   198     0    35    15    37   127     1    34    44   164    46   131    12    87   254     9   210   140    50    85   180   173   121    24    14   192   237    75   224    91   242   205   155     8   136    51    38   161     6   129   234    36     1    56   251    11     6    73    36    74   230    95   174    47    94    53   106   142    71   123    88    32    41     7   108    41   101    40   120   254   196    47   251    83   224   181   114   255   127    56     6   182   182   153   244   162   214   115   183   162    69    47   174   112    68    89   110   180    43    47   159   195   123    73   230   230   186   204   129   110   234   218   152    57   154   232    91    68   237   204   222   179   175   192   249     1   128     5   180    93    29    14    97   175   138   175   221   223   219    62    93   142    51   123   194    90     6   215    32   181    60    48    92   100   114    28   164    71   110   244   129   190   125    27   156   223   133     7   128    55   127    93     3    21    66    38   184    50    52     6   164   175    17   255   103    42    28   126    66    19   149    66     6   234   170   194   104    85    42   166   171   117   101    33    74    35   181    46   242   102   192   226   183   132   223   154    97   142   119   107     6    98    93   129   255   247   144   159    12   245   161   179    28     1   228    24    38   147    55   148    10   247   224   154   201   241    32    53    23   219    52     0   124    35    47    36    89   180    68    57   183   240    94   235    86   152   105    26   113    72    38    83   194   138    16    45   187    50   207   192   151    54    80   108   139   211   116   186   176    20   250    32   117   237   241   239   224   147   110    22   190    71    59    47    97     8   144   236   102     8   216   238   225    40   212   181   238   106   223    38   121   175    55    54   194   114   234   213    89    36   150   177   249    96   235    51    12   205    84   247   160    76];\r\nM = '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\nassert(isequal(EMEOAEPdecoding(EM),M))\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":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-09-07T01:49:31.000Z","updated_at":"2025-10-15T13:23:25.000Z","published_at":"2019-09-07T01:56:46.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\u003eEME-OAEP decoding by reversing the Feistel network using previously determined mask generation function (MGF1) and SHA-1 hashing. A matrix of octets is provided as the input (EM) which is the output of EME-OAEP encoding (see problem 44964/below link, section 9.1.1.2). The label (L) is not provided or checked against the encoded label. No error checks should be conducted. Output should be the character string represented by the octets.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[EM = [0,167,202,74,98,63,234,235,44,82,53,39,70,214,204,79,45,80,35,147,55,32,35,39,45,...\\n87,180,129,63,219,223,165,72,19,131,160,131,131,107,231,157,238,213,10,237,132,55,...\\n35,182,202,151,21,82,130,121,35,14,35,75,255,236,72,45,210,0,243,57,43,137,79,9,...\\n217,83,81,227,171,156,105,168,121,224,201,41,98,84,79,3,247,109,100,214,227,120,...\\n148,12,50,108,248,32,94];%input\\nM = 'I like to swim.';%output]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee: https://www.foo.be/docs/opensst/ref/pkcs/pkcs-1/pkcs-1v2-1d1.pdf\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"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":46761,"title":"Inverse Number Theoretic Transform (iNTT) ","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: 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 an input polynomial (rhat) of length n that has been Number Theoretic Transformed (NTT) modulo p, a prime number using it's primitive nth root of unity as the generator for the inverse tweedle factors, convert the polynominal coefficents by Inverse Number Theoretic Transform (iNTT) mod p back into the original polynomial coefficents.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function r = inverseNumberTheoreticTransform(rhat,n,p)\r\n r=rhat;\r\nend","test_suite":"%%\r\nn=210;\r\np=5881;\r\nr=[8669,57047,39514,17386,56675,3808,29999,47330,22216,26294,34536,58604,51010,4546,18270,24862,...\r\n    56667,27522,15720,39167,31418,58887,61257,53601,46459,48707,58963,4275,22014,284,54270,33255,...\r\n    23996,14853,35050,18971,4480,5568,4478,26857,8085,29033,58912,23176,7875,37297,57346,22844,...\r\n    2747,9328,5019,48531,29918,43794,45825,37444,41202,57525,43407,57371,30639,9262,4465,46808,...\r\n    20184,43985,42757,34802,46865,33083,31981,32626,61340,25511,7677,15756,44886,55001,63579,14101,...\r\n    49829,38279,26407,33426,32482,42688,48739,19788,5872,54130,25531,50810,11755,7167,59320,57432,...\r\n    65522,56639,2416,35696,65379,33489,57246,4602,64719,60470,36979,28276,22140,47233,894,24514,...\r\n    60469,35814,31056,32541,20248,62314,64355,33656,65050,29874,27921,13973,12664,54575,47620,34717,...\r\n    54334,33546,36173,13977,38523,9356,3422,44781,39882,14395,26625,41281,36392,8361,11088,65,...\r\n    27404,32013,10477,43701,1174,7843,62398,63953,2026,32367,56539,15917,54674,53319,41220,146,...\r\n    24885,59271,44587,24826,41415,15942,37448,64338,55684,18575,44725,23470,64679,5504,16404,53172,...\r\n    5532,34816,52469,48419,9284,28697,22962,31358,38496,9555,59331,41955,10678,37087,61054,51321,...\r\n    44937,30554,17060,37307,16303,20925,59690,58013];\r\nrhat=[4391        3275        5259        1238        4797        2486         919        3786        5067        4389\r\n        2255        3368         968        3027        4274        3358        2953        3646        2967        4281\r\n        5348         229        5498        5448        3419        3720         100        5376        2968        3437\r\n         404        3686        3576        4743        4840        4942        4237        1414         102        2806\r\n        3832        5075        5084        1139        2483        2021        5541        1332        5022        5155\r\n        5235        4306         797        2739         911        3669        4133         547        5678        5162\r\n        1905        4772        2478        1657        1905        2539        4053        3185        3567         113\r\n        1985         674        1359         182        1645        1249        1752         922        1178        5427\r\n        2476        1241        2496        1703        3691        5044         802         304         905        2280\r\n        2211        4163        4845         690        4246        3016        3159        1555        3762        1416\r\n         105        4332        2706         308        2230        2117         787        1189        5549          72\r\n        4092        4428        4103        3397        5700        5630        1803         840        4153        4385\r\n        5537        1564        5437        5553         377        3468        2885        4827        3523        2618\r\n        2238        3633        2254        4028        3660        1909        5874        1850        3153        2253\r\n           3        2286        1953          81        5161        5764        5063        2887        4983        3481\r\n        5044         770        1225        4832        1673        5556        2434          21        1735        5422\r\n        1003        2672        3262         982        2344         269        2638        3485        3278        4882\r\n        4604        5118        4587        2136        3361         478        5289         808        3170        3752\r\n        2862        4604        4813        3077        5849         813        1214         135        3691        4774\r\n        1668        4361        5564        3949        5019          71        2441        4481         722        5462\r\n        4925        2693          41        3294        3971         361        1224         445        5386         186];\r\nassert(isequal(inverseNumberTheoreticTransform(rhat(:)',n,p),mod(r(:)',p)))\r\n%%\r\nn=1024\r\np=12289;\r\nr=[52074       13446       46646        7881       15396       46708        6135       41514       35944       46632\r\n       60673       28779       56867       40989       26142       30972       42638       64624       10831       31518\r\n       11720        1785        7753       22717       17571       46438       14101       13576       32367       47787\r\n       33917       57421        2557       21929       54559       62787       15982       49616       35069       61443\r\n       41091       39983       39203       37658       65232       33146       22261       58086       13029       33898\r\n       59846       13342       39604       56619       42582       19991       12967       30948       40839       59183\r\n       43513       34073       33844       13013       46134       51761       33215       10414        1724       14299\r\n       25506        3527         492       44069       61099       15491       62308       53144       20892       57227\r\n       48497       56504       45149       59102       45065       15355       25860       31228       34930        5419\r\n       53584       29028       61998       13051       37247       30454       38303        7621       21415       30500\r\n       39344       35914       57248       19548       24959       40592       39750       57391       39465        1437\r\n        5570       37149        7423       32539       41587       40326       46834       41627       23719       52971\r\n       60447       44590       23237       58320       23804        8036       26315        6375        8842       11744\r\n        3512       24338       15855       32860       26713        8112       56275       59535       59887       10839\r\n       34539        5126       36722       18153       24163       18642       60324        2294       41979       11901\r\n        7789       29907       40155       34993       30696       48216       49206        2605       43173       45313\r\n       24913        3135       19713       37634       32991       26955       18716       64786       44258       14009\r\n       53269       48382       52307       27053       59672       54328       52220       44969       48795       19536\r\n       15997        2490       52143         967       13528       61283        9356       24686       55192       50353\r\n       57961       62537       51189       46056       22190       26153       33066       33051       33859       32843\r\n       46704       48652       23009       33210       37625        3421       40022       50036        9952       59602\r\n       24782       61436        3558       24986       31911       37433       46124        3203       24947        3791\r\n       16313       33643       46445        4255       17184       48999       25122       47574       53806       28622\r\n       16571       15787       65072       23499       37984       20987       47754       45962       11230       37503\r\n       50282       17037       10648       15351       57562       32304       58149       30073       21625       37032\r\n        3267       49740        7442       13336        3994       14526        3660       38161       63338       53989\r\n       44911       65099       59826       53331       28893       61556        9058       22222       52841        8264\r\n       40650       23377       31565       25784        5521       31608       56561       11182       14561       19668\r\n       48934       49339       55823        3511       36912       35389       27639       26161       65521         139\r\n       64045        7212       53078       24579       35344       14487       26955       60278        4177       62331\r\n       25160       39127       12239       50790       50335        6287       62858       14814       27884       50220\r\n       17052       28219       16200       10832       15275        3943       49168       23658       26498       49237\r\n       57505       47888        3551       59783       38493       53707       64290       21270       26233        9100\r\n       52828       17116       39908       20919       30079       50559       15303        5477        7334       22893\r\n       30220        6213       50936       21612       56425       12825        6306       33598       27807        9918\r\n        5961       29554       33493       13384       43308       58662       25203       54582       40209       32553\r\n       36979       41947        1818       50280       23191       44846       32785       59284       64753       52995\r\n       12280        8653       64905        4585       22753       43047       37372       47421       14411       41475\r\n       34844       29676       32829       62261       16627       64905       64004       25100       23205       45115\r\n       23267       42742       21757       10368       62424        2208       32299       19530       17448       41914\r\n       20629       54198       11395       18772       19542       27803       26272       45332       19103       47796\r\n       47627       20190       41001       45031       10381       32111       65207       57701       12346       56350\r\n       33801       26369       37692        9250       23677       38240       17104       60591        1498       41088\r\n       51815       57948       49216       33560       48603        5457       43602        5324       29452       11835\r\n       13401       45913       10061       47272       46261       43263       63193       31632       15967       37572\r\n       44440       15851       23382       60872       45933        3427       43984        8405       56932       10719\r\n        3439       49796        9433       47979         408       36492       19606       16574       34643       59379\r\n       52505       19066       55745       49142       24533       46663       34807       57931       59908        5068\r\n       44470       18182       22142       26694       59080       31975          95       12863       63827       22186\r\n       61997         400       18035       15695       20863       40475       57919        7953       38366       38051\r\n        6000       24557         393       34134       39130       14010       26501       35631        7797       31145\r\n       59535       28634       52554       14357       19516       42313       19739       20618       60721       52777\r\n       33420       19942       32598       55206        8192       24945       62297       25037       38899       34785\r\n       40298       19061       35248       43445       25451        6796       30189       51874       57908       14897\r\n       20714       15893       57076       53492       53587       24740       18851       54996       27818       46496\r\n        5078       61386       47372       52027       64302       17226        5546       44579       39797        9740\r\n       55745       56373       43783       30743       56491       15812       38153       27323        4637       43130\r\n        9471       26032       11719       20285        5493       40823       10031       42132       60605       41548\r\n       24280       31419       36077       45061       22132       34270        4790       14030       42079       15027\r\n       40789       37027       62906       64674       15474       27081       38047       40453        6848       11942\r\n       65375       32087       39060       50458       20827       14273       18809       44249       45889       10902\r\n       33904       17682       52990       54367       64516       56266       23718       39388       25939        9804\r\n       64914       64863       64522       46273       35930       56427       47502       22695        5564       13287\r\n       14846       12037       58059       39015       49102       18608       56250       23881       14056       62584\r\n       26083       56469       14014       49340       55171       40330       22801       11238       16305        1042\r\n       45650        2138        2269       32553       10937       51084       63028       52124       14853       62751\r\n        4236       21755       29564       56697       59185       62576       62493       32287       46072        1683\r\n       48998       49069         904        4458        6889       60267       13502       23240       49424       63642\r\n       27551       42229       31045       63474       48830       25219       50347       50794       35866       19503\r\n       53170       11091       62337        6472       47800       10658       40339       15519       36273       34411\r\n       24877       62403       16315       35846       47020       52215       60222       55367       41325       56514\r\n       20910       35603       25324       26409        8744        7459       39487       53511       64582       58746\r\n       64621       16476       28274        7014       29215       10408       46015       55458       41568       12386\r\n       47066       37917       54452       47458       33343       23319       48737       24260       39351       43300\r\n       27078       59996       54044       40218       34766       55558       25238       25115       59584       61684\r\n        6463       58693       29687       51312       56342       38193       16482       56448       37410       63943\r\n       48140       31621       24940       37134       44415       38415        2409       30402       21982        7073\r\n       41766       29015       60677       53170       52811       60675       30941       37391       62727       11724\r\n        4839       20431       48551       37799       34815       37688       42275       45567       28830       48925\r\n        7897        3625       48341       61867       62645         653       18282       62974       39422        3241\r\n       64329       49400       62057       57111        4369       53043       33938       35803       47203        4671\r\n       32558        8647       33429       33266       35488       39898       16100       41718       44484       32055\r\n        1468       23325       51896       51696       18458       31451       19497       37414       13943       55698\r\n        3527       25943       29633       31000       31516       17592       42629       60759        5349       65342\r\n        9232       58033       55653       54316       44883       16914       58418       56607       17988         287\r\n       58554        1391       25587       21134       13648       31523       56433       11130       56853       35560\r\n       30527       55317       48390       63972       39856       14899       13756       11711       36658       56449\r\n       36756       18878       63991       18232       21376        3185       26155       15958       30449       59581\r\n       32404       16406       34294        4773       57727       11091       58188       49268       28200       55400\r\n        4442       32006       28174       49232        8742       16937       16811       13050       50723       57597\r\n       58828       47778       13576       54472        6711       12970       63360       64417       42855       48901\r\n       18911       13278       21194       60446       62856       39694       40577       46506       43104        7699\r\n       17632       14173        7265       21431       10020       53982       10836       11497       10552       33359\r\n       38941       63985       24589       52695        9996       53124       54145       56249       28336       11064\r\n       31187       38878       21620       35274       10194       52575       42971       59599       33101       54467\r\n       24137       19949       22420       30362        5870       46406       35812       63023       24597       60818\r\n       42966       63419       53550       53788       29781       56320       16471       37394       31481       11107\r\n       61485       58718       34844       62384       43836       51189        2631       36888       22440       57916\r\n       40660       12453       34152        4998       54480       13356       15294       11577       50931       25418\r\n       18536         117       50745       46443       51788       65099       23665       33664       25162       25072];\r\nrhat=[8149       10593         825        1418        8962        1559        3161         152\r\n        5086        9561       11949        5217        5798       11589        3150        5329\r\n        8984        3998        7095         390        2183        9925        6985       11431\r\n        3249        1053        7833        4160          13        1692        1976        8920\r\n        9291        9284        9074        2974        5068       10375          80        4023\r\n       11492        5804        6645        1044        7322          19        7192        7839\r\n        9217        4466       10449        3187        2137         119        9226        6202\r\n        7603        5162        8758       12104        7195        7646        6527        5506\r\n        6225       12166        3612        9329         470        7699        9996       11300\r\n       10722        1986        5330       10948         843        4540       11096        7298\r\n         446        7352        2390        5148        9522       11654        1156        8749\r\n        3736       11720       11276        6342        9275       11013         782        1253\r\n        3336        5994       12271       10025        4567        8321        1619        6205\r\n        2010        3243        4122        2079        9240         989       12020        7584\r\n        9610        6632        9036       11327       11665        9187        1417        4616\r\n        3768        1590       10149        3400        4707        5141        3973        5828\r\n        9623        3436         997        6446       10458        5845        8785        4056\r\n       10876        4226        7775        4853        8562        9793        8662        8391\r\n        6182        3663       10851        2565        5271        5953       11059         715\r\n        7529        4284        2244        8402       12053        7689         541        5153\r\n        8110        5951        6609         335        3517        6766        6683        3012\r\n        4955        3196        8713        6749         246        5847        2747        7607\r\n        8485        2656        4214         985        4827        2550       11484       11457\r\n        3124        1611        3563         382        1919        3058        8499        5773\r\n        1423        2757        1327       11084        6349         455        1929         417\r\n        9081       10604         613       10502        7325        8929        7125        8483\r\n        9465       10411        2134        3556         986         530        9950        1448\r\n       10951        8652        3309        7995        6767         315        3390         507\r\n       11937        8868       12228        5740        6625        1837         388       11209\r\n        3858         829        1248       12057        7320        3536        2756        5663\r\n       10974        3976        8957       11721        4338        9767       11429        8609\r\n        6564        1713        9831       10924         912        9766        6373        7233\r\n        3700        1269        4315        8607        4546        8196        9941        7644\r\n         878       11980       10491        2706        3912        9513        2567        8190\r\n         643         379        4709        9262       11112        1860        4737       11022\r\n        1323        3739        8110        8196       11511        2236        8007        9557\r\n       12024       10027       11760       11831        2394         500        6894         389\r\n        8560        4490         168        8370        1272        5988        6261        8753\r\n        4943        2775        2362        2464       10956       12172        2558        5757\r\n        1707        7697        6861        2490        6732        4772        9887        8195\r\n        4315        3792        1287         580        3928        6061        9571        1812\r\n         783        5756        2086        9790        5118        7639        6449        7058\r\n       11898        3862        2787       12173        4520        5695         212        1507\r\n        5346        9561         654        9830        5535        5850        4702        3448\r\n        5173        7945         740        8601        2757        3408        1153        7755\r\n        8707        6923        4891       11539        7076       10827       10657        1702\r\n       11981        8090        5301         856       10035        6307       10356       11679\r\n        9453        2222        1223        9948       10545        6152        6122        5565\r\n       10032         113        4049        4053        8376       11269       10270        1305\r\n        2126        1286        6659         881        3528        8590       10609        9754\r\n       11887        3876        1784        6936        1034        6381        1763       12219\r\n        5357        1336        7692        2667        7716        9060        8531        5530\r\n        5945       11985        2654        2560        6865        4738       11695         801\r\n        5824        6645        6710        6940        2131        2231        1940        4950\r\n         746        3214        6012        8276        8247        3992        9384        5457\r\n        7807        4112        9317        2273        1130       10350        8548        8193\r\n        3642        8624        8082        4908       10678        1835        7296         848\r\n       10867       11073        9696        2669        5746        1260        7347        4877\r\n       11495        5170         991       10986        8479        5253        2646       10197\r\n        5326        2942       11788        1621        2984         294       10203        9804\r\n        4494        2383         294        5111        1339       10478        8541        9356\r\n        2187         172        5127        8875        8915         789        2201        5140\r\n        5160       10441        4096        9010       10106       11593        6362        9775\r\n        4295       10907        1824        1894        5510        5337        9922        3371\r\n        8127        5345        4006        5209       10033        2859        4601        5742\r\n        3793        8908        6314        7883        8653       11031       10085        5403\r\n        3859        7385        4404        8611        5490        3923        8187         480\r\n        9766       12182         901        3569       10257        6668        3709        6931\r\n        2481        9841        9271        2472       11437         391       12053        4980\r\n       11992        3545       10994        9307       11791         322        3678        9815\r\n        1904        6151       10952        4868       10935        8320        9856        9570\r\n        6752         254        9868        7270        9019        3920        1414        1270\r\n       10364        4598       11037        3621        3234        9263       10271       11024\r\n        5000        1675        5510        7650         440        5417       10452        1974\r\n        5922        4450        6056        5245        1126        2867        2645        7398\r\n        1290        5398        5692        8986        3751        7506        2269         488\r\n        1909        5213        4327        8275        5794         534       11630       11908\r\n          53        6833        5782        5954        9629        5503        2239        5699\r\n       10980       10804        4193       10615         236        6096        2895        8953\r\n        5824       11122        7883        2053        6154        4548        5701        5575\r\n        1747        6519        6826        4063       11574        7423        9720        4636\r\n       11375        6605        1810       10176        6039         587       10520       10310\r\n        1100        3029        3862        8091       10427        4614       10870        2274\r\n        8785       11559        6971        4077         925        4907        5804        7863\r\n        3296       12221        8683        3445        3022        7680       11201        3591\r\n         773        3117        2404         968        4600        2668       10518         468\r\n         215        6056        7487       11731        2328        6050        2762        8744\r\n         677        1468        5443        8970        9622        8609         391        9362\r\n         850        9053        2676       10194        5487       10187        1917        5679\r\n        2586         415        8841        4002        8329        9123        1706        6923\r\n        4346        8013       11694        7230        4849        5346         958        9474\r\n        5828       10768        3592       11256       12214        6209        5772        4820\r\n        8719        3551        5014         187        8099        3338        9425        8455\r\n       11193        3088        2025        7193        3726        6393        4237       10983\r\n        7306        3335        9019        6401       11140        9163        2214        8141\r\n        2901        2598        7927        9127        3635        7468        2931        9271\r\n        6188          83        8923        5051         213        3750       10987       11744\r\n        3529         829        6394        6310        8428       11624         392       10014\r\n       10407        6190        4717       10647        8578        4959        8400        9476\r\n       11730        3977        3410       10130        8954        3171        6364        1588\r\n        9146        6763       11717        2289       12045         329        1489        4830\r\n        6135        7211         568       10450        9554        3037        5529           9\r\n        3995        1662       12272       11074        5671        1469        7367        4854\r\n        4549        8081        2025        3242        8687        5009        9142        2004\r\n       10161        2020        4083        1333        4743        5254         194        6885\r\n         226       11966        6259        3939        5004       11828        3961       10006\r\n        3966        8223        9013        2152        7274       11391         120        3271\r\n       12189        1703        2227        5125        5269        7245        8442        8137\r\n        4036        7892        8282        9848        5536        4409        7306        8365\r\n        4788       10993       10891        2650        5180        9379        5748        3115\r\n        1578       10933        4035        6497        8116        7574        4788        9184\r\n        7292        2637        2829        2197        6402        5607        8814        3297\r\n       12163        6864        3905        4982        6710        7802       10831        1012\r\n        8629        6883        3876        2358        3998        1465        7663        5577\r\n        1940        6499        1233       11847        8131        8283         577        8690\r\n        8536        1709       11555        7614        1606        7021        2479       10991\r\n        7673        6724        9074        5707        3131       11008       10835        5567\r\n        6706         321       12276        3407        4790       11852        3340        4209\r\n         887        6216         706        7716        9370        2905        8846         170\r\n        9563        7171        5219        7938        3769        7095          68        2976\r\n        3914        3867       11656         347        7395        8967        5517         894\r\n        2589        4130       10205        5493        3040        4057       10259        5751\r\n         248       10770        3157        1900        1428       11496        3608        7411\r\n       11099        5378        8023        1291       11427        1273       10747        9407\r\n        1600         586        9694        4493        2681        3073        2814        9289\r\n       11724       11813        7932        7385        3639        1582         135        5276\r\n        8990       10675       10619       10670        6193       10730        4885       10384\r\n        5511        2999        4965        9346         562        3131       11572        6417];\r\nassert(isequal(inverseNumberTheoreticTransform(rhat(:)',n,p),mod(r(:)',p)))\r\n%%\r\nn=256;\r\np=3329;\r\nr=[17789       14064       31398        7235        4452       54042       17029        9244       41506       19221       25101       62219       54529       40064       62923       42789\r\n       56877       51841       65136       14198       13625       50288       57544       47986       60999        3380       64958       16802       49403        3404       61808       25001\r\n       48595       42905       39615       53151        2595       65348       12338       45289       64079       33038       18797       64871       40754       37730        7385       19662\r\n       29351        1713       61925        9087       30759       14919       49754        2260        6133       50356       46280       22925       25827       55203       42486       22291\r\n       46506       51496       32141       57796        9836       60263        2076       32037       43367       18545       35075       13665       23545       32750       31509       60222\r\n       61887       60461       28701       60526       64966       42074       42096       63661       39503       14769       12662       43635        5823       28771        4359       29901\r\n       11410       32264       50636         835       27987        6902       37150        7369       31052       21711       45182       63789       22392        9768       58836       28999\r\n       16029       54657       48763       24717       62611       17574       24668       48707       23347       29704        3306       40809       35957        1853       32586       29765\r\n       42003        8608       29026       10997       47464       50059       13929       41847       31167       48325       12087        4164       30182       49589       50548       61950\r\n       52993       49793        3473       35404       38069       52789       51914       38940       43976       33415        2992       24478       42300       52173        3955       14360\r\n       55926       60669        5755        6662       35406        6832        9531       32677       62891       25068       58002       10895       33654       19238       17200       57829\r\n       26091       54572       52296        2573       46231       30786       32056       37214        5838       59341       55036       15157       53374        7550       42668        1302\r\n        7569       17000       42964       61160         329       14356         841       27951       52280       63259        7743        3421        6368       24582        8755       22397\r\n        5261       13960        2119       63674       51282       60470       12229        4996       38717       41174       26896       59097       30389       54322       41847       50202\r\n       23623       34230       36507       23653       60742       20992       31800       19043       59781        8652        7879       51989       38654       55166       25227       22465\r\n       54323       26041       47172       42218         543       56199       54933       36787        6627       40521       37492       24445       12266       43597       50180       40554];\r\nrhat=[1004        2562          12        2074         386         769        3081         923         234         324        3276        3310        1457        2786        1538        1203\r\n        2725         438        1145         992        1049        2056          79        1027        2483        2538           4        2926        2235        1721        1323        1176\r\n         545         183        3074         501        2640         855        1161        2419        1203         813        3106        2589        2852        1456        1682        1723\r\n          69         623        2891         274         813        1126        3161         654        3073         693        2162        3089        2845         612        3031         293\r\n         592        1068        1284         749         404        1253         426        1999        2639        2516        1092        2077         453        1649        2336        3163\r\n        2039         495          51        1711        1959        1829         200        3273        2348         141        1326         760        3201         400        2955        3279\r\n        1452        1853        1912         973         666        1696        2042         965        1095         210        3132         160         766         740        1804        2075\r\n        2315        2977        2197        3084        1811         340         140        1425        1279        3194         758        2224        2692        1839        2400        1477\r\n        2429        1148        2851        2684        3141        1255        2870        3295        2652         899         716        1549         406         517        1155        2856\r\n        3116        1361        1678        2120        1646         915        1518        1631        1685        2535        2169        1417        1796         828        1899         911\r\n         309         738         754        2490        1194        2757        1105        1086        1929        1892        1032        1186        1805        1880        2454         621\r\n        1514        1448        2271        2505         856          47        1949        2456        1700        1041         112        2844        2723        1705         981         781\r\n        3026        1470         145        2240         171        2116        3322        2831        2726        1800        1228         873        2341        2557         246         887\r\n        1275        2019        1990        1422        1937         820         605         925        2552          93        1790        1408        1989        2718        2353        3141\r\n        1249         376         831        1305        2941        1750        2254        2190        2703         774        1527        1776        1829        2916         661        2171\r\n        1503        1689        2004         368         643        2582        2079        2419         999        2909        3317         764        1712        2256        2638        3065];\r\nassert(isequal(inverseNumberTheoreticTransform(rhat(:)',n,p),mod(r(:)',p)))\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":2,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-13T21:01:55.000Z","updated_at":"2025-10-13T13:56:38.000Z","published_at":"2020-10-13T21:04:34.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 an input polynomial (rhat) of length n that has been Number Theoretic Transformed (NTT) modulo p, a prime number using it's primitive nth root of unity as the generator for the inverse tweedle factors, convert the polynominal coefficents by Inverse Number Theoretic Transform (iNTT) mod p back into the original polynomial coefficents.\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":46696,"title":"Number Theoretic Transform (NTT)","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: 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 an input polynomial (r) of length \u0026lt;=n and a prime number (p) such that an nth root of unity exists and the modular inverse of (n) modulus p exists. Convert the polynominal coefficents by Number Theoretic Transform (NTT) using the primitive nth root of unity as the generator mod p.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function rhat = numberTheoreticTransform(r,n,p)\r\n  rhat=r;\r\nend","test_suite":"%%\r\nn=210;\r\np=5881;\r\nr=[8669,57047,39514,17386,56675,3808,29999,47330,22216,26294,34536,58604,51010,4546,18270,24862,...\r\n    56667,27522,15720,39167,31418,58887,61257,53601,46459,48707,58963,4275,22014,284,54270,33255,...\r\n    23996,14853,35050,18971,4480,5568,4478,26857,8085,29033,58912,23176,7875,37297,57346,22844,...\r\n    2747,9328,5019,48531,29918,43794,45825,37444,41202,57525,43407,57371,30639,9262,4465,46808,...\r\n    20184,43985,42757,34802,46865,33083,31981,32626,61340,25511,7677,15756,44886,55001,63579,14101,...\r\n    49829,38279,26407,33426,32482,42688,48739,19788,5872,54130,25531,50810,11755,7167,59320,57432,...\r\n    65522,56639,2416,35696,65379,33489,57246,4602,64719,60470,36979,28276,22140,47233,894,24514,...\r\n    60469,35814,31056,32541,20248,62314,64355,33656,65050,29874,27921,13973,12664,54575,47620,34717,...\r\n    54334,33546,36173,13977,38523,9356,3422,44781,39882,14395,26625,41281,36392,8361,11088,65,...\r\n    27404,32013,10477,43701,1174,7843,62398,63953,2026,32367,56539,15917,54674,53319,41220,146,...\r\n    24885,59271,44587,24826,41415,15942,37448,64338,55684,18575,44725,23470,64679,5504,16404,53172,...\r\n    5532,34816,52469,48419,9284,28697,22962,31358,38496,9555,59331,41955,10678,37087,61054,51321,...\r\n    44937,30554,17060,37307,16303,20925,59690,58013];\r\nrhat=[4391        3275        5259        1238        4797        2486         919        3786        5067        4389\r\n        2255        3368         968        3027        4274        3358        2953        3646        2967        4281\r\n        5348         229        5498        5448        3419        3720         100        5376        2968        3437\r\n         404        3686        3576        4743        4840        4942        4237        1414         102        2806\r\n        3832        5075        5084        1139        2483        2021        5541        1332        5022        5155\r\n        5235        4306         797        2739         911        3669        4133         547        5678        5162\r\n        1905        4772        2478        1657        1905        2539        4053        3185        3567         113\r\n        1985         674        1359         182        1645        1249        1752         922        1178        5427\r\n        2476        1241        2496        1703        3691        5044         802         304         905        2280\r\n        2211        4163        4845         690        4246        3016        3159        1555        3762        1416\r\n         105        4332        2706         308        2230        2117         787        1189        5549          72\r\n        4092        4428        4103        3397        5700        5630        1803         840        4153        4385\r\n        5537        1564        5437        5553         377        3468        2885        4827        3523        2618\r\n        2238        3633        2254        4028        3660        1909        5874        1850        3153        2253\r\n           3        2286        1953          81        5161        5764        5063        2887        4983        3481\r\n        5044         770        1225        4832        1673        5556        2434          21        1735        5422\r\n        1003        2672        3262         982        2344         269        2638        3485        3278        4882\r\n        4604        5118        4587        2136        3361         478        5289         808        3170        3752\r\n        2862        4604        4813        3077        5849         813        1214         135        3691        4774\r\n        1668        4361        5564        3949        5019          71        2441        4481         722        5462\r\n        4925        2693          41        3294        3971         361        1224         445        5386         186];\r\nassert(isequal(numberTheoreticTransform(r,n,p),rhat(:)'))\r\n%%\r\nn=1024\r\np=12289;\r\nr=[52074       13446       46646        7881       15396       46708        6135       41514       35944       46632\r\n       60673       28779       56867       40989       26142       30972       42638       64624       10831       31518\r\n       11720        1785        7753       22717       17571       46438       14101       13576       32367       47787\r\n       33917       57421        2557       21929       54559       62787       15982       49616       35069       61443\r\n       41091       39983       39203       37658       65232       33146       22261       58086       13029       33898\r\n       59846       13342       39604       56619       42582       19991       12967       30948       40839       59183\r\n       43513       34073       33844       13013       46134       51761       33215       10414        1724       14299\r\n       25506        3527         492       44069       61099       15491       62308       53144       20892       57227\r\n       48497       56504       45149       59102       45065       15355       25860       31228       34930        5419\r\n       53584       29028       61998       13051       37247       30454       38303        7621       21415       30500\r\n       39344       35914       57248       19548       24959       40592       39750       57391       39465        1437\r\n        5570       37149        7423       32539       41587       40326       46834       41627       23719       52971\r\n       60447       44590       23237       58320       23804        8036       26315        6375        8842       11744\r\n        3512       24338       15855       32860       26713        8112       56275       59535       59887       10839\r\n       34539        5126       36722       18153       24163       18642       60324        2294       41979       11901\r\n        7789       29907       40155       34993       30696       48216       49206        2605       43173       45313\r\n       24913        3135       19713       37634       32991       26955       18716       64786       44258       14009\r\n       53269       48382       52307       27053       59672       54328       52220       44969       48795       19536\r\n       15997        2490       52143         967       13528       61283        9356       24686       55192       50353\r\n       57961       62537       51189       46056       22190       26153       33066       33051       33859       32843\r\n       46704       48652       23009       33210       37625        3421       40022       50036        9952       59602\r\n       24782       61436        3558       24986       31911       37433       46124        3203       24947        3791\r\n       16313       33643       46445        4255       17184       48999       25122       47574       53806       28622\r\n       16571       15787       65072       23499       37984       20987       47754       45962       11230       37503\r\n       50282       17037       10648       15351       57562       32304       58149       30073       21625       37032\r\n        3267       49740        7442       13336        3994       14526        3660       38161       63338       53989\r\n       44911       65099       59826       53331       28893       61556        9058       22222       52841        8264\r\n       40650       23377       31565       25784        5521       31608       56561       11182       14561       19668\r\n       48934       49339       55823        3511       36912       35389       27639       26161       65521         139\r\n       64045        7212       53078       24579       35344       14487       26955       60278        4177       62331\r\n       25160       39127       12239       50790       50335        6287       62858       14814       27884       50220\r\n       17052       28219       16200       10832       15275        3943       49168       23658       26498       49237\r\n       57505       47888        3551       59783       38493       53707       64290       21270       26233        9100\r\n       52828       17116       39908       20919       30079       50559       15303        5477        7334       22893\r\n       30220        6213       50936       21612       56425       12825        6306       33598       27807        9918\r\n        5961       29554       33493       13384       43308       58662       25203       54582       40209       32553\r\n       36979       41947        1818       50280       23191       44846       32785       59284       64753       52995\r\n       12280        8653       64905        4585       22753       43047       37372       47421       14411       41475\r\n       34844       29676       32829       62261       16627       64905       64004       25100       23205       45115\r\n       23267       42742       21757       10368       62424        2208       32299       19530       17448       41914\r\n       20629       54198       11395       18772       19542       27803       26272       45332       19103       47796\r\n       47627       20190       41001       45031       10381       32111       65207       57701       12346       56350\r\n       33801       26369       37692        9250       23677       38240       17104       60591        1498       41088\r\n       51815       57948       49216       33560       48603        5457       43602        5324       29452       11835\r\n       13401       45913       10061       47272       46261       43263       63193       31632       15967       37572\r\n       44440       15851       23382       60872       45933        3427       43984        8405       56932       10719\r\n        3439       49796        9433       47979         408       36492       19606       16574       34643       59379\r\n       52505       19066       55745       49142       24533       46663       34807       57931       59908        5068\r\n       44470       18182       22142       26694       59080       31975          95       12863       63827       22186\r\n       61997         400       18035       15695       20863       40475       57919        7953       38366       38051\r\n        6000       24557         393       34134       39130       14010       26501       35631        7797       31145\r\n       59535       28634       52554       14357       19516       42313       19739       20618       60721       52777\r\n       33420       19942       32598       55206        8192       24945       62297       25037       38899       34785\r\n       40298       19061       35248       43445       25451        6796       30189       51874       57908       14897\r\n       20714       15893       57076       53492       53587       24740       18851       54996       27818       46496\r\n        5078       61386       47372       52027       64302       17226        5546       44579       39797        9740\r\n       55745       56373       43783       30743       56491       15812       38153       27323        4637       43130\r\n        9471       26032       11719       20285        5493       40823       10031       42132       60605       41548\r\n       24280       31419       36077       45061       22132       34270        4790       14030       42079       15027\r\n       40789       37027       62906       64674       15474       27081       38047       40453        6848       11942\r\n       65375       32087       39060       50458       20827       14273       18809       44249       45889       10902\r\n       33904       17682       52990       54367       64516       56266       23718       39388       25939        9804\r\n       64914       64863       64522       46273       35930       56427       47502       22695        5564       13287\r\n       14846       12037       58059       39015       49102       18608       56250       23881       14056       62584\r\n       26083       56469       14014       49340       55171       40330       22801       11238       16305        1042\r\n       45650        2138        2269       32553       10937       51084       63028       52124       14853       62751\r\n        4236       21755       29564       56697       59185       62576       62493       32287       46072        1683\r\n       48998       49069         904        4458        6889       60267       13502       23240       49424       63642\r\n       27551       42229       31045       63474       48830       25219       50347       50794       35866       19503\r\n       53170       11091       62337        6472       47800       10658       40339       15519       36273       34411\r\n       24877       62403       16315       35846       47020       52215       60222       55367       41325       56514\r\n       20910       35603       25324       26409        8744        7459       39487       53511       64582       58746\r\n       64621       16476       28274        7014       29215       10408       46015       55458       41568       12386\r\n       47066       37917       54452       47458       33343       23319       48737       24260       39351       43300\r\n       27078       59996       54044       40218       34766       55558       25238       25115       59584       61684\r\n        6463       58693       29687       51312       56342       38193       16482       56448       37410       63943\r\n       48140       31621       24940       37134       44415       38415        2409       30402       21982        7073\r\n       41766       29015       60677       53170       52811       60675       30941       37391       62727       11724\r\n        4839       20431       48551       37799       34815       37688       42275       45567       28830       48925\r\n        7897        3625       48341       61867       62645         653       18282       62974       39422        3241\r\n       64329       49400       62057       57111        4369       53043       33938       35803       47203        4671\r\n       32558        8647       33429       33266       35488       39898       16100       41718       44484       32055\r\n        1468       23325       51896       51696       18458       31451       19497       37414       13943       55698\r\n        3527       25943       29633       31000       31516       17592       42629       60759        5349       65342\r\n        9232       58033       55653       54316       44883       16914       58418       56607       17988         287\r\n       58554        1391       25587       21134       13648       31523       56433       11130       56853       35560\r\n       30527       55317       48390       63972       39856       14899       13756       11711       36658       56449\r\n       36756       18878       63991       18232       21376        3185       26155       15958       30449       59581\r\n       32404       16406       34294        4773       57727       11091       58188       49268       28200       55400\r\n        4442       32006       28174       49232        8742       16937       16811       13050       50723       57597\r\n       58828       47778       13576       54472        6711       12970       63360       64417       42855       48901\r\n       18911       13278       21194       60446       62856       39694       40577       46506       43104        7699\r\n       17632       14173        7265       21431       10020       53982       10836       11497       10552       33359\r\n       38941       63985       24589       52695        9996       53124       54145       56249       28336       11064\r\n       31187       38878       21620       35274       10194       52575       42971       59599       33101       54467\r\n       24137       19949       22420       30362        5870       46406       35812       63023       24597       60818\r\n       42966       63419       53550       53788       29781       56320       16471       37394       31481       11107\r\n       61485       58718       34844       62384       43836       51189        2631       36888       22440       57916\r\n       40660       12453       34152        4998       54480       13356       15294       11577       50931       25418\r\n       18536         117       50745       46443       51788       65099       23665       33664       25162       25072];\r\nrhat=[8149       10593         825        1418        8962        1559        3161         152\r\n        5086        9561       11949        5217        5798       11589        3150        5329\r\n        8984        3998        7095         390        2183        9925        6985       11431\r\n        3249        1053        7833        4160          13        1692        1976        8920\r\n        9291        9284        9074        2974        5068       10375          80        4023\r\n       11492        5804        6645        1044        7322          19        7192        7839\r\n        9217        4466       10449        3187        2137         119        9226        6202\r\n        7603        5162        8758       12104        7195        7646        6527        5506\r\n        6225       12166        3612        9329         470        7699        9996       11300\r\n       10722        1986        5330       10948         843        4540       11096        7298\r\n         446        7352        2390        5148        9522       11654        1156        8749\r\n        3736       11720       11276        6342        9275       11013         782        1253\r\n        3336        5994       12271       10025        4567        8321        1619        6205\r\n        2010        3243        4122        2079        9240         989       12020        7584\r\n        9610        6632        9036       11327       11665        9187        1417        4616\r\n        3768        1590       10149        3400        4707        5141        3973        5828\r\n        9623        3436         997        6446       10458        5845        8785        4056\r\n       10876        4226        7775        4853        8562        9793        8662        8391\r\n        6182        3663       10851        2565        5271        5953       11059         715\r\n        7529        4284        2244        8402       12053        7689         541        5153\r\n        8110        5951        6609         335        3517        6766        6683        3012\r\n        4955        3196        8713        6749         246        5847        2747        7607\r\n        8485        2656        4214         985        4827        2550       11484       11457\r\n        3124        1611        3563         382        1919        3058        8499        5773\r\n        1423        2757        1327       11084        6349         455        1929         417\r\n        9081       10604         613       10502        7325        8929        7125        8483\r\n        9465       10411        2134        3556         986         530        9950        1448\r\n       10951        8652        3309        7995        6767         315        3390         507\r\n       11937        8868       12228        5740        6625        1837         388       11209\r\n        3858         829        1248       12057        7320        3536        2756        5663\r\n       10974        3976        8957       11721        4338        9767       11429        8609\r\n        6564        1713        9831       10924         912        9766        6373        7233\r\n        3700        1269        4315        8607        4546        8196        9941        7644\r\n         878       11980       10491        2706        3912        9513        2567        8190\r\n         643         379        4709        9262       11112        1860        4737       11022\r\n        1323        3739        8110        8196       11511        2236        8007        9557\r\n       12024       10027       11760       11831        2394         500        6894         389\r\n        8560        4490         168        8370        1272        5988        6261        8753\r\n        4943        2775        2362        2464       10956       12172        2558        5757\r\n        1707        7697        6861        2490        6732        4772        9887        8195\r\n        4315        3792        1287         580        3928        6061        9571        1812\r\n         783        5756        2086        9790        5118        7639        6449        7058\r\n       11898        3862        2787       12173        4520        5695         212        1507\r\n        5346        9561         654        9830        5535        5850        4702        3448\r\n        5173        7945         740        8601        2757        3408        1153        7755\r\n        8707        6923        4891       11539        7076       10827       10657        1702\r\n       11981        8090        5301         856       10035        6307       10356       11679\r\n        9453        2222        1223        9948       10545        6152        6122        5565\r\n       10032         113        4049        4053        8376       11269       10270        1305\r\n        2126        1286        6659         881        3528        8590       10609        9754\r\n       11887        3876        1784        6936        1034        6381        1763       12219\r\n        5357        1336        7692        2667        7716        9060        8531        5530\r\n        5945       11985        2654        2560        6865        4738       11695         801\r\n        5824        6645        6710        6940        2131        2231        1940        4950\r\n         746        3214        6012        8276        8247        3992        9384        5457\r\n        7807        4112        9317        2273        1130       10350        8548        8193\r\n        3642        8624        8082        4908       10678        1835        7296         848\r\n       10867       11073        9696        2669        5746        1260        7347        4877\r\n       11495        5170         991       10986        8479        5253        2646       10197\r\n        5326        2942       11788        1621        2984         294       10203        9804\r\n        4494        2383         294        5111        1339       10478        8541        9356\r\n        2187         172        5127        8875        8915         789        2201        5140\r\n        5160       10441        4096        9010       10106       11593        6362        9775\r\n        4295       10907        1824        1894        5510        5337        9922        3371\r\n        8127        5345        4006        5209       10033        2859        4601        5742\r\n        3793        8908        6314        7883        8653       11031       10085        5403\r\n        3859        7385        4404        8611        5490        3923        8187         480\r\n        9766       12182         901        3569       10257        6668        3709        6931\r\n        2481        9841        9271        2472       11437         391       12053        4980\r\n       11992        3545       10994        9307       11791         322        3678        9815\r\n        1904        6151       10952        4868       10935        8320        9856        9570\r\n        6752         254        9868        7270        9019        3920        1414        1270\r\n       10364        4598       11037        3621        3234        9263       10271       11024\r\n        5000        1675        5510        7650         440        5417       10452        1974\r\n        5922        4450        6056        5245        1126        2867        2645        7398\r\n        1290        5398        5692        8986        3751        7506        2269         488\r\n        1909        5213        4327        8275        5794         534       11630       11908\r\n          53        6833        5782        5954        9629        5503        2239        5699\r\n       10980       10804        4193       10615         236        6096        2895        8953\r\n        5824       11122        7883        2053        6154        4548        5701        5575\r\n        1747        6519        6826        4063       11574        7423        9720        4636\r\n       11375        6605        1810       10176        6039         587       10520       10310\r\n        1100        3029        3862        8091       10427        4614       10870        2274\r\n        8785       11559        6971        4077         925        4907        5804        7863\r\n        3296       12221        8683        3445        3022        7680       11201        3591\r\n         773        3117        2404         968        4600        2668       10518         468\r\n         215        6056        7487       11731        2328        6050        2762        8744\r\n         677        1468        5443        8970        9622        8609         391        9362\r\n         850        9053        2676       10194        5487       10187        1917        5679\r\n        2586         415        8841        4002        8329        9123        1706        6923\r\n        4346        8013       11694        7230        4849        5346         958        9474\r\n        5828       10768        3592       11256       12214        6209        5772        4820\r\n        8719        3551        5014         187        8099        3338        9425        8455\r\n       11193        3088        2025        7193        3726        6393        4237       10983\r\n        7306        3335        9019        6401       11140        9163        2214        8141\r\n        2901        2598        7927        9127        3635        7468        2931        9271\r\n        6188          83        8923        5051         213        3750       10987       11744\r\n        3529         829        6394        6310        8428       11624         392       10014\r\n       10407        6190        4717       10647        8578        4959        8400        9476\r\n       11730        3977        3410       10130        8954        3171        6364        1588\r\n        9146        6763       11717        2289       12045         329        1489        4830\r\n        6135        7211         568       10450        9554        3037        5529           9\r\n        3995        1662       12272       11074        5671        1469        7367        4854\r\n        4549        8081        2025        3242        8687        5009        9142        2004\r\n       10161        2020        4083        1333        4743        5254         194        6885\r\n         226       11966        6259        3939        5004       11828        3961       10006\r\n        3966        8223        9013        2152        7274       11391         120        3271\r\n       12189        1703        2227        5125        5269        7245        8442        8137\r\n        4036        7892        8282        9848        5536        4409        7306        8365\r\n        4788       10993       10891        2650        5180        9379        5748        3115\r\n        1578       10933        4035        6497        8116        7574        4788        9184\r\n        7292        2637        2829        2197        6402        5607        8814        3297\r\n       12163        6864        3905        4982        6710        7802       10831        1012\r\n        8629        6883        3876        2358        3998        1465        7663        5577\r\n        1940        6499        1233       11847        8131        8283         577        8690\r\n        8536        1709       11555        7614        1606        7021        2479       10991\r\n        7673        6724        9074        5707        3131       11008       10835        5567\r\n        6706         321       12276        3407        4790       11852        3340        4209\r\n         887        6216         706        7716        9370        2905        8846         170\r\n        9563        7171        5219        7938        3769        7095          68        2976\r\n        3914        3867       11656         347        7395        8967        5517         894\r\n        2589        4130       10205        5493        3040        4057       10259        5751\r\n         248       10770        3157        1900        1428       11496        3608        7411\r\n       11099        5378        8023        1291       11427        1273       10747        9407\r\n        1600         586        9694        4493        2681        3073        2814        9289\r\n       11724       11813        7932        7385        3639        1582         135        5276\r\n        8990       10675       10619       10670        6193       10730        4885       10384\r\n        5511        2999        4965        9346         562        3131       11572        6417];\r\nassert(isequal(numberTheoreticTransform(r(:)',n,p),rhat(:)'))\r\n%%\r\nn=256;\r\np=3329;\r\nr=[17789       14064       31398        7235        4452       54042       17029        9244       41506       19221       25101       62219       54529       40064       62923       42789\r\n       56877       51841       65136       14198       13625       50288       57544       47986       60999        3380       64958       16802       49403        3404       61808       25001\r\n       48595       42905       39615       53151        2595       65348       12338       45289       64079       33038       18797       64871       40754       37730        7385       19662\r\n       29351        1713       61925        9087       30759       14919       49754        2260        6133       50356       46280       22925       25827       55203       42486       22291\r\n       46506       51496       32141       57796        9836       60263        2076       32037       43367       18545       35075       13665       23545       32750       31509       60222\r\n       61887       60461       28701       60526       64966       42074       42096       63661       39503       14769       12662       43635        5823       28771        4359       29901\r\n       11410       32264       50636         835       27987        6902       37150        7369       31052       21711       45182       63789       22392        9768       58836       28999\r\n       16029       54657       48763       24717       62611       17574       24668       48707       23347       29704        3306       40809       35957        1853       32586       29765\r\n       42003        8608       29026       10997       47464       50059       13929       41847       31167       48325       12087        4164       30182       49589       50548       61950\r\n       52993       49793        3473       35404       38069       52789       51914       38940       43976       33415        2992       24478       42300       52173        3955       14360\r\n       55926       60669        5755        6662       35406        6832        9531       32677       62891       25068       58002       10895       33654       19238       17200       57829\r\n       26091       54572       52296        2573       46231       30786       32056       37214        5838       59341       55036       15157       53374        7550       42668        1302\r\n        7569       17000       42964       61160         329       14356         841       27951       52280       63259        7743        3421        6368       24582        8755       22397\r\n        5261       13960        2119       63674       51282       60470       12229        4996       38717       41174       26896       59097       30389       54322       41847       50202\r\n       23623       34230       36507       23653       60742       20992       31800       19043       59781        8652        7879       51989       38654       55166       25227       22465\r\n       54323       26041       47172       42218         543       56199       54933       36787        6627       40521       37492       24445       12266       43597       50180       40554];\r\nrhat=[1004        2562          12        2074         386         769        3081         923         234         324        3276        3310        1457        2786        1538        1203\r\n        2725         438        1145         992        1049        2056          79        1027        2483        2538           4        2926        2235        1721        1323        1176\r\n         545         183        3074         501        2640         855        1161        2419        1203         813        3106        2589        2852        1456        1682        1723\r\n          69         623        2891         274         813        1126        3161         654        3073         693        2162        3089        2845         612        3031         293\r\n         592        1068        1284         749         404        1253         426        1999        2639        2516        1092        2077         453        1649        2336        3163\r\n        2039         495          51        1711        1959        1829         200        3273        2348         141        1326         760        3201         400        2955        3279\r\n        1452        1853        1912         973         666        1696        2042         965        1095         210        3132         160         766         740        1804        2075\r\n        2315        2977        2197        3084        1811         340         140        1425        1279        3194         758        2224        2692        1839        2400        1477\r\n        2429        1148        2851        2684        3141        1255        2870        3295        2652         899         716        1549         406         517        1155        2856\r\n        3116        1361        1678        2120        1646         915        1518        1631        1685        2535        2169        1417        1796         828        1899         911\r\n         309         738         754        2490        1194        2757        1105        1086        1929        1892        1032        1186        1805        1880        2454         621\r\n        1514        1448        2271        2505         856          47        1949        2456        1700        1041         112        2844        2723        1705         981         781\r\n        3026        1470         145        2240         171        2116        3322        2831        2726        1800        1228         873        2341        2557         246         887\r\n        1275        2019        1990        1422        1937         820         605         925        2552          93        1790        1408        1989        2718        2353        3141\r\n        1249         376         831        1305        2941        1750        2254        2190        2703         774        1527        1776        1829        2916         661        2171\r\n        1503        1689        2004         368         643        2582        2079        2419         999        2909        3317         764        1712        2256        2638        3065];\r\nassert(isequal(numberTheoreticTransform(r(:)',n,p),rhat(:)'))\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":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-06T20:08:10.000Z","updated_at":"2025-10-13T12:54:40.000Z","published_at":"2020-10-06T20:17:36.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 an input polynomial (r) of length \u0026lt;=n and a prime number (p) such that an nth root of unity exists and the modular inverse of (n) modulus p exists. Convert the polynominal coefficents by Number Theoretic Transform (NTT) using the primitive nth root of unity as the generator mod p.\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":46636,"title":"Montgomery Multiplication","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: 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=\"\"\u003eMultiply all elements of an input matrix (A) modulo N, given all elements are less than R (2^number of bits). Where gcd(R,N)=1 and N\u0026lt;R. Output the final result, P (in normal form) and all intermediate products (p) in Montgomery form \u003c/span\u003e\u003cspan style=\"border-block-end-style: solid; border-block-end-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; \"\u003e(\u003c/span\u003e\u003cspan style=\"\"\u003efirst product is just first element of matrix (A)*R modulo N\u003c/span\u003e\u003cspan style=\"border-block-end-style: solid; border-block-end-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; \"\u003e)\u003c/span\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [P,p] = montgomeryMult(a,R,N)\r\n  P=N-1;\r\n  p=mod(a,N);\r\nend","test_suite":"%%\r\nR=2^16;\r\nN=3329;\r\nY=2050;\r\ny =[    1263         470        2922         960         982         369        2562        2142        1318         744];\r\na =[    1112       36822       19271       42840       48879       33433       48232       54170        3299       62565\r\n        7920       12071       15556       62713       53288       59399       52080       25560       14987       28219\r\n       56538       39138       34791       61324       25120       41217       35710       32630       54669       63016\r\n       31738       19656        5996       30008       40454        6654       44972       45534        1025       49965\r\n       55368        8789       26562       15759       37715       25615       58565       54681       56604         481\r\n       13723       13933        6871       50062       34737        3579        3590       39952        5116       44567\r\n       36194       58650        7358       49763       18026       32852       19900       37665       43846       46265\r\n       41280        4682       51408       48539       16294       28293        3027       21367       32781       42279\r\n        2096       15891       19108       48738       29598       65376       12810       29912       14286       36196\r\n       40285        3522       39553        6941       14923       53189       47196       46779       37461       14293\r\n       23750       28948       63204       44666       52720       31827       47300       57960        8007       50617\r\n        3246         870       28343       30360       64625       58618       57527       47241       43985       14944\r\n       32084       58798       45531       13904        1965        9014       38170        1219       39294       24304\r\n       12616       12888       49682        6456       35105       25559        4632       44222        3668       58387\r\n        8066        6119       28353       53973        5706       60775       60472       28738        3692       56123\r\n       13467       20143       42958       11469       52565       60128       52453       28692        9994       26373\r\n        9602       29888        7192       10719       64824       46764       18739        7670        1285       20841\r\n       12391        6663       61194       43646        4387       40523       35629       53390       28519       39887\r\n        2795       65233       12285       58614       61564       22497       64538       21289       54540       59650\r\n       41628       21764       17444       33853        1191       61343       46902       16136       40461       59578\r\n       18472       19486       52286       46052       44816        8177       54982       22460       34087       38770\r\n       35297        4066       31955       10065       51362       47879       28394       24621       56614       21795\r\n       45558       19545       50394       62485       35005       42367       30842       35818        6402       55906\r\n       32710        3037       25952       35447       58022       54601       36746       36825       59510       28992\r\n       35114       33123       17887       44547       58917       26101       17635       25940        7078       59267\r\n       29175       49900        2440        2396       41021       49140       49087       26091       33881        2174\r\n        8122       41357       44125       53031        9035       54737       33022       33775        9381       34893\r\n       32136        5891       28151       49061       14273       21132       42389       43091       36658       46956\r\n       55902        5299       29605        7876       11936       36193       20168       62319         300       11750\r\n       57273       50937       39967       34409        2740       64168        9091       47339       50245       22055\r\n       17714       59318        3893       21353        7008       35999       31167       26219       55621       12301\r\n       13661       34981       20697       35812       40399       21654       23754       54517       60084       21097\r\n       37026        7153       50641       26141       61581       40597       51649        8803       64681       26467\r\n       41963       54120       45641       27203       23229       23634       51137        3962       33104       35950\r\n       27330       22157        8213       11844       26910       49578       43811        5521       17787        3194\r\n       13498       19265        8529       16737       64510       27125        8749       10741        6602       36223\r\n       62123       48910        6052        1345       61969       32266        1412       21248       33282       18010\r\n        5378         677         512       60534       44344       45530       36689       19773       38378       15827\r\n        6927        3175       27728       42840       64769       63749       19714         765       49996       15934\r\n        9308       43772       42963       61119       50255       21479       61565       35383        5437       10102\r\n       10909       39548       47377       10715       22065       54906       64284        6250       43358       62679\r\n       40695       34478       34813       60365       43409       48435       18783        9601       33880       61319\r\n       37598       47822        7131       52078       16001       62532       52482       41362       11209       53655\r\n        3412       46350       41403       37840       19366        2092       58727       56316       61509       47727\r\n       61027       51208        8290       28838       44576       23387       39159       63846       38697       11521\r\n       47753       18872        8801       16882       34592       43427       57934       37410       28877       23617\r\n       48355       45385        6461       49279       26974       18448       61848       65329       61729       12372\r\n        4155       36481        9307       14986       39494       15098       35989       36276       42985          78\r\n       56389       25986       11026        4206       49186       46604       47735       33781       29618       20736\r\n       61237        4036       12861       50287       38242       40932       37798       21671       55030       45850\r\n       64513       51129       20806       43987       36162       38706        1694       28180       34906       40976\r\n       56291       22123       20737       46872       38244       43282       29263       32231       36299       35590\r\n       51482       39837       14258       42078       33542        3116       42356        4655       44568       28772\r\n       33644       48578       16452       27462        5412       22857       34157       58178       24064       18836\r\n       11639        6869       58518       25608       47157       29579       24399        4235       15682       32876\r\n       26121        8381       46086       53486       65284       15787       61416       28585       37940       49908\r\n        8777       36014       36420       20802       23234       46861       54364       54173       56812       49965\r\n        2024       31799       12087       53381       63652       56110       55645       25856       26658       37752\r\n       61547       58358       13895       51712       22704       18448       24414       40204        7380       48998\r\n       19746       52360        5069       55853       58100       47910       38874       53650       29087       42305\r\n       19368       48125       59886       33137       29798        9028       57183       58080       19672        8075\r\n       21819        3364       46315       41658       27094       54835       61177       61021       26305       33056\r\n       30609        4776       36555       62317       14269        9083       43808       12503       54615       22758\r\n       42480        5801       20540       29095        8234       38548       13551       16946       26452        6038\r\n        1653       52320       10892        3933       20245       23996       42850       58842       25570        9689\r\n       55194       61800       40795       56803       47585       52871        4721       38886       23622       12987\r\n       36636       44807       64745       41365       51306       33015       26655       33019        9191       44057\r\n       55974        8656       11169       23270       45468       32086       43708       40161       17047       28279\r\n       22798       47364       16894       65339         642       57478       61192       53701        5689       45508\r\n       29230        7232       26004       14691       55260       23143       53146       34857       28140       16828\r\n        3554        7700        4849       42759       60445       29454       31755       13243       16861         639\r\n       11606       41990       44832       39648       50525       63145       49594       29746       19500       34883\r\n       43437       21549       26370       25378        2795        2772       27331       28043       27843       18310\r\n       21681       42848       64411        9318       24784       63763       63686       63311        7812       62012\r\n       58883       49095       26357        1647       46159       12399       64747       40635       32444       59404\r\n        7743       38219       40676       27598       47809       43720       56632       45573       46295       25734\r\n       64776       48498       10116       12065       14698       38432       25485       47196       15962        1628\r\n       35388       15389       24991       47564       17632       44244       29801       22734       51450       44003\r\n       46328       48166       10560       24272       44107       23659       16166       33881        4855       54864\r\n       65502       63609       49683       55152       31292       40650       51407       36483       25813       63668\r\n       18864       56815       57089       48118       40875       53159       57857       10256         222        3731\r\n       27166        5651       22988       37422       15495        1262       59881       36834       14462       29512\r\n       30463       24014       44927       11590       11607        5496       36587       45534          85       38172\r\n       50066       24195       19277       62743       54371       63884       39247       27948       12398       44999\r\n       53621       44894       34775       17388       50260       42686        9756       54805        9337       47148\r\n        6568       39186       54553       60593       61241       15154       58963       47932       17568       42601\r\n       11673       51731       39157       14665        7070       26443       29516       23594       11461       47639\r\n       23569       24094       21974       24481       11942        7996       13478       29767        9086       24500\r\n        3716       13502       19610        5734        6494       17592       58959       25322       39248       38114\r\n       34202        5679       29661       41950       32097       16898       49976       50826       59051        7609\r\n       22010       50589       27698       11836       12664       21736       57834       48121       61563        3778\r\n       11512       13479       23567        2952       58713        9976       18674       28198       14495       64209\r\n       13693       25445       36590       47393        6493       22807       44120       45465       31632       18666\r\n       59320       36161       48663       22769        2894        7973       43534       61945       24642       38992\r\n       44262       15004       27809       43294       36522       57943        8048       51395       34326       63056\r\n       30701       42070       28138       25157       50626        6178       26694       46240       17358       12175\r\n       59777       31750        8183       41113       20443       60951       18041        7165        4479       12651\r\n        6816        9951        1601        1418       11729       26150       46967       25554       28595       22389\r\n       48860       51244       19017       59675       22213        3106       18571       38725       11393       61138\r\n       48252        6593       20809       52465       13772       22437       58733       30105        1710       25602];\r\n[P,p]=montgomeryMult(a,R,N);\r\nassert(isequal(P,Y))\r\nassert(isequal(y,p(10:100:end)))\r\n%%\r\nN=3347;\r\nR=2^16;\r\na =[    1112       36822       19271       42840       48879       33433       48232       54170        3299       62565\r\n        7920       12071       15556       62713       53288       59399       52080       25560       14987       28219\r\n       56538       39138       34791       61324       25120       41217       35710       32630       54669       63016\r\n       31738       19656        5996       30008       40454        6654       44972       45534        1025       49965\r\n       55368        8789       26562       15759       37715       25615       58565       54681       56604         481\r\n       13723       13933        6871       50062       34737        3579        3590       39952        5116       44567\r\n       36194       58650        7358       49763       18026       32852       19900       37665       43846       46265\r\n       41280        4682       51408       48539       16294       28293        3027       21367       32781       42279\r\n        2096       15891       19108       48738       29598       65376       12810       29912       14286       36196\r\n       40285        3522       39553        6941       14923       53189       47196       46779       37461       14293\r\n       23750       28948       63204       44666       52720       31827       47300       57960        8007       50617\r\n        3246         870       28343       30360       64625       58618       57527       47241       43985       14944\r\n       32084       58798       45531       13904        1965        9014       38170        1219       39294       24304\r\n       12616       12888       49682        6456       35105       25559        4632       44222        3668       58387\r\n        8066        6119       28353       53973        5706       60775       60472       28738        3692       56123\r\n       13467       20143       42958       11469       52565       60128       52453       28692        9994       26373\r\n        9602       29888        7192       10719       64824       46764       18739        7670        1285       20841\r\n       12391        6663       61194       43646        4387       40523       35629       53390       28519       39887\r\n        2795       65233       12285       58614       61564       22497       64538       21289       54540       59650\r\n       41628       21764       17444       33853        1191       61343       46902       16136       40461       59578\r\n       18472       19486       52286       46052       44816        8177       54982       22460       34087       38770\r\n       35297        4066       31955       10065       51362       47879       28394       24621       56614       21795\r\n       45558       19545       50394       62485       35005       42367       30842       35818        6402       55906\r\n       32710        3037       25952       35447       58022       54601       36746       36825       59510       28992\r\n       35114       33123       17887       44547       58917       26101       17635       25940        7078       59267\r\n       29175       49900        2440        2396       41021       49140       49087       26091       33881        2174\r\n        8122       41357       44125       53031        9035       54737       33022       33775        9381       34893\r\n       32136        5891       28151       49061       14273       21132       42389       43091       36658       46956\r\n       55902        5299       29605        7876       11936       36193       20168       62319         300       11750\r\n       57273       50937       39967       34409        2740       64168        9091       47339       50245       22055\r\n       17714       59318        3893       21353        7008       35999       31167       26219       55621       12301\r\n       13661       34981       20697       35812       40399       21654       23754       54517       60084       21097\r\n       37026        7153       50641       26141       61581       40597       51649        8803       64681       26467\r\n       41963       54120       45641       27203       23229       23634       51137        3962       33104       35950\r\n       27330       22157        8213       11844       26910       49578       43811        5521       17787        3194\r\n       13498       19265        8529       16737       64510       27125        8749       10741        6602       36223\r\n       62123       48910        6052        1345       61969       32266        1412       21248       33282       18010\r\n        5378         677         512       60534       44344       45530       36689       19773       38378       15827\r\n        6927        3175       27728       42840       64769       63749       19714         765       49996       15934\r\n        9308       43772       42963       61119       50255       21479       61565       35383        5437       10102\r\n       10909       39548       47377       10715       22065       54906       64284        6250       43358       62679\r\n       40695       34478       34813       60365       43409       48435       18783        9601       33880       61319\r\n       37598       47822        7131       52078       16001       62532       52482       41362       11209       53655\r\n        3412       46350       41403       37840       19366        2092       58727       56316       61509       47727\r\n       61027       51208        8290       28838       44596       23387       39159       63846       38697       11521\r\n       47753       18872        8801       16882       34592       43427       57934       37410       28877       23617\r\n       48355       45385        6461       49279       26974       18448       61848       65329       61729       12372\r\n        4155       36481        9307       14986       39494       15098       35989       36276       42985          78\r\n       56389       25986       11026        4206       49186       46604       47735       33781       29618       20736\r\n       61237        4036       12861       50287       38242       40932       37798       21671       55030       45850\r\n       64513       51129       20806       43987       36162       38706        1694       28180       34906       40976\r\n       56291       22123       20737       46872       38244       43282       29263       32231       36299       35590\r\n       51482       39837       14258       42078       33542        3116       42356        4655       44568       28772\r\n       33644       48578       16452       27462        5412       22857       34157       58178       24064       18836\r\n       11639        6869       58518       25608       47157       29579       24399        4235       15682       32876\r\n       26121        8381       46086       53486       65284       15787       61416       28585       37940       49908\r\n        8777       36014       36420       20802       23234       46861       54364       54173       56812       49965\r\n        2024       31799       12087       53381       63652       56110       55645       25856       26658       37752\r\n       61547       58358       13895       51712       22704       18448       24414       40204        7380       48998\r\n       19746       52360        5069       55853       58100       47910       38874       53650       29087       42305\r\n       19368       48125       59886       33137       29798        9028       57183       58080       19672        8075\r\n       21819        3364       46315       41658       27094       54835       61177       61021       26305       33056\r\n       30609        4776       36555       62317       14269        9083       43808       12503       54615       22758\r\n       42480        5801       20540       29095        8234       38548       13551       16946       26452        6038\r\n        1653       52320       10892        3933       20245       23996       42850       58842       25570        9689\r\n       55194       61800       40795       56803       47585       52871        4721       38886       23622       12987\r\n       36636       44807       64745       41365       51306       33015       26655       33019        9191       44057\r\n       55974        8656       11169       23270       45468       32086       43708       40161       17047       28279\r\n       22798       47364       16894       65339         642       57478       61192       53701        5689       45508\r\n       29230        7232       26004       14691       55260       23143       53146       34857       28140       16828\r\n        3554        7700        4849       42759       60445       29454       31755       13243       16861         639\r\n       11606       41990       44832       39648       50525       63145       49594       29746       19500       34883\r\n       43437       21549       26370       25378        2795        2772       27331       28043       27843       18310\r\n       21681       42848       64411        9318       24784       63763       63686       63311        7812       62012\r\n       58883       49095       26357        1647       46159       12399       64747       40635       32444       59404\r\n        7743       38219       40676       27598       47809       43720       56632       45573       46295       25734\r\n       64776       48498       10116       12065       14698       38432       25485       47196       15962        1628\r\n       35388       15389       24991       47564       17632       44244       29801       22734       51450       44003\r\n       46328       48166       10560       24272       44107       23659       16166       33881        4855       54864\r\n       65502       63609       49683       55152       31292       40650       51407       36483       25813       63668\r\n       18864       56815       57089       48118       40875       53159       57857       10256         222        3731\r\n       27166        5651       22988       37422       15495        1262       59881       36834       14462       29512\r\n       30463       24014       44927       11590       11607        5496       36587       45534          85       38172\r\n       50066       24195       19277       62743       54371       63884       39247       27948       12398       44999\r\n       53621       44894       34775       17388       50260       42686        9756       54805        9337       47148\r\n        6568       39186       54553       60593       61241       15154       58963       47932       17568       42601\r\n       11673       51771       39157       14665        7070       26443       29516       23594       11461       47639\r\n       23569       24094       21974       24481       11942        7996       13478       29767        9086       24500\r\n        3716       13502       19610        5734        6494       17592       58959       25322       39248       38114\r\n       34202        5679       29661       41950       32097       16898       49976       50826       59051        7609\r\n       22010       50589       27698       11836       12664       21736       57834       48121       61563        3778\r\n       11512       13479       23567        2952       58713        9976       18674       28198       14495       64209\r\n       13693       25445       36590       47393        6493       22807       44120       45465       31632       18666\r\n       59320       36161       48663       22769        2894        7973       43534       61945       24642       38992\r\n       44262       15004       27809       43294       36522       57943        8048       51395       34326       63056\r\n       30701       42070       28138       25157       50626        6178       26694       46240       17358       12175\r\n       59777       31750        8183       41113       20443       60951       18041        7165        4479       12651\r\n        6816        9951        1601        1418       11729       26150       46967       25554       28595       22389\r\n       48860       51244       19017       59675       22213        3106       18571       38725       11393       61138\r\n       48252        6593       20809       52465       13772       22437       58733       30105        1710       25602];\r\nY=1870;\r\ny=[130,1496,2440,2533,1292,1876,783,751,107,3006];\r\n[P,p]=montgomeryMult(a,R,N);\r\nassert(isequal(P,Y))\r\nassert(isequal(y,p(10:100:end)))\r\n%%\r\nR=2^16;\r\nN=3967;\r\nY=3799;\r\ny=[788,2020,2960,1688,2874,3752,1280,2265,1542,1371];\r\na =[    1112       36822       19271       42840       48879       33433       48232       54170        3299       62565\r\n        7920       12071       15556       62713       53288       59399       52080       25560       14987       28219\r\n       56538       39138       34791       61324       25120       41217       35710       32630       54669       63016\r\n       31738       19656        5996       30008       40454        6654       44972       45534        1025       49965\r\n       55368        8789       26562       15759       37715       25615       58565       54681       56604         481\r\n       13723       13933        6871       50062       34737        3579        3590       39952        5116       44567\r\n       36194       58650        7358       49763       18026       32852       19900       37665       43846       46265\r\n       41280        4682       51408       48539       16294       28293        3027       21367       32781       42279\r\n        2096       15891       19108       48738       29598       65376       12810       29912       14286       36196\r\n       40285        3522       39553        6941       14923       53189       47196       46779       37461       14293\r\n       23750       28948       63204       44666       52720       31827       47300       57960        8007       50617\r\n        3246         870       28343       30360       64625       58618       57527       47241       43985       14944\r\n       32084       58798       45531       13904        1965        9014       38170        1219       39294       24304\r\n       12616       12888       49682        6456       35105       25559        4632       44222        3668       58387\r\n        8066        6119       28353       53973        5706       60775       60472       28738        3692       56123\r\n       13467       20143       42958       11469       52565       60128       52453       28692        9994       26373\r\n        9602       29888        7192       10719       64824       46764       18739        7670        1285       20841\r\n       12391        6663       61194       43646        4387       40523       35629       53390       28519       39887\r\n        2795       65233       12285       58614       61564       22497       64538       21289       54540       59650\r\n       41628       21764       17444       33853        1191       61343       46902       16136       40461       59578\r\n       18472       19486       52286       46052       44816        8177       54982       22460       34087       38770\r\n       35297        4066       31955       10065       51362       47879       28394       24621       56614       21795\r\n       45558       19545       50394       62485       35005       42367       30842       35818        6402       55906\r\n       32710        3037       25952       35447       58022       54601       36746       36825       59510       28992\r\n       35114       33123       17887       44547       58917       26101       17635       25940        7078       59267\r\n       29175       49900        2440        2396       41021       49140       49087       26091       33881        2174\r\n        8122       41357       44125       53031        9035       54737       33022       33775        9381       34893\r\n       32136        5891       28151       49061       14273       21132       42389       43091       36658       46956\r\n       55902        5299       29605        7876       11936       36193       20168       62319         300       11750\r\n       57273       50937       39967       34409        2740       64168        9091       47339       50245       22055\r\n       17714       59318        3893       21353        7008       35999       31167       26219       55621       12301\r\n       13661       34981       20697       35812       40399       21654       23754       54517       60084       21097\r\n       37026        7153       50641       26141       61581       40597       51649        8803       64681       26467\r\n       41963       54120       45641       27203       23229       23634       51137        3962       33104       35950\r\n       27330       22157        8213       11844       26910       49578       43811        5521       17787        3194\r\n       13498       19265        8529       16737       64510       27125        8749       10741        6602       36223\r\n       62123       48910        6052        1345       61969       32266        1412       21248       33282       18010\r\n        5378         677         512       60534       44344       45530       36689       19773       38378       15827\r\n        6927        3175       27728       42840       64769       63749       19714         765       49996       15934\r\n        9308       43772       42963       61119       50255       21479       61565       35383        5437       10102\r\n       10909       39548       47377       10715       22065       54906       64284        6250       43358       62679\r\n       40695       34478       34813       60365       43409       48435       18783        9601       33880       61319\r\n       37598       47822        7131       52078       16001       62532       52482       41362       11209       53655\r\n        3412       46350       41403       37840       19366        2092       58727       56316       61509       47727\r\n       61027       51208        8290       28838       44596       23387       39159       63846       38697       11521\r\n       47753       18872        8801       16882       34592       43427       57934       37410       28877       23617\r\n       48355       45385        6461       49279       26974       18448       61848       65329       61729       12372\r\n        4155       36481        9307       14986       39494       15098       35989       36276       42985          78\r\n       56389       25986       11026        4206       49186       46604       47735       33781       29618       20736\r\n       61237        4036       12861       50287       38242       40932       37798       21671       55030       45850\r\n       64513       51129       20806       43987       36162       38706        1694       28180       34906       40976\r\n       56291       22123       20737       46872       38244       43282       29263       32231       36299       35590\r\n       51482       39837       14258       42078       33542        3116       42356        4655       44568       28772\r\n       33644       48578       16452       27462        5412       22857       34157       58178       24064       18836\r\n       11639        6869       58518       25608       47157       29579       24399        4235       15682       32876\r\n       26121        8381       46086       53486       65284       15787       61416       28585       37940       49908\r\n        8777       36014       36420       20802       23234       46861       54364       54173       56812       49965\r\n        2024       31799       12087       53381       63652       56110       55645       25856       26658       37752\r\n       61547       58358       13895       51712       22704       18448       24414       40204        7380       48998\r\n       19746       52360        5069       55853       58100       47910       38874       53650       29087       42305\r\n       19368       48125       59886       33137       29798        9028       57183       58080       19672        8075\r\n       21819        3364       46315       41658       27094       54835       61177       61021       26305       33056\r\n       30609        4776       36555       62317       14269        9083       43808       12503       54615       22758\r\n       42480        5801       20540       29095        8234       38548       13551       16946       26452        6038\r\n        1653       52320       10892        3933       20245       23996       42850       58842       25570        9689\r\n       55194       61800       40795       56803       47585       52871        4721       38886       23622       12987\r\n       36636       44807       64745       41365       51306       33015       26655       33019        9191       44057\r\n       55974        8656       11169       23270       45468       32086       43708       40161       17047       28279\r\n       22798       47364       16894       65339         642       57478       61192       53701        5689       45508\r\n       29230        7232       26004       14691       55260       23143       53146       34857       28140       16828\r\n        3554        7700        4849       42759       60445       29454       31755       13243       16861         639\r\n       11606       41990       44832       39648       50525       63145       49594       29746       19500       34883\r\n       43437       21549       26370       25378        2795        2772       27331       28043       27843       18310\r\n       21681       42848       64411        9318       24784       63763       63686       63311        7812       62012\r\n       58883       49095       26357        1647       46159       12399       64747       40635       32444       59404\r\n        7743       38219       40676       27598       47809       43720       56632       45573       46295       25734\r\n       64776       48498       10116       12065       14698       38432       25485       47196       15962        1628\r\n       35388       15389       24991       47564       17632       44244       29801       22734       51450       44003\r\n       46328       48166       10560       24272       44107       23659       16166       33881        4855       54864\r\n       65502       63609       49683       55152       31292       40650       51407       36483       25813       63668\r\n       18864       56815       57089       48118       40875       53159       57857       10256         222        3731\r\n       27166        5651       22988       37422       15495        1262       59881       36834       14462       29512\r\n       30463       24014       44927       11590       11607        5496       36587       45534          85       38172\r\n       50066       24195       19277       62743       54371       63884       39247       27948       12398       44999\r\n       53621       44894       34775       17388       50260       42686        9756       54805        9337       47148\r\n        6568       39186       54553       60593       61241       15154       58963       47932       17568       42601\r\n       11673       51771       39157       14665        7070       26443       29516       23594       11461       47639\r\n       23569       24094       21974       24481       11942        7996       13478       29767        9086       24500\r\n        3716       13502       19610        5734        6494       17592       58959       25322       39248       38114\r\n       34202        5679       29661       41950       32097       16898       49976       50826       59051        7609\r\n       22010       50589       27698       11836       12664       21736       57834       48121       61563        3778\r\n       11512       13479       23567        2952       58713        9976       18674       28198       14495       64209\r\n       13693       25445       36590       47393        6493       22807       44120       45465       31632       18666\r\n       59320       36161       48663       22769        2894        7973       43534       61945       24642       38992\r\n       44262       15004       27809       43294       36522       57943        8048       51395       34326       63056\r\n       30701       42070       28138       25157       50626        6178       26694       46240       17358       12175\r\n       59777       31750        8183       41113       20443       60951       18041        7165        4479       12651\r\n        6816        9951        1601        1418       11729       26150       46967       25554       28595       22999\r\n       48860       51244       19017       59675       22213        3106       18571       38725       11393       61138\r\n       48252        6593       20809       52465       13772       22437       58733       30105        1710       25602];\r\n[P,p]=montgomeryMult(a,R,N);\r\nassert(isequal(P,Y))\r\nassert(isequal(y,p(10:100:end)))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-30T21:17:47.000Z","updated_at":"2025-10-12T15:14:20.000Z","published_at":"2020-09-30T21:17:47.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\u003eMultiply all elements of an input matrix (A) modulo N, given all elements are less than R (2^number of bits). Where gcd(R,N)=1 and N\u0026lt;R. Output the final result, P (in normal form) and all intermediate products (p) in Montgomery form (first product is just first element of matrix (A)*R modulo N).\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":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":45362,"title":"RIPEMD160 Hash","description":"Generator the RIPEMD160 hash given an input string and output the hexadecimal RIPEMD160 hash.\r\n\r\nFor example:\r\nInput='My name is David Hill.';\r\nOutput='372FF8C35C873D79312BFAF92BE55F7602164B1A';","description_html":"\u003cp\u003eGenerator the RIPEMD160 hash given an input string and output the hexadecimal RIPEMD160 hash.\u003c/p\u003e\u003cp\u003eFor example:\r\nInput='My name is David Hill.';\r\nOutput='372FF8C35C873D79312BFAF92BE55F7602164B1A';\u003c/p\u003e","function_template":"function y = ripemd160(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'My name is David Hill.';\r\ny_correct = '372FF8C35C873D79312BFAF92BE55F7602164B1A';\r\nassert(isequal(ripemd160(x),y_correct))\r\n%%\r\nx = 'The way to get started is to quit talking and begin doing.';\r\ny_correct = '6F96416D233B7C067450D1D18B81FC4A44E1C717';\r\nassert(isequal(ripemd160(x),y_correct))\r\n%%\r\nx = 'Tell me and I forget. Teach me and I remember. Involve me and I learn.';\r\ny_correct = 'B0BBACB5B165097B5DCA7234C35384BC1687D9E0';\r\nassert(isequal(ripemd160(x),y_correct))\r\n%%\r\nx = '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 = 'E0F1ED57289F3975DEB3E3CF40614D2DAD513C7B';\r\nassert(isequal(ripemd160(x),y_correct))\r\n%%\r\nx = 'The two operations of our understanding, intuition and deduction, on which alone we have said we must rely in the acquisition of knowledge.';\r\ny_correct = 'BD31F5187B6ECD34B2BFC8255D9178AA9C862EF2';\r\nassert(isequal(ripemd160(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":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-08T03:45:28.000Z","updated_at":"2025-10-11T17:10:56.000Z","published_at":"2020-03-08T03:47:36.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\u003eGenerator the RIPEMD160 hash given an input string and output the hexadecimal RIPEMD160 hash.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example: Input='My name is David Hill.'; Output='372FF8C35C873D79312BFAF92BE55F7602164B1A';\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\"}]}"},{"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":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":45213,"title":"AES-256 KeyExpansion()","description":"Given a 32-byte hexadecimal character array representing the AES-256 input key, execute the AES-256 algorithm, KeyExpansion() and output the xth (input) key-word of this 60-word sequence as a 4x2 hexadecimal array. You will need the SubBytes() function done in one of my previous Cody problems.\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  key='e32868331fa8ef0138de0de85478346aec5e3912b6029ae71691c384237a3eeb';\r\n  x=58;%want key-word number 58 out of 60\r\n  w=['d0';'eb';'7c';'8a'];%58th key-word","description_html":"\u003cp\u003eGiven a 32-byte hexadecimal character array representing the AES-256 input key, execute the AES-256 algorithm, KeyExpansion() and output the xth (input) key-word of this 60-word sequence as a 4x2 hexadecimal array. You will need the SubBytes() function done in one of my previous Cody problems.\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\"\u003ekey='e32868331fa8ef0138de0de85478346aec5e3912b6029ae71691c384237a3eeb';\r\nx=58;%want key-word number 58 out of 60\r\nw=['d0';'eb';'7c';'8a'];%58th key-word\r\n\u003c/pre\u003e","function_template":"function w = KeyExpansion(key,x)\r\n  w = key;\r\nend","test_suite":"%%\r\nkey='e32868331fa8ef0138de0de85478346aec5e3912b6029ae71691c384237a3eeb';\r\nx=58;\r\nw=['d0';'eb';'7c';'8a'];\r\nassert(isequal(KeyExpansion(key,x),w))\r\n%%\r\nkey='4b6b0490163a5b44345675ba437aec16eee63eee26643e0d2fe1f51eb8e0ca0b';\r\nx=31\r\nw=['da';'8d';'75';'fb'];\r\nassert(isequal(KeyExpansion(key,x),w))\r\n%%\r\nkey='c0ad28b4cb90e11f5420fbfe9042b10f79e5a3adc1ca2fdb6c3e034a4ee79d4b';\r\nx=60;\r\nw=['38';'57';'bb';'18'];\r\nassert(isequal(KeyExpansion(key,x),w))\r\n%%\r\nkey='b8b6426ab2dedb79f812fc5c2edb81e5a3fd5ef58a9dcbe728fcb93e36352969';\r\nx=10;\r\nw=['9d';'cd';'60';'16'];\r\nassert(isequal(KeyExpansion(key,x),w))\r\n%%\r\nkey='7f837ce449b892bce32f99ba24f64c5f40ac117fc56e514f48d978d8a2e48999';\r\nx=7;\r\nw=['48';'d9';'78';'d8'];\r\nassert(isequal(KeyExpansion(key,x),w))\r\n%%\r\nkey='7f837ce449b892bce32f99ba24f64c5f40ac117fc56e514f48d978d8a2e48999';\r\nx=57;\r\nw=['e3';'7d';'c6';'78'];\r\nassert(isequal(KeyExpansion(key,x),w))\r\n%%\r\nkey='7f837ce449b892bce32f99ba24f64c5f40ac117fc56e514f48d978d8a2e48999';\r\nx=58;\r\nw=['cd';'9a';'06';'35'];\r\nassert(isequal(KeyExpansion(key,x),w))\r\n%%\r\nkey='7f837ce449b892bce32f99ba24f64c5f40ac117fc56e514f48d978d8a2e48999';\r\nx=59;\r\nw=['1e';'2b';'6e';'33'];\r\nassert(isequal(KeyExpansion(key,x),w))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-22T00:25:14.000Z","updated_at":"2025-10-11T16:12:13.000Z","published_at":"2019-11-22T01:37:11.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 32-byte hexadecimal character array representing the AES-256 input key, execute the AES-256 algorithm, KeyExpansion() and output the xth (input) key-word of this 60-word sequence as a 4x2 hexadecimal array. You will need the SubBytes() function done in one of my previous Cody problems.\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[key='e32868331fa8ef0138de0de85478346aec5e3912b6029ae71691c384237a3eeb';\\nx=58;%want key-word number 58 out of 60\\nw=['d0';'eb';'7c';'8a'];%58th key-word]]\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":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":2444,"title":"Obtain the Bitcoin address associated to a given private key","description":"All the information you need is at\r\n\r\n\u003chttps://en.bitcoin.it/wiki/Address\u003e\r\n\r\nand you may also find helpful\r\n\r\n\u003chttps://brainwallet.github.io/\u003e\r\n\r\nP.S.: The winner may receive a Bitcoin tip.","description_html":"\u003cp\u003eAll the information you need is at\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.bitcoin.it/wiki/Address\"\u003ehttps://en.bitcoin.it/wiki/Address\u003c/a\u003e\u003c/p\u003e\u003cp\u003eand you may also find helpful\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://brainwallet.github.io/\"\u003ehttps://brainwallet.github.io/\u003c/a\u003e\u003c/p\u003e\u003cp\u003eP.S.: The winner may receive a Bitcoin tip.\u003c/p\u003e","function_template":"function y = private2public(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nprivate_key{1} = '5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss';\r\naddress{1} =  '1HZwkjkeaoZfTSaJxDw6aKkxp45agDiEzN';\r\n\r\nprivate_key{2} = '5KPZC58SA5LXM3hQA6LQ761hP6YFyEW58v1uAd4yAgsgbZxqCZR';\r\naddress{2} =  '1DPZAu8Lowvmi3WdRpvzhkWLkSz7K2k7qY';\r\n\r\nprivate_key{3} = '5JQeiA915aSm9RCUwiasAVeass1DVthgFfNy76KRYA9689tqJX7';\r\naddress{3} =  '1889nUYazT9MhsqE4fxutq1dpyspHZEiaM';\r\n\r\nprivate_key{4} = '5JPNo4Q5A3AzhR2VRScgyZhJbgCbq3gHcd4w4EDimUBN9TTWq2s';\r\naddress{4} =  '1CvKHaVAKsGGftTFZBdJRcxozxeQo7rXUk';\r\n\r\nprivate_key{5} = '5Kdd1i85z2myGnN4ndHW96rNDQW1AFLkqLUewPodTyxm1EK2gd1';\r\naddress{5} =  '12iMNgciNRutMSeu18iaByKYBPnk88Hcm1';\r\n\r\nprivate_key{6} = '5KaSncNnmejNkcZiHWh74kHf8jzUutKmoajUtgnFhT4e4mHK6UT';\r\naddress{6} =  '1JmrvhqYP4EpSRAhuKkn2NtmPvPNCxA9Kd';\r\n\r\nprivate_key{7} = '5Jjac2ukidTt8fTENXjUWZaBZpSgiADmEzv1EhSUYrkGpRYEeoK';\r\naddress{7} =  '162ZamkWtU4MjmayDqfZiZ8YDWha1cBqDz';\r\n\r\nprivate_key{8} = '5J9qJjxEt4YHtnHBQX575mmpQ12KHCfdeY5ay6DPTrGCYG4pMp8';\r\naddress{8} =  '15DCDa22KmMe4t4732jYAd6YFWTCuaWqFf';\r\n\r\nprivate_key{9} = '5J1SxwfR2fFYKrspZr2nPSKaQhowL88fpBSMAEVXVg1GCDkeuVX';\r\naddress{9} =  '12qFUiu25hUX9h1DUfU9LcqHGDdnGaJdXz';\r\n\r\nprivate_key{10} = '5JNzgZtEFAgWiNwtNvHsFxL8K5ixXHzvGVDTmi1EPQQEaBAbXNT';\r\naddress{10} =  '19b8X6TRsmHFWm4sJKo9NTHdTUmu38SqxE';\r\n\r\n%{  \r\n\r\n \"I would prefer even to fail with honor than win by cheating.\"\r\n\r\n                                                                Sophocles\r\n\r\n%}\r\n\r\nfor k=randperm(10)\r\nif address{k}==private2public(private_key{k}) else fail{-1}, end\r\nend","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":"2014-07-18T23:14:37.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2014-07-16T18:59:56.000Z","updated_at":"2025-10-15T12:54:38.000Z","published_at":"2014-07-16T19:00:19.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\u003eAll the information you need is at\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:hyperlink w:docLocation=\\\"https://en.bitcoin.it/wiki/Address\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.bitcoin.it/wiki/Address\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\u003eand you may also find helpful\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:hyperlink w:docLocation=\\\"https://brainwallet.github.io/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://brainwallet.github.io/\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\u003eP.S.: The winner may receive a Bitcoin tip.\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\"}]}"}],"no_progress_badge":{"id":53,"name":"Unknown","symbol":"unknown","description":"Partially completed groups","description_html":null,"image_location":"/images/responsive/supporting/matlabcentral/cody/badges/problem_groups_unknown_2.png","bonus":null,"players_count":0,"active":false,"created_by":null,"updated_by":null,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"created_at":"2018-01-10T23:20:29.000Z","updated_at":"2018-01-10T23:20:29.000Z","community_badge_id":null,"award_multiples":false}}