完成下面任务(14分)
1 在 Ubuntu 或 openEuler 中完成任务(推荐openEuler)
2 生成一个文档 sn.txt,内容为全班同学的 8 位学号,把你的学号排到第一个
[wzy@LAPTOP-PRC71A0C test1]$ vim sn.txt
[wzy@LAPTOP-PRC71A0C test1]$ for i in {20221401..20221428}; do
echo $i >> sn.txt
done
[wzy@LAPTOP-PRC71A0C test1]$ vim sn.txt//进入文档调整学号顺序
示例
20221417
20221401
20221402
20221403
20221404
20221405
20221406
20221407
20221408
20221409
20221410
20221411
20221412
20221413
20221414
20221415
20221416
20221418
20221419
20221420
20221421
20221422
3 使用 GmSSL 编程求 sn.txt的 Hash 值,提交代码或代码链接,以及编译运行过程(文本或截图)(10 分)
[wzy@LAPTOP-PRC71A0C test1]$ vim hash.c
[wzy@LAPTOP-PRC71A0C test1]$ gcc -o hash hash.c -lgmssl
[wzy@LAPTOP-PRC71A0C test1]$ ./hash
SM3 Hash: 8a4c695c5130bd003bf0802a95cad1fecff6818c1c78069527ca4a48ea197a05
[wzy@LAPTOP-PRC71A0C test1]$ ls
hash hash.c sn.txt
4 使用 OpenSSL 命令验证你的计算结果的正确性(4 分)
[wzy@LAPTOP-PRC71A0C test1]$ openssl dgst -sm3 sn.txt
SM3(sn.txt)= 8a4c695c5130bd003bf0802a95cad1fecff6818c1c78069527ca4a48ea197a05
检验完成,hash值正确。