Rebuild Blog By Hugo

Rebuild Blog By Hugo This site rebuild by Hugo instead of Wordpress on 2025-08-03. No database or backend programming needed.

August 3, 2025 · 1 min · Cat York

非对称加密解密简单原理

为理解这个过程,我们需要完成一次完整的 RSA 简化版运算。 假设有两个素数,分别是:17和53作为私钥。 第一步:准备材料(生成密钥) 选素数: p = 17, q = 53。 算公钥 N: N = 17 * 53 = 901。 **算秘密中间量 ϕ(n):**ϕ(n) = (17-1) * (53-1) = 832。 选加密指数e: 我们通常选一个小素数,比如e = 3。(只要e 和 832 互质就行)。 公钥就是:(901, 3)。你可以把这对数字发给任何人。 算解密指数 d: 这是最关键的一步。我们需要找一个数字 d,使得 d * e / 832 的余数等于 1。 计算过程:d * 3 / 832 = 余 1。 经过数学计算(辗转相除法),我们算出 d = 555。 检查一下:555 * 3= 1665。而 1665 = 832 * 2 + 1。正好余 1 ! 私钥就是:(901, 555)。这个 555 只有你自己知道。 第二步:加密过程(发件人操作) 现在,你的朋友想把秘密数字 15 发给你。他手里只有你的公钥 (901, 3)。 ...

January 4, 2026 · 1 min · Cat York

Change swappiness on linux

Check current swappiness cat /proc/sys/vm/swappiness Change swappiness sudo vim /etc/sysctl.conf set vm.swappiness = 10 apply setting: sudo sysctl -p

September 24, 2020 · 1 min · Cat York

Setup SWAP on Linux

1. Create SWAP file1. Create SWAP file dd if=/dev/zero of=/opt/.swap bs=1024k count=20 (count is what SWAP size you need, MB) mkswap /opt/.swap 2. Active SWAP swapon /opt/.swap 3. Check free 4. Disable SWAP, wipe SWAP file. if you just swapoff SWAP not delete SWAP file, SWAP will reactive when next restart. swapoff /opt/.swap` `rm /opt/.swap

March 16, 2020 · 1 min · Cat York

nohup command without getting nohup.out

The nohup command only writes to nohup.out if the output is otherwise to the terminal. If you redirect the output of the command somewhere else – including /dev/null – that’s where it goes instead. nohup command >/dev/null 2>&1 # doesn't create nohup.out If you’re using nohup, that probably means you want to run the command in the background by putting another & on the end of the whole thing: nohup command >/dev/null 2>&1 & # runs in background, still doesn't create nohup.out, no error file create

February 26, 2020 · 1 min · Cat York