init: v1.0.0

This commit is contained in:
yaole
2026-05-27 23:03:00 +08:00
commit 8d97f750eb
466 changed files with 80067 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
/*
Package sm1 is the implementation of SM1 block cipher.
The SM1 works as follows, There are three keys:
- systems key SK
- auxiliary key AK
- key
# Enecryption
PT key SK
| | |
v +---v------v----+
R(·) <---- |rk |
| | |
| | key expand |
v | |
round f(·) <---|rk |
| +---------------+
v
J(·)
|
v
CT
# Decryption
CT key SK
| | |
v +---v------v----+
R⁻¹(·) <--- |rk |
| | |
| | key expand |
v | |
round f(·) <---|rk |
| +---------------+
v
J(·)
|
v
PT
# R Transformation
The input of R is 128 bits, and denotes as X0, X1, X2, X3 from left to right.
The output of R is 128 bits, and denotes as Y0, Y1, Y2, Y3 from left to right..
Y0 = X0 << 1
Y1 = X1 << 9
Y2 = X2 << 17
Y3 = X3 << 25
# R⁻¹ Transformation
The R⁻¹ Transformation is the reverse of R transformation.
Y0 = X0 >> 1
Y1 = X1 >> 9
Y2 = X2 >> 17
Y3 = X3 >> 25
*/
package sm1