{"id":376716,"date":"2024-05-21T21:01:01","date_gmt":"2024-05-21T21:01:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=376716"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T21:01:01","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=376716","title":{"rendered":"<span>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Streebog256 \u0438 Streebog512 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 RUST<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/957\/12b\/d52\/95712bd5255f2d6c7dd25fc600162f58.png\" alt=\"Streebog-preview.webp\" title=\"\u041f\u0440\u0435\u0432\u044c\u044e\" width=\"1344\" height=\"768\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/957\/12b\/d52\/95712bd5255f2d6c7dd25fc600162f58.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0435\u0432\u044c\u044e<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u0441\u043b\u0435\u0434\u043e\u043c \u0437\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0439 SHA, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u0438 \u0442\u043e\u0436\u0435 \u0432 \u0434\u0432\u0443\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445, \u0434\u043b\u044f 256 \u0438 512 \u0431\u0438\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430\u043c. \u0411\u043e\u043b\u0435\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f. <\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d \u0432 <a href=\"https:\/\/gitverse.ru\/digit4lsh4d0w\/cryptography\/content\/main\/hand-made-streebog\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitVerse<\/a>.<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/811639\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0448\u043b\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u0430 \u043c\u043d\u0435 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b SHA, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043d\u0430\u0448\u043b\u0438\u0441\u044c \u043f\u043e\u0438\u0441\u0442\u0438\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u044d\u0442\u043e!<\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u043b\u0435\u0436\u0430\u0442 5 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/55c\/c68\/a51\/55cc68a5135374dc396da4b71ede2b66.png\" alt=\"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.png\" title=\"\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438\" width=\"1210\" height=\"210\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/55c\/c68\/a51\/55cc68a5135374dc396da4b71ede2b66.png\"\/><\/p>\n<div><figcaption>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<ol>\n<li>\n<p>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 512 \u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<\/li>\n<li>\n<p>X-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>S-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>P-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>L-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>E-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f g.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u044b.<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h2>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 512 \u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/h2>\n<p>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 &#8212; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u0435\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0438 \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 <code>a<\/code> \u0438 <code>b<\/code> \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0431\u0430\u0439\u0442, \u0442\u043e \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439.<\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0430\u0439\u0442\u044b \u0438\u0437 <code>a<\/code> \u0438 <code>b<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0432\u0443\u0445\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/176\/96e\/97d\/17696e97d5cdb9bf158fd2688e76a4f7.png\" alt=\"\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430.png\" title=\"\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432\" width=\"1815\" height=\"410\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/176\/96e\/97d\/17696e97d5cdb9bf158fd2688e76a4f7.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/343\/239\/2bc\/3432392bc0598333c4c7aecf153e6765.png\" alt=\"\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435.png\" title=\"\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435\" width=\"2210\" height=\"410\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/343\/239\/2bc\/3432392bc0598333c4c7aecf153e6765.png\"\/><\/p>\n<div><figcaption>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043e\u0431\u0430 \u0447\u0438\u0441\u043b\u0430 \u043a\u0430\u043a \u0434\u0432\u0443\u0445\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0435. \u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0431\u0430\u0439\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430.<\/p>\n<p>\u041c\u044b \u0441\u043d\u043e\u0432\u0430 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043a\u043b\u0430\u0434\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 <code>result<\/code>.<\/p>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0443\u0447\u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f <code>a<\/code> \u0438 <code>b<\/code>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/db3\/438\/95a\/db343895ad1a4829f765e24cdba4cb15.png\" alt=\"\u0412\u0442\u043e\u0440\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f.png\" title=\"\u0412\u0442\u043e\u0440\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f\" width=\"3010\" height=\"410\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/db3\/438\/95a\/db343895ad1a4829f765e24cdba4cb15.png\"\/><\/p>\n<div><figcaption>\u0412\u0442\u043e\u0440\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0431\u0430\u0439\u0442, \u0442\u043e \u0435\u0441\u0442\u044c \u0441 \u043a\u043e\u043d\u0446\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn add_512(a: &amp;[u8; 64], b: &amp;[u8; 64], result: &amp;mut [u8; 64]) {     let mut temp: u16 = 0;     for i in (0..64).rev() {         temp = a[i] as u16 + b[i] as u16 + (temp >> 8);         result[i] = temp as u8;     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0427\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: <code>X<\/code>, <code>S<\/code>, <code>P<\/code>, <code>L<\/code>.<\/p>\n<h3>X-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>XOR<\/code> \u043d\u0430\u0434 512 \u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438. \u0422\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438 512 \u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 <code>a<\/code> \u0438 <code>b<\/code>, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <code>XOR<\/code> \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 <code>result<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_x(a: &amp;[u8; 64], b: &amp;[u8; 64], result: &amp;mut [u8; 64]) {     for (index, byte) in result.iter_mut().enumerate() {         *byte = a[index] ^ b[index];     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>S-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041c\u044b \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0430\u0439\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>result<\/code> \u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0442\u043e\u0442, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>PI<\/code> \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u043e\u043c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u043e\u0442 \u0431\u0430\u0439\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b80\/89c\/f04\/b8089cf0400f3b8a27debf16e5262137.png\" alt=\"S \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.png\" title=\"S \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\" width=\"2610\" height=\"610\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b80\/89c\/f04\/b8089cf0400f3b8a27debf16e5262137.png\"\/><\/p>\n<div><figcaption>S \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const PI: [u8; 256] = [     0xfc, 0xee, 0xdd, 0x11, 0xcf, 0x6e, 0x31, 0x16, 0xfb, 0xc4, 0xfa, 0xda, 0x23, 0xc5, 0x04, 0x4d,     0xe9, 0x77, 0xf0, 0xdb, 0x93, 0x2e, 0x99, 0xba, 0x17, 0x36, 0xf1, 0xbb, 0x14, 0xcd, 0x5f, 0xc1,     0xf9, 0x18, 0x65, 0x5a, 0xe2, 0x5c, 0xef, 0x21, 0x81, 0x1c, 0x3c, 0x42, 0x8b, 0x01, 0x8e, 0x4f,     0x05, 0x84, 0x02, 0xae, 0xe3, 0x6a, 0x8f, 0xa0, 0x06, 0x0b, 0xed, 0x98, 0x7f, 0xd4, 0xd3, 0x1f,     0xeb, 0x34, 0x2c, 0x51, 0xea, 0xc8, 0x48, 0xab, 0xf2, 0x2a, 0x68, 0xa2, 0xfd, 0x3a, 0xce, 0xcc,     0xb5, 0x70, 0x0e, 0x56, 0x08, 0x0c, 0x76, 0x12, 0xbf, 0x72, 0x13, 0x47, 0x9c, 0xb7, 0x5d, 0x87,     0x15, 0xa1, 0x96, 0x29, 0x10, 0x7b, 0x9a, 0xc7, 0xf3, 0x91, 0x78, 0x6f, 0x9d, 0x9e, 0xb2, 0xb1,     0x32, 0x75, 0x19, 0x3d, 0xff, 0x35, 0x8a, 0x7e, 0x6d, 0x54, 0xc6, 0x80, 0xc3, 0xbd, 0x0d, 0x57,     0xdf, 0xf5, 0x24, 0xa9, 0x3e, 0xa8, 0x43, 0xc9, 0xd7, 0x79, 0xd6, 0xf6, 0x7c, 0x22, 0xb9, 0x03,     0xe0, 0x0f, 0xec, 0xde, 0x7a, 0x94, 0xb0, 0xbc, 0xdc, 0xe8, 0x28, 0x50, 0x4e, 0x33, 0x0a, 0x4a,     0xa7, 0x97, 0x60, 0x73, 0x1e, 0x00, 0x62, 0x44, 0x1a, 0xb8, 0x38, 0x82, 0x64, 0x9f, 0x26, 0x41,     0xad, 0x45, 0x46, 0x92, 0x27, 0x5e, 0x55, 0x2f, 0x8c, 0xa3, 0xa5, 0x7d, 0x69, 0xd5, 0x95, 0x3b,     0x07, 0x58, 0xb3, 0x40, 0x86, 0xac, 0x1d, 0xf7, 0x30, 0x37, 0x6b, 0xe4, 0x88, 0xd9, 0xe7, 0x89,     0xe1, 0x1b, 0x83, 0x49, 0x4c, 0x3f, 0xf8, 0xfe, 0x8d, 0x53, 0xaa, 0x90, 0xca, 0xd8, 0x85, 0x61,     0x20, 0x71, 0x67, 0xa4, 0x2d, 0x2b, 0x09, 0x5b, 0xcb, 0x9b, 0x25, 0xd0, 0xbe, 0xe5, 0x6c, 0x52,     0x59, 0xa6, 0x74, 0xd2, 0xe6, 0xf4, 0xb4, 0xc0, 0xd1, 0x66, 0xaf, 0xc2, 0x39, 0x4b, 0x63, 0xb6, ]; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_s(result: &amp;mut [u8; 64]) {     result.iter_mut().for_each(|byte| *byte = PI[*byte as usize]); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>P-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>result<\/code> \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 <code>TAU<\/code>.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0432 Rust \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0442\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>result<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const TAU: [u8; 64] = [     0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,     0x01, 0x09, 0x11, 0x19, 0x21, 0x29, 0x31, 0x39,     0x02, 0x0a, 0x12, 0x1a, 0x22, 0x2a, 0x32, 0x3a,     0x03, 0x0b, 0x13, 0x1b, 0x23, 0x2b, 0x33, 0x3b,     0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c,     0x05, 0x0d, 0x15, 0x1d, 0x25, 0x2d, 0x35, 0x3d,     0x06, 0x0e, 0x16, 0x1e, 0x26, 0x2e, 0x36, 0x3e,     0x07, 0x0f, 0x17, 0x1f, 0x27, 0x2f, 0x37, 0x3f, ];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_p(result: &amp;mut [u8; 64]) {     let temp = result.clone();     for (index, position) in TAU.iter().enumerate() {         result[index] = temp[*position as usize];     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>L-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u0410 \u0432\u043e\u0442 \u044d\u0442\u043e \u0443\u0436\u0435 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043c\u044b \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u043c 512 \u0431\u0438\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <code>result<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 64 \u0431\u0430\u0439\u0442. \u041c\u044b \u0441\u043d\u043e\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 &#8212; \u0441\u043a\u043b\u0435\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0435 8 \u0431\u0430\u0439\u0442 \u0432 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 64 \u0447\u0438\u0441\u0435\u043b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c 8.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let input_u64: [u64; 8] = result.chunks_exact(8) .map(|bytes| u64::from_be_bytes(bytes.try_into().unwrap())) .collect::&lt;Vec&lt;u64>>() .try_into() .unwrap();<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e. \u0412\u0441\u0435\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 64 \u0431\u0438\u0442\u0430, \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>A<\/code> 64 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0438\u0442\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438 \u0435\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043c 1, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e <code>XOR<\/code> \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>buffers<\/code> \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0437 <code>A<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0431\u0438\u0442\u0430. \u0412\u0430\u0436\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>A<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f &#171;\u0432 \u043a\u043e\u043d\u0446\u0435&#187;, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 &#171;\u0432 \u043d\u0430\u0447\u0430\u043b\u0435&#187;.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">for i in 0..8 { for j in 0..64 { if (input_u64[i] >> j) &amp; 1 == 1 { buffers[i] ^= A[63 - j]; } } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c 64 \u0431\u0438\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0431\u0430\u0439\u0442\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let buffer: [u8; 64] = buffers.iter() .flat_map(|bytes| bytes.to_be_bytes()) .collect::&lt;Vec&lt;u8>>() .try_into() .unwrap();<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<ul>\n<li>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432 <code>buffers<\/code> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0443\u043b\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0430\u0439\u0442 \u0432 <code>A<\/code>.<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const A: [u64; 64] = [     0x8e20faa72ba0b470, 0x47107ddd9b505a38, 0xad08b0e0c3282d1c, 0xd8045870ef14980e,     0x6c022c38f90a4c07, 0x3601161cf205268d, 0x1b8e0b0e798c13c8, 0x83478b07b2468764,     0xa011d380818e8f40, 0x5086e740ce47c920, 0x2843fd2067adea10, 0x14aff010bdd87508,     0x0ad97808d06cb404, 0x05e23c0468365a02, 0x8c711e02341b2d01, 0x46b60f011a83988e,     0x90dab52a387ae76f, 0x486dd4151c3dfdb9, 0x24b86a840e90f0d2, 0x125c354207487869,     0x092e94218d243cba, 0x8a174a9ec8121e5d, 0x4585254f64090fa0, 0xaccc9ca9328a8950,     0x9d4df05d5f661451, 0xc0a878a0a1330aa6, 0x60543c50de970553, 0x302a1e286fc58ca7,     0x18150f14b9ec46dd, 0x0c84890ad27623e0, 0x0642ca05693b9f70, 0x0321658cba93c138,     0x86275df09ce8aaa8, 0x439da0784e745554, 0xafc0503c273aa42a, 0xd960281e9d1d5215,     0xe230140fc0802984, 0x71180a8960409a42, 0xb60c05ca30204d21, 0x5b068c651810a89e,     0x456c34887a3805b9, 0xac361a443d1c8cd2, 0x561b0d22900e4669, 0x2b838811480723ba,     0x9bcf4486248d9f5d, 0xc3e9224312c8c1a0, 0xeffa11af0964ee50, 0xf97d86d98a327728,     0xe4fa2054a80b329c, 0x727d102a548b194e, 0x39b008152acb8227, 0x9258048415eb419d,     0x492c024284fbaec0, 0xaa16012142f35760, 0x550b8e9e21f7a530, 0xa48b474f9ef5dc18,     0x70a6a56e2440598e, 0x3853dc371220a247, 0x1ca76e95091051ad, 0x0edd37c48a08a6d8,     0x07e095624504536c, 0x8d70c431ac02a736, 0xc83862965601dd1b, 0x641c314b2b8ee083, ];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_l(result: &amp;mut [u8; 64]) {     \/\/ \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 8 \u0431\u0430\u0439\u0442 \u0432 \u043e\u0434\u043d\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c     let input_u64: [u64; 8] = result.chunks_exact(8)         .map(|bytes| u64::from_be_bytes(bytes.try_into().unwrap()))         .collect::&lt;Vec&lt;u64>>()         .try_into()         .unwrap();      let mut buffers = [0u64; 8];      for i in 0..8 {         for j in 0..64 {             if (input_u64[i] >> j) &amp; 1 == 1 {                 buffers[i] ^= A[63 - j];             }         }     }      \/\/ \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e 8 \u0431\u0430\u0439\u0442     let buffer: [u8; 64] = buffers.iter()         .flat_map(|bytes| bytes.to_be_bytes())         .collect::&lt;Vec&lt;u8>>()         .try_into()         .unwrap();      for (index, byte) in buffer.iter().enumerate() {         result[index] = *byte;     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<hr\/>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 4 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b <code>C<\/code>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u041f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>X<\/code>, <code>S<\/code>, <code>P<\/code>, <code>L<\/code>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4fd\/013\/243\/4fd013243b81e0d7696be829776532d3.png\" alt=\"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439.png\" title=\"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439\" width=\"2010\" height=\"1010\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4fd\/013\/243\/4fd013243b81e0d7696be829776532d3.png\"\/><\/p>\n<div><figcaption>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const C: [[u8; 64]; 12] = [     [         0xb1, 0x08, 0x5b, 0xda, 0x1e, 0xca, 0xda, 0xe9, 0xeb, 0xcb, 0x2f, 0x81, 0xc0, 0x65, 0x7c, 0x1f,         0x2f, 0x6a, 0x76, 0x43, 0x2e, 0x45, 0xd0, 0x16, 0x71, 0x4e, 0xb8, 0x8d, 0x75, 0x85, 0xc4, 0xfc,         0x4b, 0x7c, 0xe0, 0x91, 0x92, 0x67, 0x69, 0x01, 0xa2, 0x42, 0x2a, 0x08, 0xa4, 0x60, 0xd3, 0x15,         0x05, 0x76, 0x74, 0x36, 0xcc, 0x74, 0x4d, 0x23, 0xdd, 0x80, 0x65, 0x59, 0xf2, 0xa6, 0x45, 0x07,     ],     [         0x6f, 0xa3, 0xb5, 0x8a, 0xa9, 0x9d, 0x2f, 0x1a, 0x4f, 0xe3, 0x9d, 0x46, 0x0f, 0x70, 0xb5, 0xd7,         0xf3, 0xfe, 0xea, 0x72, 0x0a, 0x23, 0x2b, 0x98, 0x61, 0xd5, 0x5e, 0x0f, 0x16, 0xb5, 0x01, 0x31,         0x9a, 0xb5, 0x17, 0x6b, 0x12, 0xd6, 0x99, 0x58, 0x5c, 0xb5, 0x61, 0xc2, 0xdb, 0x0a, 0xa7, 0xca,         0x55, 0xdd, 0xa2, 0x1b, 0xd7, 0xcb, 0xcd, 0x56, 0xe6, 0x79, 0x04, 0x70, 0x21, 0xb1, 0x9b, 0xb7,     ],     [         0xf5, 0x74, 0xdc, 0xac, 0x2b, 0xce, 0x2f, 0xc7, 0x0a, 0x39, 0xfc, 0x28, 0x6a, 0x3d, 0x84, 0x35,         0x06, 0xf1, 0x5e, 0x5f, 0x52, 0x9c, 0x1f, 0x8b, 0xf2, 0xea, 0x75, 0x14, 0xb1, 0x29, 0x7b, 0x7b,         0xd3, 0xe2, 0x0f, 0xe4, 0x90, 0x35, 0x9e, 0xb1, 0xc1, 0xc9, 0x3a, 0x37, 0x60, 0x62, 0xdb, 0x09,         0xc2, 0xb6, 0xf4, 0x43, 0x86, 0x7a, 0xdb, 0x31, 0x99, 0x1e, 0x96, 0xf5, 0x0a, 0xba, 0x0a, 0xb2,     ],     [         0xef, 0x1f, 0xdf, 0xb3, 0xe8, 0x15, 0x66, 0xd2, 0xf9, 0x48, 0xe1, 0xa0, 0x5d, 0x71, 0xe4, 0xdd,         0x48, 0x8e, 0x85, 0x7e, 0x33, 0x5c, 0x3c, 0x7d, 0x9d, 0x72, 0x1c, 0xad, 0x68, 0x5e, 0x35, 0x3f,         0xa9, 0xd7, 0x2c, 0x82, 0xed, 0x03, 0xd6, 0x75, 0xd8, 0xb7, 0x13, 0x33, 0x93, 0x52, 0x03, 0xbe,         0x34, 0x53, 0xea, 0xa1, 0x93, 0xe8, 0x37, 0xf1, 0x22, 0x0c, 0xbe, 0xbc, 0x84, 0xe3, 0xd1, 0x2e,     ],     [         0x4b, 0xea, 0x6b, 0xac, 0xad, 0x47, 0x47, 0x99, 0x9a, 0x3f, 0x41, 0x0c, 0x6c, 0xa9, 0x23, 0x63,         0x7f, 0x15, 0x1c, 0x1f, 0x16, 0x86, 0x10, 0x4a, 0x35, 0x9e, 0x35, 0xd7, 0x80, 0x0f, 0xff, 0xbd,         0xbf, 0xcd, 0x17, 0x47, 0x25, 0x3a, 0xf5, 0xa3, 0xdf, 0xff, 0x00, 0xb7, 0x23, 0x27, 0x1a, 0x16,         0x7a, 0x56, 0xa2, 0x7e, 0xa9, 0xea, 0x63, 0xf5, 0x60, 0x17, 0x58, 0xfd, 0x7c, 0x6c, 0xfe, 0x57,     ],     [         0xae, 0x4f, 0xae, 0xae, 0x1d, 0x3a, 0xd3, 0xd9, 0x6f, 0xa4, 0xc3, 0x3b, 0x7a, 0x30, 0x39, 0xc0,         0x2d, 0x66, 0xc4, 0xf9, 0x51, 0x42, 0xa4, 0x6c, 0x18, 0x7f, 0x9a, 0xb4, 0x9a, 0xf0, 0x8e, 0xc6,         0xcf, 0xfa, 0xa6, 0xb7, 0x1c, 0x9a, 0xb7, 0xb4, 0x0a, 0xf2, 0x1f, 0x66, 0xc2, 0xbe, 0xc6, 0xb6,         0xbf, 0x71, 0xc5, 0x72, 0x36, 0x90, 0x4f, 0x35, 0xfa, 0x68, 0x40, 0x7a, 0x46, 0x64, 0x7d, 0x6e,     ],     [         0xf4, 0xc7, 0x0e, 0x16, 0xee, 0xaa, 0xc5, 0xec, 0x51, 0xac, 0x86, 0xfe, 0xbf, 0x24, 0x09, 0x54,         0x39, 0x9e, 0xc6, 0xc7, 0xe6, 0xbf, 0x87, 0xc9, 0xd3, 0x47, 0x3e, 0x33, 0x19, 0x7a, 0x93, 0xc9,         0x09, 0x92, 0xab, 0xc5, 0x2d, 0x82, 0x2c, 0x37, 0x06, 0x47, 0x69, 0x83, 0x28, 0x4a, 0x05, 0x04,         0x35, 0x17, 0x45, 0x4c, 0xa2, 0x3c, 0x4a, 0xf3, 0x88, 0x86, 0x56, 0x4d, 0x3a, 0x14, 0xd4, 0x93,     ],     [         0x9b, 0x1f, 0x5b, 0x42, 0x4d, 0x93, 0xc9, 0xa7, 0x03, 0xe7, 0xaa, 0x02, 0x0c, 0x6e, 0x41, 0x41,         0x4e, 0xb7, 0xf8, 0x71, 0x9c, 0x36, 0xde, 0x1e, 0x89, 0xb4, 0x44, 0x3b, 0x4d, 0xdb, 0xc4, 0x9a,         0xf4, 0x89, 0x2b, 0xcb, 0x92, 0x9b, 0x06, 0x90, 0x69, 0xd1, 0x8d, 0x2b, 0xd1, 0xa5, 0xc4, 0x2f,         0x36, 0xac, 0xc2, 0x35, 0x59, 0x51, 0xa8, 0xd9, 0xa4, 0x7f, 0x0d, 0xd4, 0xbf, 0x02, 0xe7, 0x1e,     ],     [         0x37, 0x8f, 0x5a, 0x54, 0x16, 0x31, 0x22, 0x9b, 0x94, 0x4c, 0x9a, 0xd8, 0xec, 0x16, 0x5f, 0xde,         0x3a, 0x7d, 0x3a, 0x1b, 0x25, 0x89, 0x42, 0x24, 0x3c, 0xd9, 0x55, 0xb7, 0xe0, 0x0d, 0x09, 0x84,         0x80, 0x0a, 0x44, 0x0b, 0xdb, 0xb2, 0xce, 0xb1, 0x7b, 0x2b, 0x8a, 0x9a, 0xa6, 0x07, 0x9c, 0x54,         0x0e, 0x38, 0xdc, 0x92, 0xcb, 0x1f, 0x2a, 0x60, 0x72, 0x61, 0x44, 0x51, 0x83, 0x23, 0x5a, 0xdb,     ],     [         0xab, 0xbe, 0xde, 0xa6, 0x80, 0x05, 0x6f, 0x52, 0x38, 0x2a, 0xe5, 0x48, 0xb2, 0xe4, 0xf3, 0xf3,         0x89, 0x41, 0xe7, 0x1c, 0xff, 0x8a, 0x78, 0xdb, 0x1f, 0xff, 0xe1, 0x8a, 0x1b, 0x33, 0x61, 0x03,         0x9f, 0xe7, 0x67, 0x02, 0xaf, 0x69, 0x33, 0x4b, 0x7a, 0x1e, 0x6c, 0x30, 0x3b, 0x76, 0x52, 0xf4,         0x36, 0x98, 0xfa, 0xd1, 0x15, 0x3b, 0xb6, 0xc3, 0x74, 0xb4, 0xc7, 0xfb, 0x98, 0x45, 0x9c, 0xed,     ],     [         0x7b, 0xcd, 0x9e, 0xd0, 0xef, 0xc8, 0x89, 0xfb, 0x30, 0x02, 0xc6, 0xcd, 0x63, 0x5a, 0xfe, 0x94,         0xd8, 0xfa, 0x6b, 0xbb, 0xeb, 0xab, 0x07, 0x61, 0x20, 0x01, 0x80, 0x21, 0x14, 0x84, 0x66, 0x79,         0x8a, 0x1d, 0x71, 0xef, 0xea, 0x48, 0xb9, 0xca, 0xef, 0xba, 0xcd, 0x1d, 0x7d, 0x47, 0x6e, 0x98,         0xde, 0xa2, 0x59, 0x4a, 0xc0, 0x6f, 0xd8, 0x5d, 0x6b, 0xca, 0xa4, 0xcd, 0x81, 0xf3, 0x2d, 0x1b,     ],     [         0x37, 0x8e, 0xe7, 0x67, 0xf1, 0x16, 0x31, 0xba, 0xd2, 0x13, 0x80, 0xb0, 0x04, 0x49, 0xb1, 0x7a,         0xcd, 0xa4, 0x3c, 0x32, 0xbc, 0xdf, 0x1d, 0x77, 0xf8, 0x20, 0x12, 0xd4, 0x30, 0x21, 0x9f, 0x9b,         0x5d, 0x80, 0xef, 0x9d, 0x18, 0x91, 0xcc, 0x86, 0xe7, 0x1d, 0xa4, 0xaa, 0x88, 0xe1, 0x28, 0x52,         0xfa, 0xf4, 0x17, 0xd5, 0xd9, 0xb2, 0x1b, 0x99, 0x48, 0xbc, 0x92, 0x4a, 0xf1, 0x1b, 0xd7, 0x20,     ], ];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn key_schedule(keys: &amp;mut [u8; 64], iter_index: usize) {     transform_x(&amp;keys.clone(), &amp;C[iter_index], keys);     transform_s(keys);     transform_p(keys);     transform_l(keys); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>E-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>E-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0436\u0430\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0421\u0442\u0440\u0438\u0431\u043e\u0433. \u0417\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u0443\u0436\u0435 \u043d\u0435\u0442 \u0447\u0435\u0433\u043e-\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e &#8212; \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u043d\u0435\u0435, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u044b \u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b <code>C<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_e(     keys: &amp;mut [u8; 64],     block: &amp;[u8; 64],     state: &amp;mut [u8; 64] ) {     transform_x(&amp;block, &amp;keys, state);      for i in 0..12 {         transform_s(state);         transform_p(state);         transform_l(state);         key_schedule(keys, i);         transform_x(&amp;state.clone(), &amp;keys, state);     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f g<\/h2>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e! \u042d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u0443\u0436\u0435 \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044e \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u044b. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u043b\u044f\u043c\u0438 \u043d\u0430\u0448\u0438 \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 <code>keys<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_g(     n: &amp;[u8; 64],     hash: &amp;mut [u8; 64],     message: &amp;[u8; 64], ) {     let mut keys = [0u8; 64];     let mut temp = [0u8; 64];      transform_x(n, hash, &amp;mut keys);      transform_s(&amp;mut keys);     transform_p(&amp;mut keys);     transform_l(&amp;mut keys);      transform_e(&amp;mut keys, message, &amp;mut temp);      transform_x(&amp;temp.clone(), hash, &amp;mut temp);     transform_x(&amp;temp, &amp;message, hash); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<hr\/>\n<h2>\u041e\u0431\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0421\u0442\u0440\u0438\u0431\u043e\u0433<\/h2>\n<p>\u0423 \u043e\u0431\u043e\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0445\u044d\u0448\u0430, \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u044b \u0438 \u0432\u0437\u044f\u0442\u0438\u0438 \u043d\u0443\u0436\u043d\u043e\u0439 \u0435\u0435 \u0447\u0430\u0441\u0442\u0438 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435.<\/p>\n<p>\u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>N<\/code> \u0438 <code>Sigma<\/code>:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let mut n = [0u8; 64]; let mut sigma = [0u8; 64];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0443 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u044b\u0445 \u0438 \u043d\u0435 \u043f\u043e\u043b\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0434 \u0441\u0430\u043c \u0431\u043b\u043e\u043a \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let mut block_size = [0u8; 64]; let mut block: [u8; 64];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 <code>block<\/code> \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u0435\u043d 512 \u0431\u0438\u0442. \u0410 \u0432 <code>block_size<\/code> \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430 \u0432 \u0431\u0438\u0442\u0430\u0445.<br \/>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u043e\u0432\u043d\u043e \u043d\u0430 \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430, \u0442\u043e \u0435\u0441\u0442\u044c 1024 \u0431\u0438\u0442\u0430. \u0422\u043e\u0433\u0434\u0430 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 <code>block_size<\/code> \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e 512. \u0414\u0443\u043c\u0430\u044e \u0442\u0443\u0442 \u0432\u0441\u0435 \u044f\u0441\u043d\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/97a\/49c\/837\/97a49c837b3524579375135639840d72.png\" alt=\"\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e\u043b\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.png\" title=\"\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e\u043b\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"2610\" height=\"615\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/97a\/49c\/837\/97a49c837b3524579375135639840d72.png\"\/><\/p>\n<div><figcaption>\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e\u043b\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043d\u0430\u0441 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043d\u0430 \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 816 \u0431\u0438\u0442. \u0422\u043e\u0433\u0434\u0430 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 <code>block_size<\/code> \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c 512, \u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u0443\u0436\u0435 304.<br \/>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f <code>block_size<\/code> \u043e\u0442\u0432\u043e\u0434\u0438\u0442\u0441\u044f 64 \u0431\u0430\u0439\u0442\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f 2 \u0438\u0437 64 \u0431\u0430\u0439\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e7a\/d1b\/360\/e7ad1b3604d74a0b3cff4d4f421d5cf6.png\" alt=\"\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.png\" title=\"\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445\" width=\"2610\" height=\"610\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e7a\/d1b\/360\/e7ad1b3604d74a0b3cff4d4f421d5cf6.png\"\/><\/p>\n<div><figcaption>\u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>chunks<\/code> \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043a\u0443\u0441\u043a\u0438 \u043f\u043e 64 \u0431\u0430\u0439\u0442\u0430. \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043a\u0440\u0430\u0442\u043d\u0430 64, \u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c 64 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">for chunk in message.chunks(64) { ... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0443\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430 \u043f\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u044b\u0448\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let chunk_size = chunk.len() as u16 * 8; block_size[62..].copy_from_slice(&amp;chunk_size.to_be_bytes());<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0432\u044b \u0432\u0440\u044f\u0434 \u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u043b\u0438\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u0440\u0430\u0442\u043d\u0430 64 \u0431\u0430\u0439\u0442\u0430\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u043b\u043e\u043a\u0438. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u043b\u043e\u043a, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u043d\u0443\u043b\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u0443.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/109\/926\/e10\/109926e10de13d5b338064fb7c942d96.png\" alt=\"\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0430.png\" title=\"\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0430\" width=\"4210\" height=\"2010\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/109\/926\/e10\/109926e10de13d5b338064fb7c942d96.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0430<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">if chunk.len() != 64 { block = [0u8; 64]; block[..chunk.len()].copy_from_slice(chunk); block[chunk.len()] = 1; } else { ... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0431\u043b\u043e\u043a\u0430, \u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">block.reverse();<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435, \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043a\u0430\u043a \u0438 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 <code>A<\/code>. \u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f &#171;\u0432 \u043a\u043e\u043d\u0446\u0435&#187;, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 &#171;\u0432 \u043d\u0430\u0447\u0430\u043b\u0435&#187;. \u041f\u043e-\u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u0442\u0435\u0441\u0442\u0430\u0445 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0440\u0430\u0432\u043d\u043e\u043f\u0440\u0430\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u044b. \u041a\u043e\u0433\u0434\u0430 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u0430, \u0435\u0435 \u0442\u043e\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn streebog_core(message: &amp;[u8], hash: &amp;mut [u8; 64]) {     let mut n = [0u8; 64];     let mut sigma = [0u8; 64];      \/\/ \u041c\u0430\u0441\u0441\u0438\u0432, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430     let mut block_size = [0u8; 64];     let mut block: [u8; 64];      for chunk in message.chunks(64) {         \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430         let chunk_size = chunk.len() as u16 * 8;         block_size[62..].copy_from_slice(&amp;chunk_size.to_be_bytes());          \/\/ \u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0430         if chunk.len() != 64 {             block = [0u8; 64];             block[..chunk.len()].copy_from_slice(chunk);             block[chunk.len()] = 1;         } else {             block = chunk.try_into().unwrap();         }         block.reverse();          transform_g(&amp;n, hash, &amp;block);         add_512(&amp;n.clone(), &amp;block_size, &amp;mut n);         add_512(&amp;sigma.clone(), &amp;block, &amp;mut sigma);     }      transform_g(&amp;[0u8; 64], hash, &amp;mut n);     transform_g(&amp;[0u8; 64], hash,&amp;mut sigma);      hash.reverse(); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u0442\u0440\u0438\u0431\u043e\u0433 512 \u0438 256<\/h2>\n<p>\u041e\u0442\u043b\u0438\u0447\u0438\u0435, \u043a\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445:<\/p>\n<ol>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u043e\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f 512 \u0431\u0438\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u044f\u043c\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let mut hash = [0u8; 64];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0434\u043b\u044f 256 \u0431\u0438\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let mut hash = [1u8; 64];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c 512 \u0431\u0438\u0442\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u0443 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0430 256 \u0431\u0438\u0442\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 32 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 512 \u0431\u0438\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub fn streebog_512(message: &amp;[u8]) -> [u8; 64] {     let mut hash = [0u8; 64];      streebog_core(message, &amp;mut hash);      hash }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 256 \u0431\u0438\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub fn streebog_256(message: &amp;[u8]) -> [u8; 32] {     let mut hash = [1u8; 64];      streebog_core(message, &amp;mut hash);      hash[32..].try_into().unwrap() }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<hr\/>\n<h2>\u041e\u043f\u044b\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Perf<\/h2>\n<p>\u041a\u0430\u043a \u0438 SHA, \u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u043f\u0440\u043e\u0439\u0442\u0438 \u0442\u0435\u0441\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u044f \u043c\u043e\u0433 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u0440\u043d\u043e. \u0412 \u0445\u043e\u0434\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e, \u043f\u043e\u0440\u044f\u0434\u043a\u0430 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u0432 <code>Debug<\/code> \u0441\u0431\u043e\u0440\u043a\u0435 \u0438 1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0432 <code>Release<\/code> \u0441\u0431\u043e\u0440\u043a\u0435, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u0443 \u0434\u043b\u044f ~4MiB \u0432\u0438\u0434\u0435\u043e \u0444\u0430\u0439\u043b\u0430.<br \/>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0431\u0443\u0442\u044b\u043b\u043e\u0447\u043d\u044b\u0435 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0421\u043f\u043e\u0439\u043b\u0435\u0440: \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043d\u0435 \u0432\u044b\u0448\u043b\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c2f\/933\/91d\/c2f93391d12c413c857c999ab1667025.png\" alt=\"perf.webp\" title=\"Perf\" width=\"1397\" height=\"346\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c2f\/933\/91d\/c2f93391d12c413c857c999ab1667025.png\"\/><\/p>\n<div><figcaption>Perf<\/figcaption><\/div>\n<\/figure>\n<p><code>Perf<\/code> \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e 25% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u0441\u0435\u0431\u044f \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 <code>L<\/code> \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0435\u0433\u043e. \u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445 \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a \u0440\u0430\u0441\u0447\u0435\u0442\u0443 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u044b, \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0432 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434.<br \/>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0432\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043e\u043f\u044b\u0442 \u0438 \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p>\u041a\u0430\u043a \u043d\u0430\u0442\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443:<\/p>\n<ol>\n<li>\n<p><code>cargo build<\/code><\/p>\n<\/li>\n<li>\n<p><code>perf record -g .\/target\/debug\/hand-made-streebog<\/code><\/p>\n<\/li>\n<li>\n<p><code>perf report<\/code><\/p>\n<\/li>\n<\/ol>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<div class=\"persona\"><img decoding=\"async\" class=\"image persona__image\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/84f\/c2f\/cbe\/84fc2fcbe96123b8c4f9c49ad1ced051.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/84f\/c2f\/cbe\/84fc2fcbe96123b8c4f9c49ad1ced051.png\"\/><\/p>\n<h5 class=\"persona__heading\">digit4lsh4d0w<\/h5>\n<p>\u0410\u0432\u0442\u043e\u0440<\/p>\n<\/div>\n<p>\u041f\u0438\u0448\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0433\u0434\u0435-\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0448\u0438\u0431\u043a\u0438. \u041a\u0430\u043a \u0438 \u043f\u043e\u0441\u0442 \u043f\u0440\u043e SHA, \u044d\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u043a\u0430 \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u0438 \u0442\u0435\u0445, \u043a\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432.<\/p>\n<p>\u041b\u044e\u0431\u044b\u0435 \u043f\u0440\u0430\u0432\u043a\u0438, \u0441\u043e\u0432\u0435\u0442\u044b, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u0432\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043a \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0442\u0430\u043a \u0438 \u0432 <a href=\"https:\/\/gitverse.ru\/digit4lsh4d0w\/cryptography\/content\/main\/hand-made-streebog\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitVerse<\/a>.<\/p>\n<p>\u0415\u0449\u0435 \u0431\u044b \u044f \u0445\u043e\u0442\u0435\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044e HMAC. \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 (\u0438\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0440\u0435\u0430\u043a\u0446\u0438\u0438) \u0435\u0441\u043b\u0438 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.<\/p>\n<p><a href=\"https:\/\/t.me\/digit4lsh4d0w_channel\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u043e\u043d\u0441\u044b \u0438 \u0447\u0430\u0442 \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c<\/a>.<\/p>\n<hr\/>\n<h2>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\">WikiPedia<\/a>. \u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/188152\/\" rel=\"noopener noreferrer nofollow\">Habr<\/a>. \u041f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434, C# \u043a\u043e\u0434, \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/xakep.ru\/2016\/07\/20\/hash-gost-34-11-2012\/\" rel=\"noopener noreferrer nofollow\">\u0425\u0430\u043a\u0435\u0440<\/a>. C \u043a\u043e\u0434, \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f SHA512.<\/p>\n<\/li>\n<li>\n<p><a href=\"http:\/\/www.gost.cypherpunks.ru\/Russian.html\" rel=\"noopener noreferrer nofollow\">Cypherpunks Web<\/a>. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0438 \u0417\u0430\u043f\u0430\u0434\u043d\u044b\u0445 \u043a\u0440\u0438\u043f\u0442\u043e-\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. \u0415\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p><a href=\"http:\/\/www.git.cypherpunks.ru\/\" rel=\"noopener noreferrer nofollow\">Cypherpunks Git<\/a>. \u0412\u0435\u0431-\u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0434\u043b\u044f git \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 \u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u043c \u043a\u0440\u0438\u043f\u0442\u043e-\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c, \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/drobotun\/stribog\/\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. C \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/okazymyrov\/stribog\/\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>. C \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/hashing.tools\/streebog\/\" rel=\"noopener noreferrer nofollow\">Hashing Tools<\/a>. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0445\u044d\u0448-\u0441\u0443\u043c\u043c.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/816011\/\"> https:\/\/habr.com\/ru\/articles\/816011\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u0435\u0432\u044c\u044e<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u0441\u043b\u0435\u0434\u043e\u043c \u0437\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u0445\u044d\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0439 SHA, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u0438 \u0442\u043e\u0436\u0435 \u0432 \u0434\u0432\u0443\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445, \u0434\u043b\u044f 256 \u0438 512 \u0431\u0438\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430\u043c. \u0411\u043e\u043b\u0435\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f. <\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d \u0432 <a href=\"https:\/\/gitverse.ru\/digit4lsh4d0w\/cryptography\/content\/main\/hand-made-streebog\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitVerse<\/a>.<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/811639\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0448\u043b\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u0430 \u043c\u043d\u0435 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b SHA, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043d\u0430\u0448\u043b\u0438\u0441\u044c \u043f\u043e\u0438\u0441\u0442\u0438\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u044d\u0442\u043e!<\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u043b\u0435\u0436\u0430\u0442 5 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<ol>\n<li>\n<p>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 512 \u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<\/li>\n<li>\n<p>X-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>S-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>P-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>L-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>E-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0436\u0430\u0442\u0438\u044f g.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0445\u044d\u0448-\u0441\u0443\u043c\u043c\u044b.<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h2>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 512 \u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/h2>\n<p>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 &#8212; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u0435\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0438 \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 <code>a<\/code> \u0438 <code>b<\/code> \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0431\u0430\u0439\u0442, \u0442\u043e \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439.<\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0430\u0439\u0442\u044b \u0438\u0437 <code>a<\/code> \u0438 <code>b<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0432\u0443\u0445\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043e\u0431\u0430 \u0447\u0438\u0441\u043b\u0430 \u043a\u0430\u043a \u0434\u0432\u0443\u0445\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0435. \u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0431\u0430\u0439\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430.<\/p>\n<p>\u041c\u044b \u0441\u043d\u043e\u0432\u0430 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043a\u043b\u0430\u0434\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 <code>result<\/code>.<\/p>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0443\u0447\u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f <code>a<\/code> \u0438 <code>b<\/code>.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0442\u043e\u0440\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0431\u0430\u0439\u0442, \u0442\u043e \u0435\u0441\u0442\u044c \u0441 \u043a\u043e\u043d\u0446\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn add_512(a: &amp;[u8; 64], b: &amp;[u8; 64], result: &amp;mut [u8; 64]) {     let mut temp: u16 = 0;     for i in (0..64).rev() {         temp = a[i] as u16 + b[i] as u16 + (temp >> 8);         result[i] = temp as u8;     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0427\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u0421\u0442\u0440\u0438\u0431\u043e\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: <code>X<\/code>, <code>S<\/code>, <code>P<\/code>, <code>L<\/code>.<\/p>\n<h3>X-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>XOR<\/code> \u043d\u0430\u0434 512 \u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438. \u0422\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438 512 \u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 <code>a<\/code> \u0438 <code>b<\/code>, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <code>XOR<\/code> \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 <code>result<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_x(a: &amp;[u8; 64], b: &amp;[u8; 64], result: &amp;mut [u8; 64]) {     for (index, byte) in result.iter_mut().enumerate() {         *byte = a[index] ^ b[index];     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>S-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041c\u044b \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0430\u0439\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>result<\/code> \u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u0442\u043e\u0442, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>PI<\/code> \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u043e\u043c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u043e\u0442 \u0431\u0430\u0439\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>S \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const PI: [u8; 256] = [     0xfc, 0xee, 0xdd, 0x11, 0xcf, 0x6e, 0x31, 0x16, 0xfb, 0xc4, 0xfa, 0xda, 0x23, 0xc5, 0x04, 0x4d,     0xe9, 0x77, 0xf0, 0xdb, 0x93, 0x2e, 0x99, 0xba, 0x17, 0x36, 0xf1, 0xbb, 0x14, 0xcd, 0x5f, 0xc1,     0xf9, 0x18, 0x65, 0x5a, 0xe2, 0x5c, 0xef, 0x21, 0x81, 0x1c, 0x3c, 0x42, 0x8b, 0x01, 0x8e, 0x4f,     0x05, 0x84, 0x02, 0xae, 0xe3, 0x6a, 0x8f, 0xa0, 0x06, 0x0b, 0xed, 0x98, 0x7f, 0xd4, 0xd3, 0x1f,     0xeb, 0x34, 0x2c, 0x51, 0xea, 0xc8, 0x48, 0xab, 0xf2, 0x2a, 0x68, 0xa2, 0xfd, 0x3a, 0xce, 0xcc,     0xb5, 0x70, 0x0e, 0x56, 0x08, 0x0c, 0x76, 0x12, 0xbf, 0x72, 0x13, 0x47, 0x9c, 0xb7, 0x5d, 0x87,     0x15, 0xa1, 0x96, 0x29, 0x10, 0x7b, 0x9a, 0xc7, 0xf3, 0x91, 0x78, 0x6f, 0x9d, 0x9e, 0xb2, 0xb1,     0x32, 0x75, 0x19, 0x3d, 0xff, 0x35, 0x8a, 0x7e, 0x6d, 0x54, 0xc6, 0x80, 0xc3, 0xbd, 0x0d, 0x57,     0xdf, 0xf5, 0x24, 0xa9, 0x3e, 0xa8, 0x43, 0xc9, 0xd7, 0x79, 0xd6, 0xf6, 0x7c, 0x22, 0xb9, 0x03,     0xe0, 0x0f, 0xec, 0xde, 0x7a, 0x94, 0xb0, 0xbc, 0xdc, 0xe8, 0x28, 0x50, 0x4e, 0x33, 0x0a, 0x4a,     0xa7, 0x97, 0x60, 0x73, 0x1e, 0x00, 0x62, 0x44, 0x1a, 0xb8, 0x38, 0x82, 0x64, 0x9f, 0x26, 0x41,     0xad, 0x45, 0x46, 0x92, 0x27, 0x5e, 0x55, 0x2f, 0x8c, 0xa3, 0xa5, 0x7d, 0x69, 0xd5, 0x95, 0x3b,     0x07, 0x58, 0xb3, 0x40, 0x86, 0xac, 0x1d, 0xf7, 0x30, 0x37, 0x6b, 0xe4, 0x88, 0xd9, 0xe7, 0x89,     0xe1, 0x1b, 0x83, 0x49, 0x4c, 0x3f, 0xf8, 0xfe, 0x8d, 0x53, 0xaa, 0x90, 0xca, 0xd8, 0x85, 0x61,     0x20, 0x71, 0x67, 0xa4, 0x2d, 0x2b, 0x09, 0x5b, 0xcb, 0x9b, 0x25, 0xd0, 0xbe, 0xe5, 0x6c, 0x52,     0x59, 0xa6, 0x74, 0xd2, 0xe6, 0xf4, 0xb4, 0xc0, 0xd1, 0x66, 0xaf, 0xc2, 0x39, 0x4b, 0x63, 0xb6, ]; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_s(result: &amp;mut [u8; 64]) {     result.iter_mut().for_each(|byte| *byte = PI[*byte as usize]); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>P-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>result<\/code> \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 <code>TAU<\/code>.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0432 Rust \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0442\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>result<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const TAU: [u8; 64] = [     0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,     0x01, 0x09, 0x11, 0x19, 0x21, 0x29, 0x31, 0x39,     0x02, 0x0a, 0x12, 0x1a, 0x22, 0x2a, 0x32, 0x3a,     0x03, 0x0b, 0x13, 0x1b, 0x23, 0x2b, 0x33, 0x3b,     0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c,     0x05, 0x0d, 0x15, 0x1d, 0x25, 0x2d, 0x35, 0x3d,     0x06, 0x0e, 0x16, 0x1e, 0x26, 0x2e, 0x36, 0x3e,     0x07, 0x0f, 0x17, 0x1f, 0x27, 0x2f, 0x37, 0x3f, ];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_p(result: &amp;mut [u8; 64]) {     let temp = result.clone();     for (index, position) in TAU.iter().enumerate() {         result[index] = temp[*position as usize];     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>L-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u0410 \u0432\u043e\u0442 \u044d\u0442\u043e \u0443\u0436\u0435 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043c\u044b \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u043c 512 \u0431\u0438\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <code>result<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 64 \u0431\u0430\u0439\u0442. \u041c\u044b \u0441\u043d\u043e\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 &#8212; \u0441\u043a\u043b\u0435\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0435 8 \u0431\u0430\u0439\u0442 \u0432 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 64 \u0447\u0438\u0441\u0435\u043b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c 8.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let input_u64: [u64; 8] = result.chunks_exact(8) .map(|bytes| u64::from_be_bytes(bytes.try_into().unwrap())) .collect::&lt;Vec&lt;u64>>() .try_into() .unwrap();<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e. \u0412\u0441\u0435\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 64 \u0431\u0438\u0442\u0430, \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>A<\/code> 64 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0438\u0442\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438 \u0435\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043c 1, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e <code>XOR<\/code> \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>buffers<\/code> \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0437 <code>A<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0431\u0438\u0442\u0430. \u0412\u0430\u0436\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>A<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f &#171;\u0432 \u043a\u043e\u043d\u0446\u0435&#187;, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 &#171;\u0432 \u043d\u0430\u0447\u0430\u043b\u0435&#187;.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">for i in 0..8 { for j in 0..64 { if (input_u64[i] >> j) &amp; 1 == 1 { buffers[i] ^= A[63 - j]; } } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c 64 \u0431\u0438\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u0431\u0430\u0439\u0442\u044b.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">let buffer: [u8; 64] = buffers.iter() .flat_map(|bytes| bytes.to_be_bytes()) .collect::&lt;Vec&lt;u8>>() .try_into() .unwrap();<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<ul>\n<li>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432 <code>buffers<\/code> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0443\u043b\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0430\u0439\u0442 \u0432 <code>A<\/code>.<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const A: [u64; 64] = [     0x8e20faa72ba0b470, 0x47107ddd9b505a38, 0xad08b0e0c3282d1c, 0xd8045870ef14980e,     0x6c022c38f90a4c07, 0x3601161cf205268d, 0x1b8e0b0e798c13c8, 0x83478b07b2468764,     0xa011d380818e8f40, 0x5086e740ce47c920, 0x2843fd2067adea10, 0x14aff010bdd87508,     0x0ad97808d06cb404, 0x05e23c0468365a02, 0x8c711e02341b2d01, 0x46b60f011a83988e,     0x90dab52a387ae76f, 0x486dd4151c3dfdb9, 0x24b86a840e90f0d2, 0x125c354207487869,     0x092e94218d243cba, 0x8a174a9ec8121e5d, 0x4585254f64090fa0, 0xaccc9ca9328a8950,     0x9d4df05d5f661451, 0xc0a878a0a1330aa6, 0x60543c50de970553, 0x302a1e286fc58ca7,     0x18150f14b9ec46dd, 0x0c84890ad27623e0, 0x0642ca05693b9f70, 0x0321658cba93c138,     0x86275df09ce8aaa8, 0x439da0784e745554, 0xafc0503c273aa42a, 0xd960281e9d1d5215,     0xe230140fc0802984, 0x71180a8960409a42, 0xb60c05ca30204d21, 0x5b068c651810a89e,     0x456c34887a3805b9, 0xac361a443d1c8cd2, 0x561b0d22900e4669, 0x2b838811480723ba,     0x9bcf4486248d9f5d, 0xc3e9224312c8c1a0, 0xeffa11af0964ee50, 0xf97d86d98a327728,     0xe4fa2054a80b329c, 0x727d102a548b194e, 0x39b008152acb8227, 0x9258048415eb419d,     0x492c024284fbaec0, 0xaa16012142f35760, 0x550b8e9e21f7a530, 0xa48b474f9ef5dc18,     0x70a6a56e2440598e, 0x3853dc371220a247, 0x1ca76e95091051ad, 0x0edd37c48a08a6d8,     0x07e095624504536c, 0x8d70c431ac02a736, 0xc83862965601dd1b, 0x641c314b2b8ee083, ];<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">fn transform_l(result: &amp;mut [u8; 64]) {     \/\/ \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 8 \u0431\u0430\u0439\u0442 \u0432 \u043e\u0434\u043d\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c     let input_u64: [u64; 8] = result.chunks_exact(8)         .map(|bytes| u64::from_be_bytes(bytes.try_into().unwrap()))         .collect::&lt;Vec&lt;u64>>()         .try_into()         .unwrap();      let mut buffers = [0u64; 8];      for i in 0..8 {         for j in 0..64 {             if (input_u64[i] >> j) &amp; 1 == 1 {                 buffers[i] ^= A[63 - j];             }         }     }      \/\/ \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e 8 \u0431\u0430\u0439\u0442     let buffer: [u8; 64] = buffers.iter()         .flat_map(|bytes| bytes.to_be_bytes())         .collect::&lt;Vec&lt;u8>>()         .try_into()         .unwrap();      for (index, byte) in buffer.iter().enumerate() {         result[index] = *byte;     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<hr\/>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 4 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b <code>C<\/code>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u041f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>X<\/code>, <code>S<\/code>, <code>P<\/code>, <code>L<\/code>.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0443\u043d\u0434\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"rust\">pub const C: [[u8; 64]; 12] = [     [         0xb1, 0x08, 0x5b, 0xda, 0x1e, 0xca, 0xda, 0xe9, 0xeb, 0xcb, 0x2f, 0x81, 0xc0, 0x65, 0x7c, 0x1f,         0x2f, 0x6a, 0x76, 0x43, 0x2e, 0x45, 0xd0, 0x16, 0x71, 0x4e, 0xb8, 0x8d, 0x75, 0x85, 0xc4, 0xfc,         0x4b, 0x7c, 0xe0, 0x91, 0x92, 0x67, 0x69, 0x01, 0xa2, 0x42, 0x2a, 0x08, 0xa4, 0x60, 0xd3, 0x15,         0x05, 0x76, 0x74, 0x36, 0xcc, 0x74, 0x4d, 0x23, 0xdd, 0x80, 0x65, 0x59, 0xf2, 0xa6, 0x45, 0x07,     ],     [         0x6f, 0xa3, 0xb5, 0x8a, 0xa9, 0x9d, 0x2f, 0x1a, 0x4f, 0xe3, 0x9d, 0x46, 0x0f, 0x70, 0xb5, 0xd7,         0xf3, 0xfe, 0xea, 0x72, 0x0a, 0x23, 0x2b, 0x98, 0x61, 0xd5, 0x5e, 0x0f, 0x16, 0xb5, 0x01, 0x31,         0x9a, 0xb5, 0x17, 0x6b, 0x12, 0xd6, 0x99, 0x58, 0x5c, 0xb5, 0x61, 0xc2, 0xdb, 0x0a, 0xa7, 0xca,         0x55, 0xdd, 0xa2, 0x1b, 0xd7, 0xcb, 0xcd, 0x56, 0xe6, 0x79, 0x04, 0x70, 0x21, 0xb1, 0x9b, 0xb7,     ],     [         0xf5, 0x74, 0xdc, 0xac, 0x2b, 0xce, 0x2f, 0xc7, 0x0a, 0x39, 0xfc, 0x28, 0x6a, 0x3d, 0x84, <\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-376716","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376716","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=376716"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376716\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=376716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=376716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=376716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}