{"id":264139,"date":"2015-08-24T12:00:02","date_gmt":"2015-08-24T08:00:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=264139"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=264139","title":{"rendered":"\u041a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f \u043d\u0430 Python: \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0445 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043a\u0435\u0442\u0430 PyCrypto"},"content":{"rendered":"<p>             <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/972\/ff9\/1f1\/972ff91f120740f4b86aafc1867c35c3.jpg\"\/><\/p>\n<p>  \u0414\u043e\u043b\u0433\u043e \u043c\u0443\u0447\u0438\u043b\u0441\u044f \u0441 <a href=\"https:\/\/www.dlitz.net\/software\/pycrypto\/api\/current\/\">PyCrypto<\/a>, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u043f\u043e\u043b\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439_\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a>: <\/p>\n<p>  \u042d\u0442\u0430\u043f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438: <\/p>\n<p>  1. \u0410\u043b\u0438\u0441\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f_\u043f\u043e\u0434\u043f\u0438\u0441\u044c\">\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e<\/a> \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u0435\u0435 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041a\u043b\u044e\u0447_(\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f)\">\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c<\/a> \u0411\u043e\u0431\u0430 (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041a\u0440\u0438\u043f\u0442\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430_\u0441_\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c_\u043a\u043b\u044e\u0447\u043e\u043c\">\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c<\/a>). <br \/>  2. \u0410\u043b\u0438\u0441\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u044d\u0442\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0421\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0435_\u043a\u0440\u0438\u043f\u0442\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b\">\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/a>). <br \/>  3. \u0421\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0411\u043e\u0431\u0430 (\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c). <br \/>  \u0410\u043b\u0438\u0441\u0430 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0411\u043e\u0431\u0443 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447. <\/p>\n<p>  \u042d\u0442\u0430\u043f \u043f\u0440\u0438\u0451\u043c\u0430: <\/p>\n<p>  \u0411\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0410\u043b\u0438\u0441\u044b, \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447. <br \/>  4. \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441\u0432\u043e\u0438\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c. <br \/>  5. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0410\u043b\u0438\u0441\u044b. <br \/>  6. \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0410\u043b\u0438\u0441\u044b. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0413\u0438\u0431\u0440\u0438\u0434\u043d\u0430\u044f_\u043a\u0440\u0438\u043f\u0442\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430\">\u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0414\u043b\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Advanced_Encryption_Standard\">AES<\/a> (\u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e) \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447.<\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u043a\u043b\u044e\u0447 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0442 128 \u0434\u043e 512 \u0431\u0438\u0442 (\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430). \u0417\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0411\u043b\u043e\u0447\u043d\u044b\u0439_\u0448\u0438\u0444\u0440\">\u0431\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0420\u0435\u0436\u0438\u043c_\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f\">\u0440\u0435\u0436\u0438\u043c \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0420\u0435\u0436\u0438\u043c_\u0441\u0446\u0435\u043f\u043b\u0435\u043d\u0438\u044f_\u0431\u043b\u043e\u043a\u043e\u0432_\u0448\u0438\u0444\u0440\u043e\u0442\u0435\u043a\u0441\u0442\u0430\">CBC<\/a>), \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0434\u043b\u0438\u043d\u043e\u0439, \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0435\u0439 \u0434\u043b\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0430. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0440\u0438\u043f\u0442\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/RSA\">RSA<\/a>.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439, \u0435\u0433\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u2014 \u044d\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u044e\u0447 \u0432 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435. \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043a\u043b\u044e\u0447 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438 \u0432\u0441\u0451 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. <\/p>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u044b \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u0410\u043b\u0438\u0441\u044b \u0438 \u0411\u043e\u0431\u0430.<\/p>\n<pre><code>from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA  # key generation privatekey = RSA.generate(2048) f = open('c:\\cipher\\\\alisaprivatekey.txt','wb') f.write(bytes(privatekey.exportKey('PEM'))); f.close() publickey = privatekey.publickey() f = open('c:\\cipher\\\\alisapublickey.txt','wb') f.write(bytes(publickey.exportKey('PEM'))); f.close()  privatekey = RSA.generate(2048) f = open('c:\\cipher\\\\bobprivatekey.txt','wb') f.write(bytes(privatekey.exportKey('PEM'))); f.close() publickey = privatekey.publickey() f = open('c:\\cipher\\\\bobpublickey.txt','wb') f.write(bytes(publickey.exportKey('PEM'))); f.close() <\/code><\/pre>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 RSA \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0439, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 n \u0432 2048 \u0431\u0438\u0442.<\/p>\n<p>  \u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 RSA \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u044b, \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0446\u0438\u0444\u0440\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e \u0441\u0432\u043e\u044e \u0446\u0438\u0444\u0440\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c, \u0430 \u0437\u0430\u0442\u0435\u043c \u2014 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0430\u0440\u0443 (\u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0438\u0437 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043a \u043d\u0435\u043c\u0443) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044e. \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0430\u0432\u0442\u043e\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0435\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430. <\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044f\">\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u0437\u044f\u0442\u043e\u0439 \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430: <\/p>\n<p>  1. \u041f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0435\u0433\u043e \u0445\u0435\u0448\u0430. <br \/>  2. \u041f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043a\u0440\u0438\u043f\u0442\u043e\u0441\u0442\u043e\u0439\u043a\u043e\u0441\u0442\u0438. \u041a\u0440\u0438\u043f\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447, \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043f\u043e\u0434 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434 \u0435\u0433\u043e \u0445\u0435\u0448. <br \/>  3. \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0431\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0425\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442. <\/p>\n<p>  \u0425\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u043b\u0438 \u0438\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b (\u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u043f\u0440\u043e\u043e\u0431\u0440\u0430\u0437\u043e\u043c) \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0435\u0435 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439, \u043e\u0431\u044b\u0447\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0439, \u0434\u043b\u0438\u043d\u043d\u044b (\u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438). \u0421\u043c\u044b\u0441\u043b \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430 \u043f\u0440\u043e\u043e\u0431\u0440\u0430\u0437\u0430 \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u043e\u0431\u0440\u0430\u0437\u044b \u043f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u041e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438: \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e \u043f\u0440\u043e\u043e\u0431\u0440\u0430\u0437\u0443, \u043d\u043e \u0442\u0440\u0443\u0434\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u043e\u0431\u0440\u0430\u0437, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u043d\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0435. \u0425\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439, \u0442\u0430\u0439\u043d\u044b \u0435\u0435 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0435\u0435 \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>  \u041e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f H(M) \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b \u041c \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b h. <\/p>\n<p>  h = H(M), \u0433\u0434\u0435 h \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 m <\/p>\n<p>  \u041c\u043d\u043e\u0433\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b \u043f\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u044b, \u043d\u043e \u0443 \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u0438\u0445 \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438: <\/p>\n<p>  \u0417\u043d\u0430\u044f \u041c, \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c h <br \/>  \u0417\u043d\u0430\u044f H, \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u041c, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e H(M) = h <br \/>  \u0417\u043d\u0430\u044f \u041c, \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u041c&#8217;, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e H(M) = H(M&#8217;) <\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430:<\/p>\n<p>  1. \u0410\u043b\u0438\u0441\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0439 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u0435\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0411\u043e\u0431\u0430 (\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c). <\/p>\n<pre><code>from Crypto.Hash import MD5 from Crypto.PublicKey import RSA from Crypto import Random from Crypto.Cipher import PKCS1_OAEP   # the creation of signature f = open('c:\\cipher\\plaintext.txt','rb') plaintext = f.read(); f.close() randomnum = Random.new().read(16) privatekey = RSA.importKey(open('c:\\cipher\\\\alisaprivatekey.txt','rb').read()) myhash = MD5.new(plaintext).hexdigest() signature = privatekey.sign(myhash, randomnum) # type tuple  # check long signature signature = str(signature); a = len(signature); b = 16; c = 'aaaaaaaaaaaaaa'; i = 0 while a%b != 0: \ti += 1 \tsignature = signature + 'a' \ta = len(signature)  if i &gt; 0: \tif i == 1: \t\tsignature = signature + c + '17' \tif i &gt; 1: \t\tif i &lt; 10: \t\t\tnum = '0' \t\t\tsignature = signature[0:-2] + num + str(i) \tif i &gt; 9: \t\tsignature = signature[0:-2] + str(i)  # signature encrypt publickey = RSA.importKey(open('c:\\cipher\\\\bobpublickey.txt','rb').read()) cipherrsa = PKCS1_OAEP.new(publickey)  a = len(signature); b = 16; c = a\/b; i = 0; ii = -16; iii = 0  while i &lt; c: \ti += 1 \tii += 16 \tiii += 16 \tif i == 1: \t\tsig = cipherrsa.encrypt(signature[0:16]) \tif i &gt; 1: \t\tsig = sig + cipherrsa.encrypt(signature[ii:iii])  f = open('c:\\cipher\\signature.txt','wb') f.write(bytes(sig)); f.close() <\/code><\/pre>\n<p>  \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442 \u0432 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043a\u0440\u0430\u0442\u043d\u043e 16, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0431\u043b\u043e\u043a check long signature, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0432 \u043a\u043e\u043d\u0435\u0446 \u043f\u043e\u0434\u043f\u0438\u0441\u0438. \u041f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b. \u041f\u0440\u0438 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u043b\u043e\u043a \u043f\u043e 16 \u0431\u0430\u0439\u0442 \u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0446\u0438\u043a\u043b. \u041f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440_\u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445_\u0447\u0438\u0441\u0435\u043b\">\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/a>) \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u0430 AES (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f randomnum) \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 read \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u0438\u043d\u0443 \u043a\u0440\u0430\u0442\u043d\u0443\u044e 128 \u0431\u0438\u0442 \u0438\u043b\u0438 16 \u0431\u0430\u0439\u0442. <\/p>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b 128-\u0431\u0438\u0442\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/MD5#MD5-.D1.85.D0.B5.D1.88.D0.B8\">MD5<\/a>. <\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 \u043a\u043e\u0434 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430:<\/p>\n<p>  2. \u0410\u043b\u0438\u0441\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u044d\u0442\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430).<br \/>  3. \u0421\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0411\u043e\u0431\u0430 (\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c).<\/p>\n<pre><code>from Crypto.Cipher import AES from Crypto import Random from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA  # test long message file f = open('c:\\cipher\\plaintext.txt','rb') plaintext = f.read(); f.close()  a = len(plaintext); b = 16; i = 0 while a%b != 0: \ti += 1 \tplaintext = plaintext + 'a' \ta = len(plaintext)  if i &gt; 0: \tif i &lt; 10: \t\tnum = '0' \t\tplaintext = plaintext[0:-2] + num + str(i) \telse: \t\tplaintext = plaintext[0:-2] + str(i)  # the creation of a session key sessionkey = Random.new().read(32) # 256 bit  # the encryption AES of the message iv = Random.new().read(16) # 128 bit obj = AES.new(sessionkey, AES.MODE_CBC, iv) ciphertext = iv + obj.encrypt(plaintext)  f = open('c:\\cipher\\plaintext.txt','wb') f.write(bytes(ciphertext)); f.close()  # the encryption RSA of the session key publickey = RSA.importKey(open('c:\\cipher\\\\bobpublickey.txt','rb').read()) cipherrsa = PKCS1_OAEP.new(publickey) sessionkey = cipherrsa.encrypt(sessionkey)  f = open('c:\\cipher\\sessionkey.txt','wb') f.write(bytes(sessionkey)); f.close() <\/code><\/pre>\n<p>  \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043a\u0440\u0430\u0442\u043d\u043e 16. \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e \u044f \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043b \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 256 \u0431\u0438\u0442. \u041d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043b \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0411\u043e\u0431\u0430.<\/p>\n<p>  \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 CBC \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0420\u0435\u0436\u0438\u043c_\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f#Initialization_vector_.28IV.29\">\u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (IV)<\/a> (\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f iv).<\/p>\n<p>  \u0412 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (IV) \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0438\u043b\u0438 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u0434 \u0442\u0435\u043c \u0436\u0435 \u043a\u043b\u044e\u0447\u043e\u043c \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0443 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0412\u0435\u043a\u0442\u043e\u0440 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0410\u043b\u0438\u0441\u0430 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0411\u043e\u0431\u0443 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447. <\/p>\n<p>  \u0411\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0410\u043b\u0438\u0441\u044b, \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447. <\/p>\n<p>  4. \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441\u0432\u043e\u0438\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c.<br \/>  5. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0410\u043b\u0438\u0441\u044b.<\/p>\n<pre><code>from Crypto.Cipher import AES from Crypto import Random from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA  # the decryption session key privatekey = RSA.importKey(open('c:\\cipher\\\\bobprivatekey.txt','rb').read()) cipherrsa = PKCS1_OAEP.new(privatekey) f = open('c:\\cipher\\sessionkey.txt','rb') sessionkey = f.read(); f.close() sessionkey = cipherrsa.decrypt(sessionkey)   # the decryption and reception of the IV vector f = open('c:\\cipher\\plaintext.txt','rb') ciphertext = f.read(); f.close() iv = ciphertext[:16]  obj = AES.new(sessionkey, AES.MODE_CBC, iv) plaintext = obj.decrypt(ciphertext)  f = open('c:\\cipher\\plaintext.txt','wb') f.write(bytes(plaintext[16:])); f.close()  # remove unnecessary f = open('c:\\cipher\\plaintext.txt','rb') plaintext = f.read(); f.close()  num = plaintext[-2:]  f = open('c:\\cipher\\plaintext.txt','wb') f.write(bytes(plaintext[:-int(num)])); f.close() <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u044b\u0445 16 \u0431\u0430\u0439\u0442\u0430\u0445 \u0448\u0438\u0444\u0440\u043e\u0442\u0435\u043a\u0441\u0442\u0430.<br \/>  \u0412 \u0431\u043b\u043e\u043a\u0435 remove unnecessary \u043c\u044b \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0443\u0436\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0435\u0433\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0434\u0438\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043a\u0440\u0430\u0442\u043d\u0430 16).<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0438 \u0441\u0430\u043c\u044b\u0439 \u0442\u0440\u0443\u0434\u043d\u044b\u0439 \u044d\u0442\u0430\u043f:<\/p>\n<p>  6. \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0410\u043b\u0438\u0441\u044b. <\/p>\n<pre><code>from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA from Crypto.Hash import MD5  # decrypt the signature f = open('c:\\cipher\\signature.txt','rb') signature = f.read(); f.close()  privatekey = RSA.importKey(open('c:\\cipher\\\\bobprivatekey.txt','rb').read()) cipherrsa = PKCS1_OAEP.new(privatekey)  a = len(signature); b = 256; c = a\/b; i = 0; ii = -256; iii = 0 while i &lt; c: \ti += 1 \tii += 256 \tiii += 256 \tif i == 1: \t\tsig = cipherrsa.decrypt(signature[0:256]) \tif i &gt; 1: \t\tsig = sig + cipherrsa.decrypt(signature[ii:iii])  signature = sig num = signature[-2:] signature = signature[:-int(num)]  # signature verification f = open('c:\\cipher\\plaintext.txt','rb') plaintext = f.read(); f.close() publickey = RSA.importKey(open('c:\\cipher\\\\alisapublickey.txt','rb').read()) myhash = MD5.new(plaintext).hexdigest()  t = signature t = t[1:-3] t = int(t) t = (t,) test = publickey.verify(myhash, t) test = signature + str(test)  f = open('c:\\cipher\\signature.txt','wb') f.write(bytes(test)); f.close() <\/code><\/pre>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0435 16 \u0431\u0430\u0439\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0432 256 \u0431\u0430\u0439\u0442 \u0448\u0438\u0444\u0440\u043e\u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0434\u0435\u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0430\u043c\u0438 \u043f\u043e 256 \u0431\u0430\u0439\u0442. \u041f\u043e\u0434\u043f\u0438\u0441\u044c \u044d\u0442\u043e \u043a\u043e\u0440\u0442\u0435\u0436, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 signature \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u0440\u0442\u0435\u0436. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438, \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430 signature.txt \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f True \u2014 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u043b\u0438 False \u0435\u0441\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0431\u044b\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e.<\/p>\n<p>  \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c RSA \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f\">\u0437\u0430\u0434\u0430\u0447\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/a> \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f_\u0446\u0435\u043b\u044b\u0445_\u0447\u0438\u0441\u0435\u043b\">\u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/a> \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u044b\u0441\u0442\u0440\u043e. \u0424\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044f\u044f_\u0444\u0443\u043d\u043a\u0446\u0438\u044f\">\u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f, \u043d\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0442\u0440\u0443\u0434\u043e\u043c. \u0422\u043e \u0435\u0441\u0442\u044c, \u0437\u043d\u0430\u044f x \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c f(x), \u043d\u043e \u043f\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 f(x) \u043d\u0435\u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c x. \u0417\u0434\u0435\u0441\u044c, \u00ab\u043d\u0435\u043b\u0435\u0433\u043a\u043e\u00bb \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f x \u043f\u043e f(x) \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u043b\u0435\u0442, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0430\u0434 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0431\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u043c\u0438\u0440\u0430. <\/p>\n<p>  \u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430:<br \/>  \u0411\u0440\u044e\u0441 \u0428\u043d\u0430\u0439\u0435\u0440 \u2014 \u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u0430\u044f \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f             <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/265309\/\"> http:\/\/habrahabr.ru\/post\/265309\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>             <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/972\/ff9\/1f1\/972ff91f120740f4b86aafc1867c35c3.jpg\"\/><\/p>\n<p>  \u0414\u043e\u043b\u0433\u043e \u043c\u0443\u0447\u0438\u043b\u0441\u044f \u0441 <a href=\"https:\/\/www.dlitz.net\/software\/pycrypto\/api\/current\/\">PyCrypto<\/a>, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u043f\u043e\u043b\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439_\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a>: <\/p>\n<p>  \u042d\u0442\u0430\u043f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438: <\/p>\n<p>  1. \u0410\u043b\u0438\u0441\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f_\u043f\u043e\u0434\u043f\u0438\u0441\u044c\">\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e<\/a> \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u0435\u0435 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041a\u043b\u044e\u0447_(\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f)\">\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c<\/a> \u0411\u043e\u0431\u0430 (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u041a\u0440\u0438\u043f\u0442\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430_\u0441_\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c_\u043a\u043b\u044e\u0447\u043e\u043c\">\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c<\/a>). <br \/>  2. \u0410\u043b\u0438\u0441\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u044d\u0442\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0421\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0435_\u043a\u0440\u0438\u043f\u0442\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b\">\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/a>). <br \/>  3. \u0421\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0411\u043e\u0431\u0430 (\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c). <br \/>  \u0410\u043b\u0438\u0441\u0430 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0411\u043e\u0431\u0443 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447. <\/p>\n<p>  \u042d\u0442\u0430\u043f \u043f\u0440\u0438\u0451\u043c\u0430: <\/p>\n<p>  \u0411\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0410\u043b\u0438\u0441\u044b, \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447. <br \/>  4. \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441\u0432\u043e\u0438\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c. <br \/>  5. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0435\u0430\u043d\u0441\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0410\u043b\u0438\u0441\u044b. <br \/>  6. \u0411\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0410\u043b\u0438\u0441\u044b.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-264139","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264139"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264139\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}