Cody

# Problem 44956. Determine RSA keys (public and private) given two prime number character strings (p and q)

Solution 1915449

Submitted on 29 Aug 2019 by Tim
• Size: 80
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
p = '3355335697481001330501721'; q = '5955344080483688912855719'; n='19982178584029090861856118769095354822153154192399'; d='3270348772331599380262578849367006078599068947553'; [a,b]=keyGeneration(p,q); assert(isequal(a,n)) assert(isequal(b,d))

2   Pass
p = '813610636673'; q = '1605983302589'; n='1306645097305643499246397'; d='355984378478555057894913'; [a,b]=keyGeneration(p,q); assert(isequal(a,n)) assert(isequal(b,d))

3   Pass
p = '67979691391330950855242581938207942707483223433259'; q = '6153843674264879356192291854148321819411378704398479'; n='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061'; d='8444986024072025211908427894173383040354675378319105204646840203847580180874615752845913488969020869'; [a,b]=keyGeneration(p,q); assert(isequal(a,n)) assert(isequal(b,d))

4   Pass
p = '9889977922600049892469466917642800243744956526655686322206918503863571743809023708648966023469645149'; q = '2476454822450020555811121392457617785385805217059253393679351596046272567110905233495088857069108236299'; n = '24492083520347129695334786995557239882540750861618765872694983337614252441655470479409598244691513160097634784088025768219041142794039842531021683737585081956313858395523050254392582005967309810771063551'; d = '7043758337908398316945695794623843894382227935971901356005844728128437829322707899292187736941661046350269216062193211515498221491327821445579367736374708711769362662280124297131956999441862850977388289'; [a,b]=keyGeneration(p,q); assert(isequal(a,n)) assert(isequal(b,d))

5   Pass
p = '26892754546730837119898059580995437039544399594421875855251066246511044160199048288603963625982639028058714345196159764252398791569637860905138287322706679328840515337572608690956308136959236074835599'; q = '76019400184540822543696224086250845563040709795227937154720461468348727220343229834542918037619525984430713380822472295398107810565069813256377730791194881206750953165713183208458761595898204049235781'; n='2044371069952561243871813747701535503388267616657953475148898181142012590397809234167373308955772082860082985954286137615597515257087506574051530104475374974920093127841789408014496870693507622812332673504654584870100580476794800708440785082437228308551107726064054828640053321250498545183042994878498928173976370185712833904492317580152665428272199317847097773542066059565512439224992672101163367819'; d='131358569595346680469722564224349085322306406056832660693226883146757023027681686453130430199929142940992255578581548217026735077095312421736286269892515739496597527524021166625708322359741224036234988705082882699895245449017415856831226734459122764117157172961113990706104659539690141481103935528273973382371183154438463086325519326121228923730136467766036183357672350586091588640276470994058874793'; [a,b]=keyGeneration(p,q); assert(isequal(a,n)) assert(isequal(b,d))