a1010101010

</li>\n<li><p><code>app-all.js</code> - This file is a minimized build of your application plus all of the Ext JS classes required to run it. It is the minified and production-ready version of <code>all-classes.js + app.js</code>.该文件是一个最小化您的应用程序,加上所有运行所需的Ext JS类的建设。它是在缩小的和生产准备的版本所有的classes.js + app.js</p></li>\n</ol>\n\n\n<p>An Ext JS application will need a separate <code>index.html</code> for the production version of the app.  You will typically handle this in your build process or server side logic, but for now let's just create a new file in the <code>helloext</code> directory called <code>index-prod.html</code>:</p><p>Ext JS的应用程序将需要一个单独的应用程序的生产版本的index.html。您通常会在您的构建过程中或服务器端逻辑处理,但现在我们只是创建一个新文件helloext称为目录索引prod.html的:</p>\n\n<pre><code>&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;Hello Ext&lt;/title&gt;\n\n    &lt;link rel=\"stylesheet\" type=\"text/css\" href=\"extjs/resources/css/ext-all.css\"&gt;\n    &lt;script type=\"text/javascript\" src=\"extjs/ext.js\"&gt;&lt;/script&gt;\n    &lt;script type=\"text/javascript\" src=\"app-all.js\"&gt;&lt;/script&gt;\n&lt;/head&gt;\n&lt;body&gt;&lt;/body&gt;\n&lt;/html&gt;\n</code></pre>\n\n<p>Notice that <code>ext-debug.js</code> has been replaced with <code>ext.js</code>, and <code>app.js</code> has been replaced with <code>app-all.js</code>. If you navigate to <a href=\"http://localhost/helloext/index-prod.html\">http://localhost/helloext/index-prod.html</a> in your browser, you should see the production version of the \"Hello Ext\" application.</p><p>请注意,EXT-debug.js已与ext.js取代,并app.js已取代APP-all.js。如果您在您的浏览器导航到http://localhost/helloext/index-prod.html,应该看到的Hello分机应用程序的生产版本。</p>\n\n<h2 id='getting_started-section-4'>4. 进一步阅读Further Reading</h2>\n\n<ol>\n<li><a href=\"#/guide/class_system\">Class System类系统</a></li>\n<li><a href=\"#/guide/application_architecture\">MVC Application ArchitectureMVC应用程序架构</a></li>\n<li><a href=\"#/guide/layouts_and_containers\">Layouts and Containsers布局和容器</a></li>\n<li><a href=\"#/guide/data\">Working with Data使用数据</a></li>\n</ol>\n\n","title":"Getting Started with Ext JS 4"});
def setup_trivium(key_data, iv_data): key_reversed = key_data[::-1] iv_reversed = iv_data[::-1] state_a = key_reversed + [0] * (93 - len(key_reversed)) state_b = iv_reversed + [0] * (84 - len(iv_reversed)) state_c = [0] * 108 + [1, 1, 1] return state_a, state_b, state_c def advance_state_and_produce_bit(a_state, b_state, c_state): t1_val = a_state[65] ^ (a_state[90] & a_state[91]) ^ a_state[92] ^ b_state[77] t2_val = b_state[68] ^ (b_state[81] & b_state[82]) ^ b_state[83] ^ c_state[86] t3_val = c_state[65] ^ (c_state[108] & c_state[109]) ^ c_state[110] ^ a_state[68] key_bit = a_state[65] ^ a_state[92] ^ b_state[68] ^ b_state[83] ^ c_state[65] ^ c_state[110] new_a = [t3_val] + a_state[:-1] new_b = [t1_val] + b_state[:-1] new_c = [t2_val] + c_state[:-1] return new_a, new_b, new_c, key_bit def text_to_binary(s): return [int(c) for c in s.strip()] def binary_to_text(binary_list): return ''.join(str(bit) for bit in binary_list) def execute_trivium_cryptography(key_str, iv_str, plaintext_str): key_bits = text_to_binary(key_str) iv_bits = text_to_binary(iv_str) plaintext_bits = text_to_binary(plaintext_str) a, b, c = setup_trivium(key_bits, iv_bits) print("系统初始状态:") print(f"状态 A (93 位): {binary_to_text(a)}") print(f"状态 B (84 位): {binary_to_text(b)}") print(f"状态 C (111 位): {binary_to_text(c)}") print("-" * 80) for _ in range(1152): a, b, c, _ = advance_state_and_produce_bit(a, b, c) print("预热完成后 (1152 次迭代):") print(f"状态 A (93 位): {binary_to_text(a)}") print(f"状态 B (84 位): {binary_to_text(b)}") print(f"状态 C (111 位): {binary_to_text(c)}") print("-" * 80) key_stream = [] for _ in range(len(plaintext_bits)): a, b, c, bit = advance_state_and_produce_bit(a, b, c) key_stream.append(bit) print(f"生成的密钥流: {binary_to_text(key_stream)}") print("-" * 80) print("密钥流生成后的状态:") print(f"状态 A (93 位): {binary_to_text(a)}") print(f"状态 B (84 位): {binary_to_text(b)}") print(f"状态 C (111 位): {binary_to_text(c)}") print("-" * 80) ciphertext = [p ^ k for p, k in zip(plaintext_bits, key_stream)] print(f"最终密文: {binary_to_text(ciphertext)}") return binary_to_text(ciphertext) def read_inputs_from_file(filename): with open(filename, 'r') as f: lines = f.readlines() if len(lines) < 3: raise ValueError("文件必须包含三行:key、iv 和 plaintext。") key = lines[0].strip() iv = lines[1].strip() plaintext = lines[2].strip() return key, iv, plaintext if __name__ == "__main__": filepath = "D:\\cxdownload\\trivium demo.txt" key, iv, plaintext = read_inputs_from_file(filepath) execute_trivium_cryptography(key, iv, plaintext) 解释代码
06-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值