missing课程作业_Security and Cryptography

本文探讨了密码学中的关键概念,包括基于四词组合的密码熵(约67位),8字符随机字母数字密码的熵(约48位),并比较了两者的安全性。还介绍了使用OpenSSL进行AES加密操作,并通过校验Debian镜像的SHA256哈希来验证其完整性。此外,文章还涵盖了如何设置SSH密钥和使用GPG进行加密邮件及Git签名操作。
摘要由CSDN通过智能技术生成

Security and Cryptography

课程地址

Q1

Question

Entropy

  1. Suppose a password is chosen as a concatenation of four lower-case dictionary words, where each word is selected uniformly at random from a dictionary of size 100,000. An example of such a password is correcthorsebatterystaple. How many bits of entropy does this have?
  2. Consider an alternative scheme where a password is chosen as a sequence of 8 random alphanumeric characters (including both lower-case and upper-case letters). An example is rg8Ql34g. How many bits of entropy does this have?
  3. Which is the stronger password?
  4. Suppose an attacker can try guessing 10,000 passwords per second. On average, how long will it take to break each of the passwords?

Solution

  1. l o g 2 ( 10000 0 4 ) = 66.4385 ≈ 67 log_2(100000^4)=66.4385 \approx 67 log2(1000004)=66.438567
  2. l o g 2 ( 6 2 8 ) = 47.6335 ≈ 48 log_2(62^8)=47.6335 \approx 48 log2(628)=47.633548
  3. the first one
  4. 10000 0 4 ÷ 10000 = 1 0 16 100000^4 \div 10000=10^{16} 1000004÷10000=1016 and 6 2 8 ÷ 10000 ≈ 21834010558 62^8 \div 10000 \approx 21834010558 628÷1000021834010558
    前者破译大概需要317097919年,后者破译大概要693年。

Q2

Question

Cryptographic hash functions. Download a Debian image from a mirror (e.g. from this Argentinean mirror). Cross-check the hash (e.g. using the sha256sum command) with the hash retrieved from the official Debian site (e.g. this file hosted at debian.org, if you’ve downloaded the linked file from the Argentinean mirror).

Solution

从mirror中下载得到系统镜像iso文件,对比官网中的sha256序列。

$ wget http://debian.xfree.com.ar/debian-cd/current/amd64/iso-cd/debian-11.3.0-amd64-netinst.iso
$ sha256sum debian-11.3.0-amd64-netinst.iso
7892981e1da216e79fb3a1536ce5ebab157afdd20048fe458f2ae34fbc26c19b  debian-11.3.0-amd64-netinst.iso

在这里插入图片描述

Q3

Question

Symmetric cryptography. Encrypt a file with AES encryption, using OpenSSL: openssl aes-256-cbc -salt -in {input filename} -out {output filename}. Look at the contents using cat or hexdump. Decrypt it with openssl aes-256-cbc -d -in {input filename} -out {output filename} and confirm that the contents match the original using cmp.

Solution

Q4

Question

  1. Asymmetric cryptography.
    1. Set up SSH keys on a computer you have access to (not Athena, because Kerberos interacts weirdly with SSH keys). Make sure your private key is encrypted with a passphrase, so it is protected at rest.
    2. Set up GPG
    3. Send Anish an encrypted email (public key).
    4. Sign a Git commit with git commit -S or create a signed Git tag with git tag -s. Verify the signature on the commit with git show --show-signature or on the tag with git tag -v.

Solution

$ ssh-keygen -t ed25519
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/wells/.ssh/id_ed25519): id_ed25519
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_ed25519
Your public key has been saved in id_ed25519.pub
The key fingerprint is:
SHA256:bi9RakjjCTXtbyaSk/HOKXruve/IhU9VsCnFNjOJQYY wells@HUIPU-Wells
The key's randomart image is:
+--[ED25519 256]--+
|       . o++o.   |
|      o E...B+   |
|     . o  ..o+.  |
|    . + . .. .   |
|     + OS+  .    |
|      O.*.+.     |
|       *+*o      |
|      o+=*       |
|    .=o.===      |
+----[SHA256]-----+

另可以使用ssh-copy-id向客户端发送公钥,例如

ssh-copy-id git@github.com

2.TODO

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值