{"id":1572,"date":"2013-01-14T17:57:45","date_gmt":"2013-01-14T22:57:45","guid":{"rendered":"http:\/\/www.jlao.net\/?p=1572"},"modified":"2013-01-29T00:02:26","modified_gmt":"2013-01-29T05:02:26","slug":"merkle-hellman-%e8%83%8c%e5%8c%85%e7%ae%97%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.jlao.net\/en\/technology\/1572\/","title":{"rendered":"Merkle-Hellman Knapsack Demo"},"content":{"rendered":"<p>This is a Javascript demo of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Merkle%E2%80%93Hellman_knapsack_cryptosystem\">Merkle-Hellman Knapsack Cryptosystem<\/a>. You can click all the &#8220;Generate&#8221; buttons from top to bottom, or specify your own private keys \/ modulo \/ multiplier. The length of the key is set to 16 bit.<br \/>\n<!--more--><br \/>\n<script type=\"text\/javascript\" src=\"https:\/\/www.jlao.net\/wp-content\/uploads\/2013\/01\/MerkelHellman.js\"><\/script>\n<link href=\"https:\/\/www.jlao.net\/wp-content\/uploads\/2013\/01\/MerkelHellman.css\" rel=\"stylesheet\" type=\"text\/css\">\n<form id=\"MH\">\n<label>Key Length: <\/label><input name=\"keyLength\" type=\"text\" value=\"16\" readonly=\"readonly\"><\/input> <br \/>\n<label>Private Key:<\/label><input name=\"btnPKey\" type=\"button\" class=\"button\" value=\"Generate\" OnClick=\"this.form.pvtKey.value=gen_private_key(this.form.keyLength.value);\" \/><br \/>\n<textarea name=\"pvtKey\" rows=\"2\"><\/textarea><br \/>\n<label>Modulo:<\/label><input name=\"modulo\" type=\"text\"><\/textarea><input name=\"btnModulo\" type=\"button\" class=\"button\" value=\"Generate\" OnClick=\"modulo.value=gen_mod(this.form.pvtKey.value, this.form.keyLength.value);\" \/><br \/>\n<label>Multiplier:<\/label><input name=\"multiplier\" type=\"text\"><\/textarea><input name=\"btnMultiplier\" type=\"button\" class=\"button\" value=\"Generate\" OnClick=\"multiplier.value=gen_multiplier(this.form.modulo.value);\" \/><br \/>\n<label>Inverse Modulo:<\/label><input name=\"invmodulo\" type=\"text\" readonly=\"readonly\"><\/textarea><input name=\"btnInvModulo\" type=\"button\" class=\"button\" value=\"Generate\" OnClick=\"invmodulo.value=gen_inv_mod(this.form.multiplier.value, this.form.modulo.value);\" \/><br \/>\n<label>Public Key:<\/label><input name=\"btnPubKey\" type=\"button\" class=\"button\" value=\"Generate\"  OnClick=\"this.form.pubkey.value=gen_public_key(this.form.pvtKey.value, this.form.keyLength.value, this.form.modulo.value, this.form.multiplier.value);\" \/><br \/>\n<textarea name=\"pubkey\" rows=\"2\" readonly=\"readonly\"><\/textarea><br \/>\n<label>Original Text:<\/label><br \/>\n<textarea name=\"intext\" rows=\"5\">Test text here&#8230;<\/textarea><\/p>\n<p align=\"center\">\n<input name=\"btnEncode\" type=\"button\" class=\"button\" value=\"Encode\" OnClick=\"this.form.outText.value=encode(this.form.intext.value, this.form.keyLength.value, this.form.pubkey.value);\" \/><input name=\"btnDecode\" type=\"button\" class=\"button\" value=\"Decode\" OnClick=\"this.form.intext.value=decode(this.form.outText.value, this.form.keyLength.value, this.form.pvtKey.value, this.form.invmodulo.value, this.form.modulo.value);\" \/><\/p>\n<p><label>Encoded Text:<\/label><br \/>\n<textarea name=\"outText\"rows=\"5\"><\/textarea><br \/>\n<\/form>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This is a Javascript demo of Merkle-Hellman Knapsack Cryptosystem. You can click all the &#8220;Generate&#8221; buttons from top to bottom, or specify your own private keys \/ modulo \/ multiplier. The length of the key is set to 16 bit.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[108,109],"class_list":["post-1572","post","type-post","status-publish","format-standard","hentry","category-technology","tag-merkle-hellman","tag-knapsack"],"_links":{"self":[{"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/posts\/1572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/comments?post=1572"}],"version-history":[{"count":0,"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/posts\/1572\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/media?parent=1572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/categories?post=1572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jlao.net\/en\/wp-json\/wp\/v2\/tags?post=1572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}