日本欧洲视频一区_国模极品一区二区三区_国产熟女一区二区三区五月婷_亚洲AV成人精品日韩一区18p

CSC 172代寫、Java/C++程序設(shè)計(jì)代做

時(shí)間:2024-03-19  來源:  作者: 我要糾錯(cuò)



CSC 172 – Project 1
• You may work on and submit your project individually or in groups of 2 students.
• If you work in a group you will have to prepare an extended README file to specify
who wrote each part of the code for maintaining clarity and transparency within the
group project.
• You are only allowed to cooperate with your group members, and you are not permitted
to share your solution with other students in any way.
Task
You will implement a cipher specified below using Java programming language. It shall
encrypt/decrypt text files including plaintext/ciphertext.
Background
1. Encryption is the process of encoding information or data in such a way that only
authorized parties can access it. This is typically done using algorithms and secret
keys to transform the original data into an unintelligible form known as ciphertext.
2. Plaintext refers to the original, unencrypted data or message that is intended to be
kept confidential.
3. Ciphertext refers to the encrypted form of data or information that has undergone
encryption.
Working with files
To encrypt content of a text file you have to:
• Read the file: open the file you want to encrypt and read its contents into memory.
• Convert to binary.
• Encrypt the data: use the presented encryption algorithm and the user secret key to
encrypt the data read from the file.
• Do NOT convert back to characters.
• Write encrypted data to file: save the encrypted data to a new file.
To decrypt content of a text file you have to:
1
• Read the file: open the file you want to decrypt and read its contents into memory
(content should be just long sequence of zeros and ones).
• Decrypt the data: use the presented decryption algorithm and the user secret key to
encrypt the data read from the file.
• Convert to characters.
• Write decrypted data to file: save the encrypted data to a new file.
1 Algorithm Description
The algorithm encrypts fixed number of bits only (64 bits). To encrypt longer input use the
simple ECB (Electronic Codebook) mode. Here’s how it works:
• Divide the data into blocks: the plaintext data is divided into fixed-size blocks of 64
bits.
• Apply encryption to each block independently: each block of plaintext is encrypted
independently using the same secret key and encryption algorithm. The same key is
used for each block.
• Output the encrypted blocks: the resulting ciphertext blocks are concatenated together
to form the complete ciphertext.
• If the last block doesn’t have enough bits, it needs to be padded to meet the required
block size. This process is known as padding. Use zero padding: append zero bits
to the end of the block until it reaches the required size. (Do not worry about extra
characters at the end when you decrypt.)
Include methods to encrypt/decrypt a single block of plaintext/ciphertext that implements the following symmetric-key encryption algorithm:
2
Your output shall be a block of 64 zeros and ones. (Do not represent the output block in a
Hex notation. If you do that you get -10%.) Encryption and decryption are almost the
same, but for decryption you need to use subkeys in a reverse order: k10, k9, ...k1
3
1. Input Splitting: The plaintext block of 64 bits is divided into two halves of 32 bits.
Let’s denote these halves as L0 and R0.
2. Round Function Application: In each round, a round function f is applied to one
half of the data, typically the right half Ri
, using the round key ki of 32 bits. The
result of the function is then XORed with the other half Li
.
Li+1 = Ri
Ri+1 = Li ⊕ f(Ri
, ki)
3. Swapping: After each round, the halves are swapped so that the left half becomes
the right half, and vice versa.
4. Iteration: Steps 2 and 3 are repeated 10 times.
5. Output Concatenation: After all rounds are completed, the final output consists of
the two halves (L10 and R10) concatenated together. This forms the ciphertext.
1.1 The f - function
The f - function (round function) works as follows:
1. XOR gate: The 32 input bits are XORed with the round key ki
.
2. Splitting: The 32 bits are divided into four pieces of 8 bits.
4
3. S-box: For each piece of 8 bits the output of a S-box is computed (’looked up in the
S table’).
4. Output Concatenation: All four pieces are concatenated together to form 32 bits.
5. Permutation: 32 bits are permuted using permutation P.
S is a substitution box transformation (Rijndael S-box):
The table of the S-box, stated in hexadecimal for compactness. Permutation P is given by
the table:
See the last page if clarification about S and P is needed.
5
1.2 Computing subkeys
The round keys of 32 bits (subkeys ki) are derived from the input key of 56 bits by means
of the key schedule (total of 10 subkeys) using the following schedule:
1. Splitting: The main key k of 56 bits is divided into two halves of 28 bits. Let’s denote
these halves as C0 and D0.
2. Transformation Function: In each round, a left shift by 1 function LS1 is applied
separately to both half’s of the data, typically the right half Ri
, using the round key
ki of 32 bits. The result of the function is then XORed with the other half Li
.
Ci+1 = LS1(Ci)
Di+1 = LS1(Di)
3. Concatenation: In each round two halves (Ci and Di) are concatenated together.
The first (left most) 32 bits forms the round subkey ki
.
4. Iteration: Steps 2 and 3 are repeated 10 times.
6
1.3 Required methods
Your implementation must include the following methods:
• Custom xorIt(binary1, binary2)
• Custom shiftIt(binaryInput)
• Custom permuteIt(binaryInput)
• Custom SubstitutionS(binaryInput)
• functionF(rightHalf, subkey)
• encryptBlock(block, inputKey),
• decryptBlock(block, inputKey),
• encryption(longBinaryInput, inputKey),
• decryption(longBinaryInput, inputKey),
• keyScheduleTransform(inputKey),
• runTests()
• You can have additional helper functions. Custom means you can NOT use
ready methods and must write your own methods.
1.4 Build-in tests
The runTests() mathod shall be invoked when user runs the program and it shall print
output for the following test cases:
• encryptBloc(all ones, all ones)
• encryptBloc(all zeros, all ones)
• encryptBloc(all zeros, zeros)
• encryptBloc(block,input key), where:
block = 1100110010000000000001110101111100010001100101111010001001001100
input key = all zeros
• decryptBlock(all ones, all ones)
• decryptBlock(all zeros, all ones)
7
• decryptBlock(all zeros, zeros)
• decryptBlock(block,input key), where:
block = 0101011010001110111001000111100001001110010001100110000011110101
input key = all ones
• decryptBlock(block,input key), where:
block = 0011000101110111011100100101001001001101011010100110011111010111
input key = all zeros
When running the program
When the user runs the program, it should print output for the test cases from section 1.4.
The program should then prompt the user to choose whether they want to encrypt or decrypt
and specify the filename to process. Additionally, the program should ask for a filename to
save the output, and an appropriate file should be created for this purpose.
Running Tests:
Output for: encryption(all ones, all ones)
0101011010001110111001000111100001001110010001100110000011110101
Output for: encryption(all zeros, all ones)
1100111010001000100011011010110110110010100101011001100000101000
Output for: encryption(all zeros, all zeros)
1010100101110001000110111000011110110001101110011001111100001010
Output for: encryption(block,all zeros), where:
block = 1100110010000000000001110101111100010001100101111010001001001100
0010101110011011010001010111000010110110101011111010000101100101
Output for: decryption(all ones, all ones)
0100111001000110011000001111010101010110100011101110010001111000
Output for: decryption(all zeros, all ones)
1011001010010101100110000010100011001110100010001000110110101101
Output for: decryption(all zeros, all zeros)
1011000110111001100111110000101010101001011100010001101110000111
Output for: decryption(block,all ones), where:
block = 0101011010001110111001000111100001001110010001100110000011110101
1111111111111111111111111111111111111111111111111111111111111111
Output for: decryption(block,all zeros), where:
block = 0011000101110111011100100101001001001101011010100110011111010111
1111111111111111111111111111111111111111111111111111111111111111
Do you want to encrypt or decrypt (E/D): E
Filename: data.txt
Secret key: 10101101011101110101010101011100010110101011100010101010
8
Output file: data1.txt
Submission Requirements
Zip (archive) all the project source files and a README file and save it as a Project1LastName.zip
file. Include your LastName (+partner) in the filename. Upload the file to the appropriate
folder on Gradescope. Your README file should include name of the members of the team
and any specific instruction which is useful for the project. It should also include all the features (including additional features) that you have implemented. Make sure all your source
files are properly commented so that user can browse your code without getting lost.
2 Grading
The rubric for this assignment is available through Gradescope. Your solution will be tested
with private test cases.
0 points if the program doesn’t compile. No points for the rest. Grading complete.
2.1 Important note about Academic Honesty
If some of the tasks are challenging or not for you, feel free to discuss with others but all
discussion have to be on high level without writing code or pseudocode. Once you sit down
and start coding, all the code you write should be your own . Using ready code from other
sources (internet, friends, chatGPT etc.) will be considered as a violation of the academic
honesty. After submitting your work, you should be able to explain your code in details, if
so requested by lab TAs or by the instructor. Your initial points may be reduced, if unable
to answer questions on your submitted work.
3 Hints
• Text file sbox.txt contains a constant - S- box look up table that you can use.
• S- box example:
– Let’s say we want to compute the substitution for the byte 53 (in binary 01010011).
– We’ll first convert 53 to its row and column indices.
– The first hex digit (5) represents the row index.
– The second hex digit (3) represents the column index.
– So, for 53, the row index is 5 and the column index is 3.
– Now, we’ll look up the value in the S-box using these indices.
9
– The value at row 5 and column 3 in the S-Box is ed (in binary 11101101).
• Permutation table example: Consider table (3x3):
Sample input: 101111000
Output after permutation: 001111010
– The permutation table rearranges the elements of the input according to the
specified positions.
– Each number in the permutation table represents the position of the corresponding
element in the input.
– For example, the element at position 1 of the input (value 1) becomes the element
at position 4 of the output.
– Similarly, the element at position 9 of the input (value 0) becomes the element at
position 1 of the output.
Sample input 2: 111000111
請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codehelp

標(biāo)簽:

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:代寫MTRN4010、代做MATLAB程序設(shè)計(jì)
  • 下一篇:CS 213代做、Java設(shè)計(jì)編程代寫
  • 無相關(guān)信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國(guó)家級(jí)風(fēng)景名勝區(qū)
    昆明西山國(guó)家級(jí)風(fēng)景名勝區(qū)
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 短信驗(yàn)證碼平臺(tái) 理財(cái) WPS下載

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    日本欧洲视频一区_国模极品一区二区三区_国产熟女一区二区三区五月婷_亚洲AV成人精品日韩一区18p

              9000px;">

                        天天色综合久久| 女同激情久久av久久| 91高清国产视频| www.免费av| 91精品人妻一区二区三区| 国产在线观看你懂的| 香蕉久久久久久av成人| 国产黄色网址在线观看| 日本中文在线视频| 成人欧美一区二区三区黑人一| 欧洲av一区二区三区| 亚洲天堂国产视频| 激情五月婷婷小说| 五月天婷婷视频| 国产一级视频在线播放| 亚洲成人网在线播放| 国产又黄又粗又硬| 亚洲精品久久久久久久久久久久久久| 国产自产一区二区| 亚洲欧美自拍另类日韩| 日本三级一区二区| 国产精品久久久久久久久久久久久久久久久久 | 免费一级suv好看的国产网站| 最新中文字幕一区| 欧美三级午夜理伦三级富婆| 丰满熟妇乱又伦| 中日韩黄色大片| 美国黄色特级片| 国产精品久久久久久99| 中文字幕在线观看免费| 日韩精品在线不卡| 国语对白在线播放| www.99在线| 真实乱偷全部视频| 漂亮人妻被黑人久久精品| 国产免费一区二区三区最新6 | 国产一卡二卡三卡四卡| 中文字幕精品视频在线| 欧美在线aaa| 成人免费看片98欧美| 中文字幕视频一区二区| 久久人人爽人人爽人人片av免费| 亚洲综合久久av一区二区三区| 日本国产在线观看| 国产九九在线视频| 亚洲男人第一天堂| 日本在线观看中文字幕| 国产午夜精品理论片在线| 中文字幕在线国产| 欧美一区,二区| 国产手机av在线| 97国产精品久久久| 日本成人精品视频| 国产精品揄拍100视频| 亚洲精品无amm毛片| 色噜噜一区二区三区| 精品国产乱码久久久久久蜜臀网站| 亚洲午夜精品一区| 羞羞的视频在线| 日韩av.com| 久久久久久国产精品免费播放| 99久久综合网| 亚洲欧美在线视频免费| 香蕉视频一区二区| 日产欧产va高清| 久热精品在线观看视频| 国产aⅴ爽av久久久久成人| 中文字幕制服丝袜| 五月天婷婷在线观看| 欧美风情第一页| 久久国产劲爆∧v内射| 国产伦精品一区二区三区妓女| 91视频久久久| 中文在线字幕av| 午夜天堂在线视频| 日本美女视频一区| 国产无遮挡又黄又爽在线观看| 99视频在线看| 999av视频| 一级黄色大片视频| 182在线观看视频| 91久久免费视频| 夜夜爽久久精品91| 亚洲视频天天射| 亚洲免费观看在线| 亚洲精品第二页| 亚洲免费在线视频观看| 亚洲免费不卡视频| 在线不卡免费视频| 亚洲毛片在线播放| 亚洲综合色一区| yjizz国产| 国产精品国产三级国产专业不| 国产a级片视频| 国产精品国产三级国产普通话对白| 国产精品成人久久| 国产精品女人久久久| 国产毛片久久久久| 国产综合精品视频| 乱老熟女一区二区三区| 国产一区二区三区中文字幕| 精品熟女一区二区三区| 欧美大片xxxx| 午夜激情av在线| 亚洲国产成人精品一区二区三区 | 亚洲第一区第二区第三区| 亚洲 欧美 日韩 在线| 中文字幕一区二区人妻痴汉电车| 中文字幕在线播放不卡| 亚洲一区二区蜜桃| 国产黄色网址在线观看| 精品一区在线观看视频| 日本一区二区网站| 色窝窝无码一区二区三区| 在线观看亚洲网站| 亚洲综合123| 国产精品69久久久久孕妇欧美| 妺妺窝人体色www聚色窝仙踪| 欧美一级片在线免费观看| 熟女少妇一区二区三区| 中文字幕在线视频一区二区| 成人精品在线播放| 久久久久久av无码免费看大片| 日日骚一区二区三区| 一区二区精品免费| www.xxxx日本| 国产在线欧美在线| 日韩av免费网址| 中文字幕在线播出| 国产黄色三级网站| 欧美成欧美va| 中文字幕乱码人妻无码久久| а天堂中文在线资源| 男女污污的视频| 中文字幕1234区| 国产麻豆剧传媒精品国产av| 色婷婷成人在线| 91国内精品视频| 精品国产乱码久久久久夜深人妻 | 一区二区精品免费| 波多野结衣av在线观看| 免看一级a毛片一片成人不卡| 日韩在线观看视频一区二区三区| 一级日韩一级欧美| 精品少妇一二三区| 亚洲黄色免费观看| 久久国产在线观看| 亚洲综合精品在线| 久久久久久久9999| 91久久久久久久久久久久| 老熟妇一区二区三区啪啪| 日韩xxx视频| 成年人三级黄色片| 日韩精品xxx| jizz国产在线| 日韩乱码人妻无码中文字幕| 91精品国产高清91久久久久久| 精品无码人妻一区二区免费蜜桃| 亚洲av无码一区二区二三区| 国产高清成人久久| 亚洲av片在线观看| 国产精品一区二区小说| 中文字幕精品视频在线| 久久精品日韩无码| 中文字幕在线播放不卡| 麻豆久久久久久久久久| 91黄色免费视频| 天天插天天干天天操| 国产精品二区一区二区aⅴ| 亚洲 国产 日韩 欧美| 国产九九九视频| 亚洲精品国产久| 免费观看一区二区三区| 国产jjizz一区二区三区视频| 午夜不卡福利视频| 精品人妻一区二区免费| 一级全黄裸体免费视频| 少妇精品无码一区二区三区| 国产成人a v| 亚洲精品鲁一鲁一区二区三区| 欧美第一页在线观看| 国产成人麻豆精品午夜在线| 亚洲精品911| 色欲av无码一区二区三区| 国内精品偷拍视频| 一级特黄aaa| 亚洲av成人片色在线观看高潮| 另类小说第一页| 成人爽a毛片一区二区| 亚洲精品一区二区三区四区| 日本美女一级视频| 狠狠躁夜夜躁人人爽天天高潮| 99riav国产| 性高潮久久久久久久久久| 免费一级特黄录像| 国产美女喷水视频| 最近中文字幕一区二区| 真实新婚偷拍xxxxx| 中文字幕在线播放视频| 欧美日韩综合一区二区|