{"id":48257,"date":"2018-08-14T17:38:41","date_gmt":"2018-08-14T12:08:41","guid":{"rendered":"https:\/\/hindi.theindianwire.com\/?p=48257"},"modified":"2018-08-14T17:38:41","modified_gmt":"2018-08-14T12:08:41","slug":"rsa-%e0%a4%8f%e0%a4%b2%e0%a5%8d%e0%a4%97%e0%a5%8b%e0%a4%b0%e0%a4%bf%e0%a4%a5%e0%a5%8d%e0%a4%ae","status":"publish","type":"post","link":"https:\/\/hindi.theindianwire.com\/rsa-%e0%a4%8f%e0%a4%b2%e0%a5%8d%e0%a4%97%e0%a5%8b%e0%a4%b0%e0%a4%bf%e0%a4%a5%e0%a5%8d%e0%a4%ae-48257\/","title":{"rendered":"\u0915\u094d\u0930\u093f\u092a\u094d\u091f\u094b\u0917\u094d\u0930\u093e\u092b\u0940 \u092e\u0947\u0902 RSA \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u094d\u092e \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u0909\u0938\u0915\u0947 \u0915\u094b\u0921 \u0915\u0947 \u0938\u093e\u0925 \u091c\u093e\u0928\u0947"},"content":{"rendered":"\n
RSA \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u090f\u0915 asymmetric \u0915\u094d\u0930\u093f\u092a\u094d\u091f\u094b\u0917\u094d\u0930\u093e\u095e\u0940 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0939\u0948\u0964 Asymmetric \u0915\u093e \u092f\u0939\u093e\u0901 \u092a\u0930 \u0905\u0930\u094d\u0925 \u0939\u0941\u0906 \u092f\u0947 \u0926\u094b \u0905\u0932\u0917-\u0905\u0932\u0917 key \u092a\u0930 \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0924\u093e \u0939\u0948-\u092a\u092c\u094d\u0932\u093f\u0915 key \u090f\u0909\u0930 \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f key.<\/p>\n
\u091c\u0948\u0938\u093e \u0915\u093f \u0907\u0938\u0915\u0947 \u0928\u093e\u092e \u0938\u0947 \u092a\u0924\u093e \u091a\u0932\u0924\u093e \u0939\u0948, \u092a\u092c\u094d\u0932\u093f\u0915 key \u0915\u094b \u0938\u092d\u0940 \u0915\u094b \u0926\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948 \u091c\u092c\u0915\u093f \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f \u0915\u0930\u0940 \u0915\u094b \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f \u0930\u0916\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0964<\/p>\n
Asymmetric \u0915\u094d\u0930\u093f\u092a\u094d\u091f\u094b\u0917\u094d\u0930\u093e\u095e\u0940 \u0915\u093e \u0909\u0926\u093e\u0939\u0930\u0923: <\/strong><\/p>\n Since this is asymmetric, nobody else except browser can decrypt the data even if a third party has public key of browser. \u091a\u0942\u0901\u0915\u093f \u092f\u0947 \u0905\u0938\u093f\u092e\u0947\u091f\u094d\u0930\u093f\u0915 \u0939\u0948, \u0907\u0938\u0940\u0932\u093f\u090f \u092c\u094d\u0930\u093e\u0909\u095b\u0930 \u0915\u0947 \u0905\u0932\u093e\u0935\u0947 \u0915\u094b\u0908 \u092d\u0940 \u0907\u0938\u0947 \u0921\u093f\u0915\u094d\u0930\u093f\u092a\u094d\u091f \u0928\u0939\u0940\u0902 \u0915\u0930 \u0938\u0915\u0924\u093e \u092d\u0932\u0947 \u0939\u0940 \u0915\u093f\u0938\u0940 \u0925\u0930\u094d\u0921 \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u0947 \u092a\u093e\u0938 \u092c\u094d\u0930\u093e\u0909\u095b\u0930 \u0915\u093e \u092a\u092c\u094d\u0932\u093f\u0915 key \u0939\u0940 \u0915\u094d\u092f\u094b\u0902 \u0928 \u0939\u094b\u0964<\/p>\n RSA \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u0935\u093f\u091a\u093e\u0930 \u0907\u0938 \u092c\u093e\u0924 \u092a\u0930 \u0906\u0927\u093e\u0930\u093f\u0924 \u0939\u0948 \u0915\u093f \u092c\u095c\u0947 \u0907\u0928\u094d\u091f\u093f\u091c\u0930 \u0915\u094b \u092b\u0948\u0915\u094d\u091f\u0930 \u0915\u0930\u0928\u093e \u0915\u093e\u092b\u0940 \u092e\u0941\u0936\u094d\u0915\u093f\u0932 \u0915\u093e\u092e \u0939\u0948\u0964 \u092a\u092c\u094d\u0932\u093f\u0915 key \u0926\u094b \u0938\u0902\u0916\u094d\u092f\u093e\u0913\u0902 \u0915\u094b \u092e\u093f\u0932\u093e \u0915\u0930 \u092c\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948 \u091c\u093f\u0938\u092e\u0947 \u0938\u0947 \u090f\u0915 \u0938\u0902\u0916\u094d\u092f\u093e \u0926\u094b \u092c\u095c\u0947 \u092a\u094d\u0930\u093e\u0907\u092e \u0938\u0902\u0916\u094d\u092f\u093e \u0915\u093e \u0917\u0941\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0964<\/p>\n \u090f\u0915 \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f key \u0915\u094b \u092d\u0940 \u0907\u0924\u0928\u0940 \u0926\u094b \u092a\u094d\u0930\u093e\u0907\u092e \u0938\u0902\u0916\u094d\u092f\u093e \u0938\u0947 \u092e\u093f\u0932\u093e\u0915\u0930 \u092c\u0928\u093e\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0964 \u0907\u0938\u0940\u0932\u093f\u090f \u0905\u0917\u0930 \u0915\u094b\u0908 \u092c\u095c\u0940 \u0938\u0902\u0916\u094d\u092f\u093e \u0915\u094b \u092b\u0948\u0915\u094d\u091f\u0930 \u0915\u0930 \u0938\u0915\u0924\u093e \u0939\u0948 \u0924\u094b \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f key \u0915\u094b \u0915\u094b\u092e\u094d\u092a\u094d\u0930\u094b\u092e\u093e\u0908\u095b \u0915\u093f\u092f\u093e \u091c\u093e \u0938\u0915\u0924\u093e \u0939\u0948\u0964<\/p>\n \u0907\u0938\u0940\u0932\u093f\u090f \u090f\u0928\u094d\u0915\u094d\u0930\u093f\u092a\u094d\u0936\u0928 \u0915\u0940 \u092a\u0942\u0930\u0940 \u092e\u091c\u092c\u0942\u0930\u0940 key \u0915\u0947 \u0906\u0915\u093e\u0930 \u092a\u0930 \u0928\u093f\u0930\u094d\u092d\u0930 \u0915\u0930\u0924\u0940 \u0939\u0948 \u0914\u0930 \u0905\u0917\u0930 \u0939\u092e key \u0938\u093e\u0907\u095b \u0915\u094b \u0926\u0941\u0917\u0941\u0928\u093e \u092f\u093e \u0924\u093f\u0917\u0941\u0928\u093e \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u090f\u0928\u094d\u0915\u094d\u0930\u093f\u092a\u094d\u0936\u0928 \u0915\u0940 \u092e\u091c\u092c\u0942\u0924\u0940 \u092d\u0940 \u0915\u093e\u092b\u0940 \u091c\u094d\u092f\u093e\u0926\u093e \u092c\u095d \u091c\u093e\u0924\u0940 \u0939\u0948\u0964<\/p>\n RSA \u0915\u0947 key \u0905\u0927\u093f\u0915\u0924\u0930 1024 \u092f\u093e 2048 \u092c\u093f\u091f \u0932\u092e\u094d\u092c\u0947 \u0939\u094b\u0924\u0947 \u0939\u0948\u0902 \u0932\u0947\u0915\u093f\u0928 \u0905\u092c \u090f\u0915\u094d\u0938\u092a\u0930\u094d\u091f \u0932\u094b\u0917\u094b\u0902 \u0915\u093e \u092e\u0928\u094d\u0928\u093e \u0939\u0948 \u0915\u093f \u0928\u093f\u0915\u091f \u092d\u0935\u093f\u0937\u094d\u092f \u092e\u0947\u0902 1024 \u092c\u093f\u091f \u0915\u0947 key \u0915\u094b \u0924\u094b\u095c\u093e \u091c\u093e \u0938\u0915\u0924\u093e \u0939\u0948\u0964 \u0932\u0947\u0915\u093f\u0928 \u0905\u092d\u0940 \u0924\u0915 \u0924\u094b \u0910\u0938\u093e \u0915\u0941\u091b \u0928\u0939\u0940\u0902 \u0939\u0941\u0906 \u0939\u0948\u0964<\/p>\n \u092a\u092c\u094d\u0932\u093f\u0915 key generate \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f:<\/p>\n \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f key generate \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f:<\/p>\n \u0905\u092c \u0939\u092e\u093e\u0930\u0947 \u092a\u093e\u0938 \u0939\u0948 \u0939\u092e\u093e\u0930\u0947 \u092a\u092c\u094d\u0932\u093f\u0915 key ( n = 3127 and e = 3) \u0914\u0930 \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f Key (d = 2011)\u0964<\/p>\n \u0906\u0907\u092f\u0947 \u0905\u092c \u0939\u092e \u201cHI\u201d<\/strong> \u0915\u094b \u090f\u0928\u094d\u0915\u094d\u0930\u093f\u092a\u094d\u091f \u0915\u0930 \u0915\u0947 \u0926\u0947\u0915\u094d\u0932\u094d\u0939\u0924\u0947 \u0939\u0948\u0902 \u0915\u093f \u092f\u0947 \u092a\u094d\u0930\u0915\u094d\u0930\u093f\u092f\u093e \u0915\u0948\u0938\u0947 \u0915\u093e\u092e \u0915\u0930\u0924\u0940 \u0939\u0948:<\/p>\n \u0905\u092c \u0939\u092e \u0906\u092a\u0915\u094b \u091b\u094b\u091f\u0947 \u092e\u093e\u0928\u094b\u0902 \u0915\u0947 \u0932\u093f\u090f RSA \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e C\u0915 \u0915\u094b\u0921 \u0926\u093f\u0916\u093e \u0930\u0939\u0947 \u0939\u0948\u0902:<\/p>\n <\/p>\n \u0907\u0938 \u0915\u094b\u0921 \u0915\u093e \u0906\u0909\u091f\u092a\u0941\u091f \u0939\u094b\u0917\u093e:<\/p>\n \u0907\u0938 \u0932\u0947\u0916 \u0938\u0947 \u0938\u092e\u094d\u092c\u0902\u0927\u093f\u0924 \u092f\u0926\u093f \u0906\u092a\u0915\u093e \u0915\u094b\u0908 \u092d\u0940 \u0938\u0935\u093e\u0932 \u092f\u093e \u0938\u0941\u091d\u093e\u0935 \u0939\u0948, \u0924\u094b \u0906\u092a \u0909\u0938\u0947 \u0928\u0940\u091a\u0947 \u0915\u092e\u0947\u0902\u091f \u092e\u0947\u0902 \u0932\u093f\u0916 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964<\/em><\/p>\n","protected":false},"excerpt":{"rendered":" RSA\u00a0\u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u094d\u092e \u0915\u094d\u092f\u093e \u0939\u0948? (rsa algorithm in cryptography in hindi) RSA \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u090f\u0915 asymmetric \u0915\u094d\u0930\u093f\u092a\u094d\u091f\u094b\u0917\u094d\u0930\u093e\u095e\u0940 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0939\u0948\u0964 Asymmetric \u0915\u093e \u092f\u0939\u093e\u0901 \u092a\u0930 \u0905\u0930\u094d\u0925 \u0939\u0941\u0906 \u092f\u0947 \u0926\u094b \u0905\u0932\u0917-\u0905\u0932\u0917 key \u092a\u0930 \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0924\u093e \u0939\u0948-\u092a\u092c\u094d\u0932\u093f\u0915 key \u090f\u0909\u0930 \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f key. \u091c\u0948\u0938\u093e \u0915\u093f \u0907\u0938\u0915\u0947 \u0928\u093e\u092e \u0938\u0947 \u092a\u0924\u093e \u091a\u0932\u0924\u093e \u0939\u0948, \u092a\u092c\u094d\u0932\u093f\u0915 key \u0915\u094b \u0938\u092d\u0940 \u0915\u094b \u0926\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948 \u091c\u092c\u0915\u093f \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f \u0915\u0930\u0940 \u0915\u094b \u092a\u094d\u0930\u093e\u0907\u0935\u0947\u091f […]<\/p>\n","protected":false},"author":52,"featured_media":48262,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[254],"tags":[5985],"yst_prominent_words":[],"class_list":["post-48257","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-5985"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/posts\/48257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/comments?post=48257"}],"version-history":[{"count":0,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/posts\/48257\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/media\/48262"}],"wp:attachment":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/media?parent=48257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/categories?post=48257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/tags?post=48257"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/yst_prominent_words?post=48257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
RSA \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u0940 \u0915\u093e\u0930\u094d\u092f\u092a\u094d\u0930\u0923\u093e\u0932\u0940 (working of\u00a0rsa algorithm in hindi)<\/h3>\n
RSA \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u092e\u0948\u0915\u0947\u0928\u093f\u091c\u094d\u092e (mechanism of\u00a0rsa algorithm in hindi)<\/h3>\n
\n
\n\u092a\u092c\u094d\u0932\u093f\u0915 key \u0915\u093e \u092a\u0939\u0932\u093e \u092d\u093e\u0917 : n = P*Q = 3127<\/strong>.<\/li>\n
\n\u0932\u0947\u0915\u093f\u0928 e \u0915\u094b \u0939\u094b\u0928\u093e \u091a\u093e\u0939\u093f\u090f:<\/p>\n\n
\n\u0905\u092c \u092e\u093e\u0928\u0924\u0947 \u0939\u0948\u0902 \u0915\u093f \u092f\u0947 3 \u0915\u0947 \u092c\u0930\u093e\u092c\u0930 \u0939\u094b\u0917\u093e\u0964<\/li>\n<\/ul>\n<\/li>\n\n
\n\u091c\u0948\u0938\u0947 \u0915\u093f, \u03a6(n) = (P-1)(Q-1)<\/strong>
\n\u0907\u0938\u0940\u0932\u093f\u090f, \u03a6(n) = 3016<\/li>\n
\nd = (k*\u03a6(n) + 1) \/ e<\/strong> for some integer k
\nk = 2 \u0915\u0947 \u0932\u093f\u090f, d \u0915\u093e \u092e\u093e\u0928 \u0939\u094b\u0917\u093e 2011.<\/li>\n<\/ul>\nRSA \u0915\u093e \u0909\u0926\u093e\u0939\u0930\u0923 (rsa algorithm example in hindi)<\/h3>\n
\n
\n\u0905\u092c \u0939\u092e\u093e\u0930\u093e \u090f\u0928\u094d\u0915\u094d\u0930\u093f\u092a\u094d\u091f \u0915\u093f\u092f\u093e \u0939\u0941\u0906 \u0921\u093e\u091f\u093e \u0939\u094b\u0917\u093e\u00a0 1394<\/li>\n<\/ul>\n\u0905\u092c \u0939\u092e 1394<\/strong> \u0915\u094b \u0921\u093f\u0915\u094d\u0930\u093f\u092a\u094d\u091f \u0915\u0930\u0947\u0902\u0917\u0947:<\/pre>\n
\n
\n\u0907\u0938\u0940\u0932\u093f\u090f \u0939\u092e\u093e\u0930\u0947 \u090f\u0928\u094d\u0915\u094d\u0930\u093f\u092a\u094d\u091f \u0915\u093f\u092f\u093e \u0939\u0941\u0906 \u0921\u093e\u091f\u093e \u0939\u094b\u0917\u093e 89<\/li>\n<\/ul>\n8 = H \u0914\u0930 I = 9 i.e. \"HI\".<\/strong><\/pre>\n
RSA \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u0915\u094b\u0921 (rsa algorithm code in hindi)<\/h3>\n
RSA \u0905\u0938\u093f\u092e\u0947\u091f\u094d\u0930\u093f\u0915 \u0915\u094d\u0930\u093f\u092a\u094d\u091f\u094b\u0917\u094d\u0930\u093e\u095e\u0940 \u0915\u093e \u092a\u094d\u0930\u094b\u0917\u094d\u0930\u093e\u092e <\/code><\/div>\n
\/\/ algorithm. For demonstration values are<\/code><\/div>\n
\/\/ relatively small compared to practical<\/code><\/div>\n
\/\/ application<\/code><\/div>\n
#include<stdio.h><\/code><\/div>\n
#include<math.h><\/code><\/div>\n
\/\/ Returns gcd of a and b<\/code><\/div>\n
int<\/code>
gcd(<\/code>
int<\/code>
a, <\/code>
int<\/code>
h)<\/code><\/div>\n
{<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
int<\/code>
temp;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
while<\/code>
(1)<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
{<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
temp = a%h;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
if<\/code>
(temp == 0)<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
return<\/code>
h;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
a = h;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
h = temp;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
}<\/code><\/div>\n
}<\/code><\/div>\n
\/\/ Code to demonstrate RSA algorithm<\/code><\/div>\n
int<\/code>
main()<\/code><\/div>\n
{<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ \u0926\u094b \u0930\u0948\u0902\u0921\u092e \u092a\u094d\u0930\u093e\u0907\u092e \u0938\u0902\u0916\u094d\u092f\u093e<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
p = 3;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
q = 7;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/\u092a\u092c\u094d\u0932\u093f\u0915 key \u0915\u093e \u092a\u0939\u0932\u093e \u092d\u093e\u0917
\n<\/code><\/div>\n\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
n = p*q;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ \u092a\u092c\u094d\u0932\u093f\u0915 key \u0915\u093e \u0926\u0942\u0938\u0930\u093e \u092d\u093e\u0917 \u092a\u0924\u093e \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ e stands for encrypt<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
e = 2;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
phi = (p-1)*(q-1);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
while<\/code>
(e < phi)<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
{<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ e must be co-prime to phi and<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ smaller than phi.<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
if<\/code>
(gcd(e, phi)==1)<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
break<\/code>
;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
else<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>
e++;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
}<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ Private key (d stands for decrypt)<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ choosing d such that it satisfies<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ d*e = 1 + k * totient<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
int<\/code>
k = 2;\u00a0 <\/code>
\/\/ A constant value<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
d = (1 + (k*phi))\/e;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ Message to be encrypted<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
msg = 20;<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
printf<\/code>
(<\/code>
\"Message data = %lf\"<\/code>
, msg);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ Encryption c = (msg ^ e) % n<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
c = <\/code>
pow<\/code>
(msg, e);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
c = <\/code>
fmod<\/code>
(c, n);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
printf<\/code>
(<\/code>
\"\\nEncrypted data = %lf\"<\/code>
, c);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
\/\/ Decryption m = (c ^ d) % n<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
double<\/code>
m = <\/code>
pow<\/code>
(c, d);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
m = <\/code>
fmod<\/code>
(m, n);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
printf<\/code>
(<\/code>
\"\\nOriginal Message Sent = %lf\"<\/code>
, m);<\/code><\/div>\n
\u00a0\u00a0\u00a0\u00a0<\/code>
return<\/code>
0;<\/code><\/div>\n
Message data = 12.000000\r\nEncrypted data = 3.000000\r\nOriginal Message Sent = 12.000000<\/pre>\n