久久久久久精品无码人妻_青春草无码精品视频在线观_无码精品国产VA在线观看_国产色无码专区在线观看

CSC 172代寫、Java/C++程序設計代做

時間:2024-03-19  來源:  作者: 我要糾錯



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
請加QQ:99515681  郵箱:99515681@qq.com   WX:codehelp

標簽:

掃一掃在手機打開當前頁
  • 上一篇:代寫MTRN4010、代做MATLAB程序設計
  • 下一篇:CS 213代做、Java設計編程代寫
  • 無相關信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲
    油炸竹蟲
    酸筍煮魚(雞)
    酸筍煮魚(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚
    香茅草烤魚
    檸檬烤魚
    檸檬烤魚
    昆明西山國家級風景名勝區
    昆明西山國家級風景名勝區
    昆明旅游索道攻略
    昆明旅游索道攻略
  • 短信驗證碼平臺 理財 WPS下載

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    久久久久久精品无码人妻_青春草无码精品视频在线观_无码精品国产VA在线观看_国产色无码专区在线观看

    日韩av在线综合| 亚洲美免无码中文字幕在线| 久久天天东北熟女毛茸茸| 欧美激情精品久久久久久小说| 日本激情综合网| 在线观看岛国av| 九色porny91| 久久久久久综合网| 久久精品国产精品亚洲色婷婷| wwwwwxxxx日本| 精品中文字幕av| 隔壁人妻偷人bd中字| 色国产在线视频| 密臀av一区二区三区| 日本中文字幕片| 日本成年人网址| 成熟丰满熟妇高潮xxxxx视频| 亚洲免费视频播放| 日本一级淫片演员| 亚洲啊啊啊啊啊| 国产911在线观看| 91丝袜超薄交口足| 日本中文字幕精品—区二区| 久久国产色av免费观看| 国产午夜福利在线播放| heyzo国产| 99视频在线视频| gogogo高清免费观看在线视频| www.日本一区| 日日干日日操日日射| 五月天国产视频| 色婷婷777777仙踪林| 日韩极品视频在线观看| 免费看日本黄色| 丝袜人妻一区二区三区| 97视频在线免费| 六月丁香婷婷在线| 91欧美视频在线| 欧美午夜精品理论片| 国产盗摄视频在线观看| 男人添女荫道口图片| 狠狠爱免费视频| 黄大色黄女片18第一次| 国产人妻互换一区二区| 国产真人做爰毛片视频直播| 男女高潮又爽又黄又无遮挡| 国产精品69页| 在线观看日本www| 国产在线视频在线| 高清在线观看免费| 男人添女人下面免费视频| 手机av在线网站| 免费拍拍拍网站| 精品www久久久久奶水| 久久黄色片网站| 国产欧美123| 国产日产欧美视频| 四季av一区二区三区| 毛片在线视频观看| 男女午夜激情视频| 国产精品嫩草影视| 欧美 日韩 亚洲 一区| 亚洲福利精品视频| 天天做天天躁天天躁| 国产美女三级视频| 亚洲免费av网| 欧美美女一级片| www.国产在线播放| www.超碰com| 国产精品三级一区二区| 国内自拍视频一区| 国产精品久久国产| 中文字幕网av| 日本黄色片一级片| 伊人成人222| 乱妇乱女熟妇熟女网站| 国产高清精品软男同| 欧美成人一区二区在线观看| 日韩a一级欧美一级| 日日碰狠狠添天天爽超碰97| 欧美性受xxxxxx黑人xyx性爽| 无码精品a∨在线观看中文| 91免费视频污| 北条麻妃69av| 国产又爽又黄ai换脸| 欧在线一二三四区| www.黄色网址.com| 中文字幕有码av| 男女日批视频在线观看| 国产精品动漫网站| 天天在线免费视频| 成人黄色片视频| 成年人黄色在线观看| 亚洲色欲久久久综合网东京热| 成人短视频在线观看免费| 亚洲午夜无码av毛片久久| 日本一二三区在线| 老熟妇仑乱视频一区二区| 8x8x华人在线| 自拍日韩亚洲一区在线| 久久久久久久久久久久91| 亚洲成人动漫在线| 在线观看免费不卡av| 黄色片久久久久| 国产免费裸体视频| 国产999免费视频| 激情综合网俺也去| 久久国产亚洲精品无码| 色哺乳xxxxhd奶水米仓惠香| 精品视频无码一区二区三区| 免费观看美女裸体网站| 91精品国产毛片武则天| 日韩在线一区视频| 免费日韩视频在线观看| 天天做天天躁天天躁| 国产一区一区三区| 天堂在线一区二区三区| av亚洲天堂网| 日本一极黄色片| 日本三级免费观看| 国产最新免费视频| 久久av综合网| 国产玉足脚交久久欧美| 粉嫩av一区二区三区天美传媒 | 国产肥臀一区二区福利视频| 五月天婷婷在线观看视频| 精品综合久久久久| 熟女少妇精品一区二区| 污污视频网站免费观看| 国产综合免费视频| 日韩精品一区二区三区色欲av| 日韩精品 欧美| 国产原创中文在线观看 | 欧美成人xxxxx| 日本www在线播放| 色综合久久久久无码专区| 精品视频在线观看一区| 久久这里只有精品18| 成年丰满熟妇午夜免费视频| 黄色片免费在线观看视频| aa视频在线播放| 无码粉嫩虎白一线天在线观看 | 丰满少妇久久久| 欧美日韩不卡在线视频| 和岳每晚弄的高潮嗷嗷叫视频| 国产精品无码av在线播放| 免费毛片小视频| 美女黄色片视频| 在线看免费毛片| 色姑娘综合天天| 日韩xxxx视频| 欧美 国产 小说 另类| 99热手机在线| 网站在线你懂的| 精品嫩模一区二区三区| 日本福利视频在线| 国产裸体免费无遮挡| 小明看看成人免费视频| 亚洲成年人专区| 国产一区二区三区乱码| 欧美激情精品久久久久久小说| 欧美伦理片在线观看| 亚洲一区二区图片| 日韩精品一区二区在线视频| 日本日本19xxxⅹhd乱影响| 色免费在线视频| 老司机午夜免费福利视频| 男女激情无遮挡| 五月婷婷丁香色| 黄色一级大片免费| 久久久国产欧美| 欧美a在线视频| 国产wwwxx| www.69av| 精品www久久久久奶水| 色婷婷一区二区三区在线观看| 欧美a级免费视频| 国产一区二区视频免费在线观看| www.污污视频| 青青艹视频在线| 亚洲第一综合网站| 91传媒久久久| 欧美成人手机在线视频| 国产96在线 | 亚洲| 蜜桃福利午夜精品一区| 亚洲熟妇无码一区二区三区| 8x8x最新地址| 91麻豆天美传媒在线| 欧美少妇性生活视频| 亚洲区成人777777精品| 成年人黄色片视频| 穿情趣内衣被c到高潮视频| 无码人妻h动漫| 国产va亚洲va在线va| 美女少妇一区二区| 成人性生活视频免费看| 福利视频999| 激情综合在线观看| 视色,视色影院,视色影库,视色网| 97国产在线播放|