INFO3616/CSEC3616/CSEC5616

433M遥控器无线解码1527协议 433M遥控器无线解码1527协议,定时器轮询法 阅读详情

INFO3616/CSEC3616/CSEC5616 — S2 2024

Assignment - 2

This is an individual assignment.

This assignment worths 10% of the final marks of the course and covers the content of Weeks 4-6 (inclusive).

Submit your final report as a PDF and codes as a zip file in Canvas. In Canvas, under Assign- ment 2, you will find two links to submit your report and code separately.

You should explain any details of how to run your code in the report.

Final Report and Code: Due by Week 5, Sunday the 22nd of September, 2024 11:59 PM

*** IMPORTANT ***: In your answer sheet DO NOT repeat the questions. Simply include the question number and your answer only. If you include question text in your answer sheet, your TurnItIn score will be high and there will be additional checks. This will cause a delay in releasing your marks. We will also impose a penalty of 10% of the total marks.

1 Breaking the Vigenère Cipher (20 marks)

In the given zip file for Assignment 2, under Question 1 you will find a cipher text encrypted by the Vigenère cipher. Your task is to break it and find the original plain text. Please read the following instructions carefully.

• You need to write your own code for this. However, there will be some guesswork and analysis involved. So we do not expect your code to give the decrypted result straight away.  For example, if you are checking various substitutions, it is acceptable that you run your code multiple times to see which substitution results in a readable text.

• The spaces and punctuations such as . and ’ are not encrypted. You can store their positions into an array, remove them, do the decryption using your method, and insert them back to the correct positions in the final plaintext.

• You will need ideas from Kasiski  Test to break this.  However there can be other possible solutions. You are not allowed to use any online decryption tool to assist you.

• The key length is less than 20 characters and contain only capital English characters. It is a random string, not a meaningful word. The final plain text is readable and meaningful.

• In the report include a description of your approach, the key length, the key, and the final plaintext you obtained. Also, explain how your code works and how to run it so that the tutors can run your code.

2 Cipher Block Modes (20 marks)

a) ECB vs. CBC

With the ECB mode, if there is an error in a block of the transmitted ciphertext, only the corresponding plaintext block is affected. However, in the CBC mode, this error propagates. For example, an error in the transmitted C1 (in the CBC diagram in the lecture) obviously corrupts P1  and P2 .

i Are any blocks beyond P2  affected? (4 marks)

ii  Suppose that there is a bit error in the source version of P1 .  Through how many ciphertext blocks is this error propagated? What is the effect at the receiver? (4 marks)

Note: Here transmitted means the spatial aspect of cryptography.  i.e., the sender encrypts the message and sends it over a network and the receiver receives it. And then receiver decrypts it. As the network transmissions are not perfect, there can be transmission errors, e.g., bit flips in transmitted cipher text. When a transmitted cipher text block is corrputed due to tranmission error, the receiver may not be able to decrypt it to the correct plain text.

b) CBC-CTS (Cipher Block Chaining - Cipher Text Stealing)

b) Read following description carefully about the CBC-CTS (Cipher Block Chaining - Cipher Text Stealing).

Usually padding is done in block modes when the last block of plain text does not fill the block size. However, padding may not always be appropriate. For example, one might wish to store the encrypted data in the same memory buffer that originally contained the plaintext. In that case, the cipher text must be the same length as the original plaintext. CBC-CTS (Cipher Block Chaining - Cipher Text Stealing) is a block mode that creates cipher text exactly in the same length as the plain text. Figure 1 shows the overall operation of the scheme.

What is happening at the last two steps

Assume that the last block of plaintext is only L bytes long, where L < block size. The encryption sequence is as follows:

1. Encrypt the first (N – 2) blocks using the traditional CBC technique.

2. XOR PN −1  with the previous cipher text block CN −2  to create YN −1 .

3. Encrypt YN −1  to create EN −1 .

4.  Select the first L bytes of EN −1  to create CN .

5.  Pad PN  with zeros at the end and XOR with EN −1  to create YN .

6. Encrypt YN  to create CN −1 .

7. The last two blocks of the cipher text are CN −1  and CN .

Now consider the following implementation of CBC-CTS

•  Block Length B is 4 bits

•  Key is 1101 and IV is 1001

• The plain text is 10101110001011

• The encryption function consists of two steps

– Using Figure 2 get the mapping (i.e., if plain text is x, the table gives F (x))

– XOR with the Key: Encrypted value E(x) is F (x) ⊕ K (i.e., E(x) = F (x) ⊕ K)

Figure 1: CBC-CTS block mode

Figure 2: Plaintext mapping as a table

Figure 3: CBC-CTS setup

Based on this information

i  Complete the missing values in Figure 3.  Show your calculation steps. You may redraw the figure in your answer sheet. (8 marks)

ii  Give the final cipher text. (4 marks)

3 RSA Calculation (20 marks)

Suppose Bob is generating a public and private key pair using RSA algorithm. Bob choses the prime numbers p = 10007 and q = 53047.  He computed n = pq = 530841329 and ϕ(n) = (p − 1)(q − 1) = 530778276. He then chooses the encryption exponent e = 999983.

i Find the private key. i.e., d where ed ≡ 1  mod ϕ(n) using the Extended Euclidean algorithm (12 marks - 10 marks for the missing values in the table and 2 marks for d).

First follow the explanation below.

Recall the Euclidean Algorithm for finding the GCD or a and b. It goes like this

1) Calculate r1 = a  mod b which satisfies a = q1 b + r1

2) Calculate r2 = b  mod r1  which satisfies b = q2r1 + r2

3) Calculate r3 = r1   mod r2  which satisfies r1  = q3r2 + r3

...

i) Calculate ri  = ri−2   mod ri−1  which satisfies ri−2  = qiri−1 + ri

...

n) Calculate rn+1 = rn−1   mod rn  = 0 which satisfies rn−1  = q n+1rn + 0 When rn+1  becomes zero gcd(a, b) = rn

Next we assume that each step we can find xi  and yi  that satisfy ri  = axi  + by i. We end up with the following sequence.

a = q1 b + r1  and r1  = ax1 + by1   b = q2r1 + r2  and r2  = ax2 + by2  r1 = q3r2 + r3  and r3  = ax3 + by3

rn−2 = qnrn−1 + rn  and rn  = axn + by n rn−1 = q n+1rn + 0

We can rearrange the terms in above equations to obtain

ri = ri−2 − ri−1qi                                                                                    (1)

But we also know that ri−2  = axi−2 + by i−2  and ri−1  = axi−1 + by i−1

By substituting in Equation (1) we get.

ri = (axi−2 + by i−2) − (axi−1 + by i−1)qi

ri = a(xi−2 − qixi−1) + b(yi−2) − qiyi−1)

Since we assumed ri = axi + by i  by co-efficient matching we can get

xi = xi−2 − qixi−1  and yi  = yi−2 − qiyi−1

Based on this information your task is to fill the blanks in Table 1 and provide the value of d.

Explain Step 2 in the Table in detail and the rest of the steps you can fill the table without describing it.

ii  Suppose Bob shared his public key e with Alice. If Alice wants to send the message 3 to Bob, find the encrypted message.  Show your steps of exponentiation by squaring (You don’t  have to show all the steps but you can show first 2-3 steps of the exponential squaring and  show the final answer - you can use an online calculator the find the final answer e.g. https: //www.dcode.fr/modular-exponentiation).  (4 marks).

Table 1: Computing the decryption exponent d.

iii Verify that Bob can decrypt what Alice sends.  Describe the required computation and use an online calculator to obtain the final answer.  (4 marks).

4 Breaking RSA with Fermat’s Factorization (20 marks)

Fermat’s factorization is a method for finding the factors of a composite number N by expressing it as the difference of two squares.  It can be particularly useful for breaking poorly configured RSA setups where the two prime factors p and q of N = p × q are close to each other.

Conduct your own research and learn about how Fermat’s Factorization works.

Example links Link 1, Link 2.

In the given zip file for Assignment 2, under Question 3, you are given a n (modulus) and e (public key) of an RSA system. You are also given c (a cipher text) encrypted using e. Write a program and find the following. (4 marks for each)

i Using Fermat’s Factorization method find the two prime factors of n, i.e., p and q in the RSA notation.

ii Find ϕ(n).

iii Find the private key d.

iv Find the corresponding plaintext p for the given c as an integer.

v  Convert the decimal to ASCII and find the readable (and also meaningful) plain text. For this step, convert the integer into binary, read 8-bits at a time and convert them to the ASCII character using the chr function.

• The correct plaintext in binary should have 160 bits. That is 20 ASCII characters.

•  Python will not add leading zeros when you convert decimals to binary. So if you get a binary string of 159 bits, simply add a leading bit 0. Otherwise you might not be able to decode it in ASCII code.

In the report include the answer to above questions and explain how your code works. Submit your code in the seperate link given in Canvas.

As you are dealing with large numbers use the Python library gmpy2 and the mpz format to represent large integers.

5 Message Authentication Codes (20 marks)

a) Message Authentication Codes vs. Hashes

i Explain what a message authentication code is. (2 marks)

ii  Explain the difference between a message authentication code and a one-way hash function. (2 marks)

b) A Simple Message Authentication Code

Alice wants to send a single bit of information (a yes or a no) to Bob by means of a word of length 2. Alice and Bob have four possible keys available to perform. message authentication. The matrix in Figure 4 shows the 2-bit word sent for each message under each key:

i The preceding matrix is in a useful form. for Alice. Construct a matrix with the same information that would be more useful for Bob. (4 marks)

ii What is the probability that someone else can successfully impersonate Alice? (2 marks)

iii What is the probability that someone can replace an intercepted message with another message successfully? (2 marks)

Figure 4: A simple message authentication code.

c) Authenticated Encryption (AE)

In the lecture (and also in the textbook) we discussed four approaches for Authenticated Encryption (AE). They are:

• Hashing followed by encryption: i.e., send Enck(m, H(m))

• Authentication followed by encryption (MAC-then-encrypt): i.e., send Enck1 (m, MACk2 (m))

• Encryption followed by authentication (encrypt-then-MAC): i.e., send Enck1 (m), MACk2 (Enck1 (m))

• Independently encrypt and authenticate (MAC-and-encrypt): i.e., send Enck1 (m), MACk2 (m)

Based on those four scenarios answer the following questions.

i Which of the above performs decryption before verification. Explain your answer. (4 marks)

ii Which of the above performs verification before decryption. Explain your answer. (4 marks)

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM) 迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM) 立即下载

相关推荐

如何使用3D高斯分布进行环境建模

使用3D高斯分布来进行建模,关键在于通过引入不确定性描述来提高建图的鲁棒性和精度。与传统点云表示相比,3D高斯分布提供了一种更为灵活和有效的方式来处理空间数据,能够通过协方差矩阵表示点的空间不确定性,帮助优化SLAM过程中的定位和地图更新。

JaydenQ的博客 2357

INFO3616/CSEC3616/CSEC5616 — S2 2024 - 1Python

Email:bluecarbluebluebluecarcarbluecarcar(2 marks)UserClearanceAliceBasicBobCharlieSecretDavidTop SecretEliseObjectweeklythreatreporttxtmarshabitatplantxtBasicbattleplanstxtTop Secret。

qq_99515681的博客 1237

别再折腾端口了!Kali Nethunter Kex 图形化桌面连接失败的真正原因与一键修复(附Termux命令)

本文深入分析了Kali Nethunter Kex图形化桌面连接失败的真正原因,包括端口配置变更、依赖缺失和权限问题,并提供了一键修复方案和Termux命令。通过详细的诊断步骤和优化配置,帮助用户快速恢复Kex功能,提升移动安全测试效率。

weixin_42530732的博客 418

INFO3616/CSEC3616/CSEC5616 — S2 2024 - 2Python

3616/CSEC3616/CSEC5616S22024Assignment22. XOR PN−−−1 .−−1 .−−−1 .−......xi = xi−2−−qiyi−1。

qq__99515681的博客 998

CS231n+assignment2(一)

cs231n作业二详解+代码

qq_56551150的博客 2411

核密度估计及其Python实践

一、参数估计简介 很多情况下,我们只有有限的样本集,而类条件概率密度函数p(x|ωi)和先验概率P(ωi)是未知的,需要根据已有样本进行参数估计,然后将估计值当作真实值来使用。 由给定样本集求解随机变量的分布密度函数问题是统计机器学习和概率统计学的基本问题之一。解决该问题的方法包括参数估计和非参数估计两大类: 1.参数估计方法 已知概率密度函数的形式而函数的有关参数未知,通过估计参数来估计概率密度函数的方法。有两种主要参数估计法:确定性参数估计方法是把参数看作确定而未知的, 典型方法为最大似然估计。随机参数

袁易学的博客(Yuan Yixue's Blog) 1万+

INFO3616 Python

12Email:directly.”attempts?bluecarbluebluebluecarcarbluecarcar3(2 marks)4BasicAliceworking.

wolfyout的博客 1335

DRM驱动代码分析:展频 跳频

DRM驱动代码分析:展频 跳频

yuuu_cheer的博客 2681

学习C#开源报表组件Seal Report(45:报表服务安全配置)

学习Seal Server Manager软件内与报表服务安全配置相关的各类属性的用途

gc_2299的博客 161

程序化广告行业(2/89):从程序化广告深挖数据处理技巧

大家好!我一直希望能和大家在技术学习的道路上携手共进,这也是我写这一系列博客的初衷。上次我们一起学习了Python基础的数据处理知识,这次咱们借助一本程序化广告手册,深入挖掘数据处理的更多技巧。这本手册涵盖了程序化广告从概念到技术实现的诸多方面,而其中处处都涉及到数据处理,相信会给我们带来不少收获

yyy173611的博客 4572

FANUC机器人S523 新款PN板卡与西门子PLC通信配置介绍

FANUC机器人S523 新款PN板卡与西门子PLC通信配置介绍

Robot_PLC_HMI_Automation 355

Advance Steel工具栏菜单的创建

创建jigdesignpalettedata.xml文件并放置于...\INT\Steel\Support\Toolbars\目录下,随后修改C:\ProgramData\Autodesk\Advance Steel 2025\INT\ASSettings_User.xml,添加对应键值对以加载该配置。示例中设置面板位置、大小及可见性,通过ParentId指定父窗口,确保自定义工具栏正确显示。

Advance Steel二次开发 39

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

C# 系列教程_12 字符串 string 保姆级系统教程(面向新手,大量示例 + 原理讲解)

C#中string与String为同一类型,均为不可变引用类型,任何“修改”操作均返回新字符串。常用创建方式包括字面量、逐字字符串@""、插值$""及new String()。字符串本质是字符数组,支持索引访问但不可修改。所有方法如IndexOf、Substring、Replace等均不改变原字符串,返回新实例。

zhanghaha1314的博客 281

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

Swift 字符详解:从 Character 到字符串遍历

Swift中Character代表扩展字形簇,符合人类对“一个字符”的直观理解。它与String为集合关系,可通过for-in遍历或数组拼接。Character基于Unicode,组合字符(如带重音字母、表情符号)视为整体,count统计字形簇数而非码点或字节。访问需用String.Index,不可直接整数下标。字符支持比较、大小写转换及ASCII互转,但必须用双引号声明,且与String类型区分。理解其设计可避免常见错误,提升字符串处理可靠性。

2402_85743155的博客 304

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

C#转Python第5.3篇:类型提示与静态分析:Python 的“伪静态类型“

Python的类型提示是“伪静态类型”——注解由IDE和工具(如mypy)使用,解释器运行时忽略。与C#强制编译时类型检查不同,Python类型注解仅作开发辅助,提升代码可读性、智能提示与静态分析能力。通过List[int]、Optional[str]、Protocol等特性,实现类型安全与泛型支持。Python 3.14起引入延迟求值与annotationlib,优化性能并支持前向引用。核心理念:类型注解是“给开发者看的文档”,而非运行时保障。

hanzhixintianxia的博客 267

第6章第4节:自定义分词器

本节详解Elasticsearch自定义分词器,解析analyzer三段式结构(char_filter→tokenizer→filter),掌握常用组件如ik_max_word、synonym_graph、ngram等。通过_analyze API调试分词效果,实现“索引时扩展同义词、搜索时不带”的生产级方案,提升中文搜索与智能提示体验。

啊渊的专栏 798

C# 数据结构和特殊类型

.NET Core(现称.NET)提供丰富数据结构,优化性能与开发效率。日常开发首选List<T>和Dictionary<TKey,TValue>;高性能场景推荐Span<T>与Memory<T>减少内存分配;并发环境使用ConcurrentDictionary等线程安全集合;避免非泛型集合如ArrayList。

cccloveforever的博客 765

SQL 基础查询与模糊查询全解 + C# WinForm 数据库连接实战:ADO.NET、参数化查询与 where 1=1 动态条件

上篇把表建好、关系连好。,再。从select *到,从到,从拼字符串到参数化,最后讲清楚where 1=1到底解决什么问题——顺便把课上那道选择题的答案讲透。

2501_94699871的博客 172

C# NModbus4 实战:ModbusTCP 读取以太网温湿度传感器

本文基于C#与NModbus4库,实战演示如何通过ModbusTCP协议读取以太网温湿度传感器(如H-THRJ45)数据。涵盖设备配置、寄存器地址解析、缩放换算及常见调试坑点,提供可运行的控制台Demo,适用于机房动环、GSP库房等物联网场景。代码支持异步扩展、数据持久化与告警逻辑,助力快速搭建自研采集系统。

weixin_41865733的博客 284

C# 系列教程_10 方法(Methods)保姆级精讲

本文系统讲解C#方法的定义与使用,涵盖语法结构、参数传递、返回值、作用域及重载机制。通过无参无返回值、有参、有返回值等示例,阐明方法如何减少冗余、提升代码可读性与维护性。重点强调方法重载(同名异参)、返回值类型不可单独决定重载、局部变量作用域限制等核心概念,并提醒新手常见误区,如缺少return、误判重载条件等。最后介绍可选参数与传值机制,帮助初学者掌握方法调用的规范与技巧。

zhanghaha1314的博客 340

BPE分词器的完整实现:字节对合并与词表构建

本文深入解析了大语言模型分词器的核心机制,以字节级BPE为例,揭示其如何将文本转化为token。通过字节编码实现无外生词(OOV)问题,但带来跨语言价差与计数故障等挑战。文章完整实现BPE训练与编码逻辑,强调预切分正则与语料配比的关键作用,并指出分词器不仅是技术组件,更是决定模型感知粒度与成本结构的底层决策——它塑造了模型对文字的理解方式,也影响着每一次推理的效率与费用。

2601_96733043的博客 292

C# ScottPlot 曲线控件

本文介绍使用ScottPlot.WinForms在WinForms中绘制高性能图表的实践。通过NuGet安装后,实现多种图形绘制:添加水平/垂直参考线、信号图与散点图(支持百万级数据)、自定义线段及多曲线叠加,并通过异步任务实现实时动态曲线更新,结合Refresh()与AutoScale优化渲染性能,有效解决大数据量下的显示问题。

m0_47020592的博客 44

C# SerpBase 谷歌搜索API:请求、建模与核账实战

上周二晚上 9 点 40 分,我还在改一个 .NET 看板:运营要监控 300 个品牌词在谷歌美国区的排名,第二天早上 10 点演示。原来基于 HtmlAgilityPack 硬解析页面的服务连续三天被拦截,返回忽长忽短。我决定连夜换成结构化搜索 API,用 C# 接,最后选了 SerpBase——它是纯 HTTP 的 POST JSON 接口,Base URL 固定为,.NET 这边不用任何第三方 SDK,一个HttpClient就能打通,而且同一个 Key 可以覆盖文档里列出的 43 个端点。

Y381532662的博客 194

用Python删除PPTX中的牛皮癣广告

本文介绍了一款免费的PPTX广告清理工具,利用Python与python-pptx库实现批量删除模板中的广告元素。该工具可自动清除幻灯片备注、母版名称、文档属性、最后两页广告页,并支持关键词搜索替换隐藏广告。通过GUI界面实现文件导入与一键清理,大幅提升效率,避免手动操作耗时出错。代码开源免费,适合需要快速处理大量带广告PPT模板的用户。

henanlion的博客 233

如何使用C#代码清理 Excel 表格中的空白行与空白列

通过 C# 代码,可以自动检查并删除 Excel 工作表中的空白行和空白列。利用IsBlank属性判断行或列是否为空,再分别调用和方法,即可完成清理操作。与手动逐行、逐列检查相比,这种方式更适合处理包含大量数据的 Excel 文件,能够减少重复操作,提高数据整理效率,使工作表保持整洁、清晰。在实际使用中,建议从工作表的末尾向前遍历并删除空白行和空白列,避免删除操作改变索引位置,影响后续检查。

2501_93070778的博客 239

使用C#代码在 Word 中设置行距和段落间距

通过 C# 代码,可以灵活调整 Word 文档中的行间距和段落间距,从而改善文档的整体排版效果。设置段前间距: 使用属性调整段落前方的空白距离。设置段后间距: 使用属性调整段落后方的空白距离。设置行间距: 使用属性控制同一段落中各行文本之间的距离。合理设置这些间距,不仅可以提高 Word 文档的可读性,还能优化页面空间利用率。这种方式适用于批量格式调整、自动化文档生成以及统一文档排版等场景。

2501_93070778的博客 202
上一篇: CSSE2002 Programming in the Large
下一篇: COMP3702 Artificial Intelligence BeeBot MDP
vx___codinghelp
博客等级 码龄2年 778粉丝 101原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值