{"id":2103,"date":"2023-12-14T21:31:28","date_gmt":"2023-12-14T13:31:28","guid":{"rendered":"https:\/\/pjq.me\/?p=2103"},"modified":"2025-11-13T13:26:37","modified_gmt":"2025-11-13T05:26:37","slug":"cryptography-1","status":"publish","type":"post","link":"https:\/\/pjq.me\/?p=2103","title":{"rendered":"Cryptography 1"},"content":{"rendered":"\n<p>I am start to learn the cryptography, so I will note the Cryptography journey in my blog<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/pjq.me\/?p=2103\/#Online_resources\" >Online resources<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/pjq.me\/?p=2103\/#China_Cryptography_Cipher\" >China Cryptography Cipher<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/pjq.me\/?p=2103\/#CIA_of_Triad_of_InfoSec\" >CIA of Triad of InfoSec<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/pjq.me\/?p=2103\/#Vocabulary\" >Vocabulary<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/pjq.me\/?p=2103\/#CyberChef\" >CyberChef<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/pjq.me\/?p=2103\/#Base64\" >Base64<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/pjq.me\/?p=2103\/#Caesar_Cipher\" >Caesar Cipher<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/pjq.me\/?p=2103\/#Letter_frequency\" >Letter frequency<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/pjq.me\/?p=2103\/#Substitution_Cipher\" >Substitution Cipher<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/pjq.me\/?p=2103\/#Pigpen_Cipher\" >Pigpen Cipher<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/pjq.me\/?p=2103\/#Kerckhoffs_Principle\" >Kerckhoff&#8217;s Principle<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/pjq.me\/?p=2103\/#Enigma_Machine\" >Enigma Machine<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/pjq.me\/?p=2103\/#Railfence_cipher\" >Railfence cipher<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/pjq.me\/?p=2103\/#Playfair_Cipher\" >Playfair Cipher<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/pjq.me\/?p=2103\/#Shannons_Principle_for_Secure_Ciphers\" >Shannon&#8217;s Principle for Secure Ciphers<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Online_resources\"><\/span>Online resources<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Some Cryptography online courses<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.pluralsight.com\/search?q=Cryptography\">https:\/\/www.pluralsight.com\/search?q=Cryptography<\/a><\/li>\n<\/ul>\n\n\n\n<p>Online hack platform<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/cryptohack.org\/courses\/\">https:\/\/cryptohack.org\/courses\/<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"China_Cryptography_Cipher\"><\/span>China Cryptography Cipher<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>SM4, one China Block Cipher<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/SM4_(cipher)\">https:\/\/en.wikipedia.org\/wiki\/SM4_(cipher)<\/a><\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>Sh\u0101ngM\u00ec 4<\/strong>&nbsp;(<strong>SM4, \u5546\u5bc64<\/strong>) (formerly&nbsp;<strong>SMS4<\/strong>)<sup><a href=\"https:\/\/en.wikipedia.org\/wiki\/SM4_(cipher)#cite_note-oscca_1228-2\">[2]<\/a><\/sup>&nbsp;is a&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Block_cipher\">block cipher<\/a>&nbsp;used in the&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/China\">Chinese<\/a>&nbsp;National Standard for Wireless LAN&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/WLAN_Authentication_and_Privacy_Infrastructure\">WAPI<\/a>&nbsp;(WLAN Authentication and Privacy Infrastructure) and also used with&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Transport_Layer_Security\">Transport Layer Security<\/a>.<sup><a href=\"https:\/\/en.wikipedia.org\/wiki\/SM4_(cipher)#cite_note-3\">[3]<\/a><\/sup><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"CIA_of_Triad_of_InfoSec\"><\/span>CIA of Triad of InfoSec<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Confidentiality<\/li>\n\n\n\n<li>Integrity<\/li>\n\n\n\n<li>Availability<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Vocabulary\"><\/span>Vocabulary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Cryptography<\/li>\n\n\n\n<li>Cryptanalysis<\/li>\n\n\n\n<li>Cryptology = Cryptography + Cryptanalysis<\/li>\n\n\n\n<li>Steganography:Writing messages,such that no one else notices that they have been written.<\/li>\n<\/ol>\n\n\n\n<p><strong>Not Crypto<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Encoding, e.g. md5, Base64, Base32, UTF-8<\/li>\n<\/ul>\n\n\n\n<p>Hierarchy of Cryptology<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Cryptology = Cyptography + Cryptanalysis\nCryptography = Cyptographic Hash Algorithms + Symmetric Key Algorithms + Asymmetric Key Algorithms + Protocols<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"CyberChef\"><\/span>CyberChef<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Lots of useful tools<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gchq.github.io\/CyberChef\">https:\/\/gchq.github.io\/CyberChef<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Base64\"><\/span>Base64<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Base64 <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Base64\">https:\/\/en.wikipedia.org\/wiki\/Base64<\/a><\/li>\n<\/ul>\n\n\n\n<p>E.g. Hello, so split it as 6 bit as one group, and mapping to the Base64 table, the last 00 is padding<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>01001000 01100101 01101100 01101100 01101111\n010010 000110 010101 101100 011011 000110 1111(00) (=) \nS      G      V      s      b      G      8\nSGVsbG8=<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"852\" src=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1024x852.png\" alt=\"\" class=\"wp-image-2106\" style=\"width:632px;height:auto\" srcset=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1024x852.png 1024w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-300x250.png 300w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-768x639.png 768w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image.png 1334w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Caesar_Cipher\"><\/span>Caesar Cipher<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>https:\/\/en.wikipedia.org\/wiki\/Caesar_cipher<\/li>\n<\/ul>\n\n\n\n<p>In general it shift right the number of the Character<\/p>\n\n\n\n<p>Math behind, e.g. shift 3.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>E(p)\u2192(p+3)mod26\n\nD(c)\u2192(c-3)mod26=(c+23)mod26<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/cryptii.com\/pipes\/caesar-cipher\">https:\/\/cryptii.com\/pipes\/caesar-cipher<\/a><\/li>\n\n\n\n<li>https:\/\/gchq.github.io\/CyberChef\/#recipe=ROT13(true,true,false,2)<\/li>\n<\/ul>\n\n\n\n<p>Use the online tool to encypt the message with Caesar Cipher<\/p>\n\n\n\n<p>E.g. PlainText, shift = 2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Star Wars is an American epic space opera&#91;1] media franchise created by George Lucas, which began with the eponymous 1977 film&#91;a] and quickly became a worldwide pop culture phenomenon. The franchise has been expanded into various films and other media, including television series, video games, novels, comic books, theme park attractions, and themed areas, comprising an all-encompassing fictional universe.&#91;b] Star Wars is one of the highest-grossing media franchises of all time.<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Uvct Yctu ku cp Cogtkecp grke urceg qrgtc&#91;1] ogfkc htcpejkug etgcvgf da Igqtig Nwecu, yjkej dgicp ykvj vjg grqpaoqwu 1977 hkno&#91;c] cpf swkemna dgecog c yqtnfykfg rqr ewnvwtg rjgpqogpqp. Vjg htcpejkug jcu dggp gzrcpfgf kpvq xctkqwu hknou cpf qvjgt ogfkc, kpenwfkpi vgngxkukqp ugtkgu, xkfgq icogu, pqxgnu, eqoke dqqmu, vjgog rctm cvvtcevkqpu, cpf vjgogf ctgcu, eqortkukpi cp cnn-gpeqorcuukpi hkevkqpcn wpkxgtug.&#91;d] Uvct Yctu ku qpg qh vjg jkijguv-itquukpi ogfkc htcpejkugu qh cnn vkog.<\/code><\/pre>\n\n\n\n<p>You can try to decode it with the online tool<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>https:\/\/www.dcode.fr\/caesar-cipher<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Letter_frequency\"><\/span>Letter frequency<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Letter_frequency\">https:\/\/en.wikipedia.org\/wiki\/Letter_frequency<\/a><\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li>E: 12.7%<\/li>\n\n\n\n<li>T: 9.1%<\/li>\n\n\n\n<li>A: 8.2%<\/li>\n<\/ol>\n\n\n\n<p>We can using the tool<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gchq.github.io\/CyberChef\/#recipe=Frequency_distribution(true,true)\">https:\/\/gchq.github.io\/CyberChef\/#recipe=Frequency_distribution(true,true)<\/a><\/li>\n<\/ul>\n\n\n\n<p>In the movie, it&#8217;s using the frequency analyse<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/The_Adventure_of_the_Dancing_Men\">https:\/\/en.wikipedia.org\/wiki\/The_Adventure_of_the_Dancing_Men<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Substitution_Cipher\"><\/span>Substitution Cipher<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Substitution_cipher\">https:\/\/en.wikipedia.org\/wiki\/Substitution_cipher<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Pigpen_Cipher\"><\/span>Pigpen Cipher<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Pigpen_cipher\">https:\/\/en.wikipedia.org\/wiki\/Pigpen_cipher<\/a><\/li>\n<\/ul>\n\n\n\n<p>CodeBook<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"440\" height=\"440\" src=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1.png\" alt=\"\" class=\"wp-image-2124\" style=\"width:187px;height:auto\" srcset=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1.png 440w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1-300x300.png 300w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1-150x150.png 150w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1-270x270.png 270w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1-230x230.png 230w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Kerckhoffs_Principle\"><\/span>Kerckhoff&#8217;s Principle<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Kerckhoffs%27s_principle\">https:\/\/en.wikipedia.org\/wiki\/Kerckhoffs%27s_principle<\/a><\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Kerckhoffs&#8217; Principle states that&nbsp;<strong>the security of a cryptosystem must lie in the choice of its keys only; everything else (including the algorithm itself) should be considered public knowledge<\/strong>.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Enigma_Machine\"><\/span>Enigma Machine<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Enigma_machine\">https:\/\/en.wikipedia.org\/wiki\/Enigma_machine<\/a><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"440\" height=\"480\" src=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-2.png\" alt=\"\" class=\"wp-image-2131\" srcset=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-2.png 440w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-2-275x300.png 275w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Railfence_cipher\"><\/span>Railfence cipher<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Rail_fence_cipher\">https:\/\/en.wikipedia.org\/wiki\/Rail_fence_cipher<\/a><\/li>\n<\/ul>\n\n\n\n<p>You can play on the CyberChef<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gchq.github.io\/CyberChef\/#recipe=Rail_Fence_Cipher_Encode(4,0)&amp;input=VGhpcyBpcyBhIHNlY3JldCBtZXNzYWdl\">https:\/\/gchq.github.io\/CyberChef\/#recipe=Rail_Fence_Cipher_Encode(4,0)&amp;input=VGhpcyBpcyBhIHNlY3JldCBtZXNzYWdl<\/a><\/li>\n<\/ul>\n\n\n\n<p>And decode<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gchq.github.io\/CyberChef\/#recipe=Rail_Fence_Cipher_Decode(2,0)&amp;input=VHNjZWhpIGVybXNlaSBhc2Ugc2dzIHRh\">https:\/\/gchq.github.io\/CyberChef\/#recipe=Rail_Fence_Cipher_Decode(2,0)&amp;input=VHNjZWhpIGVybXNlaSBhc2Ugc2dzIHRh<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Playfair_Cipher\"><\/span>Playfair Cipher<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Playfair_cipher\">https:\/\/en.wikipedia.org\/wiki\/Playfair_cipher<\/a><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"176\" src=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-3-1024x176.png\" alt=\"\" class=\"wp-image-2136\" srcset=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-3-1024x176.png 1024w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-3-300x52.png 300w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-3-768x132.png 768w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-3-1536x264.png 1536w, https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-3.png 1942w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Shannons_Principle_for_Secure_Ciphers\"><\/span>Shannon&#8217;s Principle for Secure Ciphers<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Confusion<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Each bit of the ciphertext should depend on several parts of the secret key.<\/p>\n<\/blockquote>\n\n\n\n<p>Diffusion<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Changing only one bit of the plaintext should change (approximately)half the bits of the corresponding ciphertext.<\/p>\n<\/blockquote>\n\n\n\n<p>We can use the CyberChef to testing, if key changed or plain text changed<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gchq.github.io\/CyberChef\/#recipe=AES_Encrypt(%7B'option':'UTF8','string':'0000000000000000'%7D,%7B'option':'Hex','string':''%7D,'ECB','Raw','Hex',%7B'option':'Hex','string':''%7D)&amp;input=MDAwMDAwMDAwMDAwMDAw\">https:\/\/gchq.github.io\/CyberChef\/#recipe=AES_Encrypt(%7B&#8217;option&#8217;:&#8217;UTF8&#8242;,&#8217;string&#8217;:&#8217;0000000000000000&#8217;%7D,%7B&#8217;option&#8217;:&#8217;Hex&#8217;,&#8217;string&#8217;:&#8221;%7D,&#8217;ECB&#8217;,&#8217;Raw&#8217;,&#8217;Hex&#8217;,%7B&#8217;option&#8217;:&#8217;Hex&#8217;,&#8217;string&#8217;:&#8221;%7D)&amp;input=MDAwMDAwMDAwMDAwMDAw<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I am start to learn the cryptography, so I will note the Cryptography journey in my blog Online resources Some Cryptography online courses Online hack platform China Cryptography Cipher SM4, one China Block Cipher Sh\u0101ngM\u00ec 4&nbsp;(SM4, \u5546\u5bc64) (formerly&nbsp;SMS4)[2]&nbsp;is a&nbsp;block cipher&nbsp;used<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[270,169],"tags":[246,268,254,228,259,264],"class_list":["post-2103","post","type-post","status-publish","format-standard","hentry","category-cryptography","category-tech","tag-aes","tag-asymmetric-encryption","tag-classic-cryptography","tag-cryptography","tag-morden-cryptography","tag-rsa"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Cryptography 1 - Jianqing&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pjq.me\/?p=2103\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cryptography 1 - Jianqing&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"I am start to learn the cryptography, so I will note the Cryptography journey in my blog Online resources Some Cryptography online courses Online hack platform China Cryptography Cipher SM4, one China Block Cipher Sh\u0101ngM\u00ec 4&nbsp;(SM4, \u5546\u5bc64) (formerly&nbsp;SMS4)[2]&nbsp;is a&nbsp;block cipher&nbsp;used\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pjq.me\/?p=2103\" \/>\n<meta property=\"og:site_name\" content=\"Jianqing&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-14T13:31:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T05:26:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1334\" \/>\n\t<meta property=\"og:image:height\" content=\"1110\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"pengjianqing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pengjianqing\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pjq.me\/?p=2103#article\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/?p=2103\"},\"author\":{\"name\":\"pengjianqing\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"headline\":\"Cryptography 1\",\"datePublished\":\"2023-12-14T13:31:28+00:00\",\"dateModified\":\"2025-11-13T05:26:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pjq.me\/?p=2103\"},\"wordCount\":496,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"image\":{\"@id\":\"https:\/\/pjq.me\/?p=2103#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1024x852.png\",\"keywords\":[\"AES\",\"Asymmetric Encryption\",\"Classic Cryptography\",\"Cryptography\",\"Morden Cryptography\",\"RSA\"],\"articleSection\":[\"Cryptography\",\"Tech\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pjq.me\/?p=2103#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pjq.me\/?p=2103\",\"url\":\"https:\/\/pjq.me\/?p=2103\",\"name\":\"Cryptography 1 - Jianqing&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/pjq.me\/?p=2103#primaryimage\"},\"image\":{\"@id\":\"https:\/\/pjq.me\/?p=2103#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1024x852.png\",\"datePublished\":\"2023-12-14T13:31:28+00:00\",\"dateModified\":\"2025-11-13T05:26:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/pjq.me\/?p=2103#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pjq.me\/?p=2103\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pjq.me\/?p=2103#primaryimage\",\"url\":\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image.png\",\"contentUrl\":\"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image.png\",\"width\":1334,\"height\":1110},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pjq.me\/?p=2103#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/pjq.me\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cryptography 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pjq.me\/#website\",\"url\":\"https:\/\/pjq.me\/\",\"name\":\"Jianqing&#039;s Blog\",\"description\":\"Thoughts and Future\",\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/pjq.me\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\",\"name\":\"pengjianqing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"contentUrl\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"width\":460,\"height\":752,\"caption\":\"pengjianqing\"},\"logo\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/pjq.me\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cryptography 1 - Jianqing&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pjq.me\/?p=2103","og_locale":"en_US","og_type":"article","og_title":"Cryptography 1 - Jianqing&#039;s Blog","og_description":"I am start to learn the cryptography, so I will note the Cryptography journey in my blog Online resources Some Cryptography online courses Online hack platform China Cryptography Cipher SM4, one China Block Cipher Sh\u0101ngM\u00ec 4&nbsp;(SM4, \u5546\u5bc64) (formerly&nbsp;SMS4)[2]&nbsp;is a&nbsp;block cipher&nbsp;used","og_url":"https:\/\/pjq.me\/?p=2103","og_site_name":"Jianqing&#039;s Blog","article_published_time":"2023-12-14T13:31:28+00:00","article_modified_time":"2025-11-13T05:26:37+00:00","og_image":[{"width":1334,"height":1110,"url":"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image.png","type":"image\/png"}],"author":"pengjianqing","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pengjianqing","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pjq.me\/?p=2103#article","isPartOf":{"@id":"https:\/\/pjq.me\/?p=2103"},"author":{"name":"pengjianqing","@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"headline":"Cryptography 1","datePublished":"2023-12-14T13:31:28+00:00","dateModified":"2025-11-13T05:26:37+00:00","mainEntityOfPage":{"@id":"https:\/\/pjq.me\/?p=2103"},"wordCount":496,"commentCount":0,"publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"image":{"@id":"https:\/\/pjq.me\/?p=2103#primaryimage"},"thumbnailUrl":"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1024x852.png","keywords":["AES","Asymmetric Encryption","Classic Cryptography","Cryptography","Morden Cryptography","RSA"],"articleSection":["Cryptography","Tech"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pjq.me\/?p=2103#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pjq.me\/?p=2103","url":"https:\/\/pjq.me\/?p=2103","name":"Cryptography 1 - Jianqing&#039;s Blog","isPartOf":{"@id":"https:\/\/pjq.me\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pjq.me\/?p=2103#primaryimage"},"image":{"@id":"https:\/\/pjq.me\/?p=2103#primaryimage"},"thumbnailUrl":"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image-1024x852.png","datePublished":"2023-12-14T13:31:28+00:00","dateModified":"2025-11-13T05:26:37+00:00","breadcrumb":{"@id":"https:\/\/pjq.me\/?p=2103#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pjq.me\/?p=2103"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pjq.me\/?p=2103#primaryimage","url":"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image.png","contentUrl":"https:\/\/pjq.me\/wp-content\/uploads\/2023\/12\/image.png","width":1334,"height":1110},{"@type":"BreadcrumbList","@id":"https:\/\/pjq.me\/?p=2103#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pjq.me\/"},{"@type":"ListItem","position":2,"name":"Cryptography 1"}]},{"@type":"WebSite","@id":"https:\/\/pjq.me\/#website","url":"https:\/\/pjq.me\/","name":"Jianqing&#039;s Blog","description":"Thoughts and Future","publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pjq.me\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60","name":"pengjianqing","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/","url":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","contentUrl":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","width":460,"height":752,"caption":"pengjianqing"},"logo":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/"},"url":"https:\/\/pjq.me\/?author=1"}]}},"views":1994,"_links":{"self":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/2103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2103"}],"version-history":[{"count":20,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/2103\/revisions"}],"predecessor-version":[{"id":2130,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/2103\/revisions\/2130"}],"wp:attachment":[{"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}